From c2329486a41988fca0a8cbf3ea1190a70a9b923d Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Tue, 3 Oct 2023 01:25:33 +0200 Subject: [PATCH] Add sarek and related NFS shares --- flake.nix | 18 ++++++++++++++++++ hosts/sarek/configuration.nix | 32 ++++++++++++++++++++++++++++++++ hosts/sarek/home.nix | 20 ++++++++++++++++++++ hosts/voyager/filesystems.nix | 15 +++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 hosts/sarek/configuration.nix create mode 100644 hosts/sarek/home.nix diff --git a/flake.nix b/flake.nix index 3c1b1a6..97d8d9d 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,24 @@ } ]; }; + sarek = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + # Overlays-module makes "pkgs.unstable" available in configuration.nix + ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) + + ./hosts/sarek/configuration.nix + sops-nix.nixosModules.sops + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users."felixalb" = import ./hosts/sarek/home.nix; + } + ]; + }; chapel = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { diff --git a/hosts/sarek/configuration.nix b/hosts/sarek/configuration.nix new file mode 100644 index 0000000..21a6ce7 --- /dev/null +++ b/hosts/sarek/configuration.nix @@ -0,0 +1,32 @@ +{ config, pkgs, lib, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/virtualisation/proxmox-lxc.nix") + ../../base.nix + ../../common/metrics-exporters.nix + # ./hardware-configuration.nix + ]; + + fileSystems."/mnt/backup" = { + fsType = "nfs"; + device = "//voyager.home.feal.no/defiant-backup"; + options = [ "defaults" "noauto" "x-systemd.automount" ]; + }; + + # Boot, console and networking is handled by proxmoxLXC. + boot.loader.systemd-boot.enable = lib.mkForce false; # Enabled in base.nix, forced off here. + networking.domain = lib.mkForce null; + + sops.defaultSopsFile = ../../secrets/sarek/edison.yaml; + + environment.variables = { EDITOR = "vim"; }; + environment.systemPackages = with pkgs; [ + ]; + + networking.firewall.allowedTCPPorts = [ 22 ]; + + system.stateVersion = "23.05"; +} + diff --git a/hosts/sarek/home.nix b/hosts/sarek/home.nix new file mode 100644 index 0000000..bb390ad --- /dev/null +++ b/hosts/sarek/home.nix @@ -0,0 +1,20 @@ +{ pkgs, lib, ... }: +{ + home.packages = with pkgs; [ + bat + bottom + ncdu + neofetch + nix-index + ]; + + imports = [ + ./../../home/base.nix + ]; + + programs = { + zsh.shellAliases."rebuild" = "sudo nixos-rebuild switch --flake /config"; + }; + + home.stateVersion = "23.05"; +} diff --git a/hosts/voyager/filesystems.nix b/hosts/voyager/filesystems.nix index c53ff3b..5087aac 100644 --- a/hosts/voyager/filesystems.nix +++ b/hosts/voyager/filesystems.nix @@ -39,4 +39,19 @@ # Network mounts (export) + fileSystems = { + "/export/defiant-backup" = { + device = "/tank/backup/defiant"; + options = [ "bind" ]; + }; + }; + + services.nfs = { + enable = true; + exports = '' + /export 192.168.10.181(rw,fsid=0,insecure,no_subtree_check,async,no_root_squash) + /export/defiant-backup 192.168.10.181(rw,nohide,insecure,no_subtree_check,async,no_root_squash) + ''; + }; + }