diff --git a/hosts/nero/hardware.nix b/hosts/nero/hardware.nix index 6042daa..cf5355f 100644 --- a/hosts/nero/hardware.nix +++ b/hosts/nero/hardware.nix @@ -9,6 +9,7 @@ { imports = [ (modulesPath + "/installer/scan/not-detected.nix") + ../shared/fs-layouts/single-disk-btrfs.nix ]; boot = { @@ -22,58 +23,27 @@ ]; initrd.kernelModules = [ ]; - kernelModules = [ "kvm-amd" ]; + kernelModules = [ ]; extraModulePackages = [ ]; }; - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/7559f03a-28da-482d-934a-5d4f88ab085f"; - fsType = "btrfs"; - }; + fileSystems."/mnt/fileshare" = { + device = "frank@vergil.cfl.rr.com:/mnt/shares"; + fsType = "sshfs"; - "/home" = { - device = "/dev/disk/by-uuid/7559f03a-28da-482d-934a-5d4f88ab085f"; - fsType = "btrfs"; - options = [ "subvol=home" ]; - }; - - "/nix" = { - device = "/dev/disk/by-uuid/7559f03a-28da-482d-934a-5d4f88ab085f"; - fsType = "btrfs"; - options = [ "subvol=nix" ]; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/12B3-D345"; - fsType = "vfat"; - options = [ - "fmask=0077" - "dmask=0077" - ]; - }; - - "/mnt/fileshare" = { - device = "frank@vergil.cfl.rr.com:/mnt/shares"; - fsType = "sshfs"; - options = [ - "uid=1000" - "gid=1000" - "default_permissions" - "allow_other" - "_netdev" - "x-systemd.automount" - "reconnect" - "ServerAliveInterval=15" - "IdentityFile=/root/.ssh/id_rsa" - ]; - }; + options = [ + "uid=1000" + "gid=1000" + "default_permissions" + "allow_other" + "_netdev" + "x-systemd.automount" + "reconnect" + "ServerAliveInterval=15" + "IdentityFile=${config.sops.secrets.personal_ssh_key_ed25519.path}" + ]; }; - swapDevices = [ - { device = "/dev/disk/by-uuid/431e8332-e3d5-400b-93e7-27b9c8dc1dfe"; } - ]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware = { diff --git a/hosts/pdw-frankiel/hardware.nix b/hosts/pdw-frankiel/hardware.nix index 4b11587..701f21d 100644 --- a/hosts/pdw-frankiel/hardware.nix +++ b/hosts/pdw-frankiel/hardware.nix @@ -9,6 +9,7 @@ { imports = [ (modulesPath + "/installer/scan/not-detected.nix") + ../shared/fs-layouts/single-disk-btrfs.nix ]; boot = { @@ -24,43 +25,11 @@ initrd.kernelModules = [ ]; - kernelModules = [ "kvm-intel" ]; + kernelModules = [ ]; extraModulePackages = [ ]; }; - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/2b88fa45-f012-4df6-b59c-5b45ee0fc6e8"; - fsType = "btrfs"; - }; - - "/home" = { - device = "/dev/disk/by-uuid/2b88fa45-f012-4df6-b59c-5b45ee0fc6e8"; - fsType = "btrfs"; - options = [ "subvol=home" ]; - }; - - "/nix" = { - device = "/dev/disk/by-uuid/2b88fa45-f012-4df6-b59c-5b45ee0fc6e8"; - fsType = "btrfs"; - options = [ "subvol=nix" ]; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/679B-3FC0"; - fsType = "vfat"; - options = [ - "fmask=0077" - "dmask=0077" - ]; - }; - }; - - swapDevices = [ - { device = "/dev/disk/by-uuid/2ef72da1-8c5b-449d-8460-0f5833bd856d"; } - ]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware = { diff --git a/hosts/shared/fs-layouts/single-disk-btrfs.nix b/hosts/shared/fs-layouts/single-disk-btrfs.nix new file mode 100644 index 0000000..1aff7f8 --- /dev/null +++ b/hosts/shared/fs-layouts/single-disk-btrfs.nix @@ -0,0 +1,36 @@ +{ _, ... }: +{ + # RECOMMENDED BTRFS SUBVOLUME LAYOUT + # /home + # /home/.snapshots (needed if snapper on home dir to be enabled) + # /srv + # /var/lib/portables + # /var/lib/machines + # /tmp + # /var/tmp + # + # REQUIRED PARTLABELS (can be set in parted or other tools NOT!!! FILESYSTEM LABEL!) + # / - NIXOS + # /boot - ESP + # swap - SWAP + + fileSystems = { + "/" = { + device = "/dev/disk/by-partlabel/NIXOS"; + fsType = "btrfs"; + }; + + "/boot" = { + device = "/dev/disk/by-partlabel/ESP"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + }; + + swapDevices = [ + { device = "/dev/disk/by-partlabel/SWAP"; } + ]; +} diff --git a/hosts/shared/fs-layouts/single-disk-xfs.nix b/hosts/shared/fs-layouts/single-disk-xfs.nix new file mode 100644 index 0000000..76b5a48 --- /dev/null +++ b/hosts/shared/fs-layouts/single-disk-xfs.nix @@ -0,0 +1,27 @@ +{ _, ... }: +{ + # REQUIRED PARTLABELS (can be set in parted or other tools NOT!!! FILESYSTEM LABEL!) + # / - NIXOS + # /boot - ESP + # swap - SWAP + + fileSystems = { + "/" = { + device = "/dev/disk/by-partlabel/NIXOS"; + fsType = "xfs"; + }; + + "/boot" = { + device = "/dev/disk/by-partlabel/ESP"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + }; + + swapDevices = [ + { device = "/dev/disk/by-partlabel/SWAP"; } + ]; +} diff --git a/hosts/vergil/hardware.nix b/hosts/vergil/hardware.nix index 3e2bf3c..3d73d14 100644 --- a/hosts/vergil/hardware.nix +++ b/hosts/vergil/hardware.nix @@ -8,6 +8,7 @@ { imports = [ (modulesPath + "/installer/scan/not-detected.nix") + ../shared/fs-layouts/single-disk-xfs.nix ]; boot = { @@ -25,36 +26,26 @@ kernelModules = [ ]; }; - kernelModules = [ "kvm-intel" ]; + kernelModules = [ ]; extraModulePackages = [ ]; }; - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/05376a0d-18d1-4e7b-8f75-fe052a5636ac"; - fsType = "xfs"; - }; + # DO NOT mount by partlabel or other value other than UUID. + # Disk is a child of a VM disk from PROXMOX and WILL NOT + # be picked up automatically elsewise. + fileSystems."/mnt" = { + device = "/dev/disk/by-uuid/1432aeae-71e9-4f34-97dc-cf0fe74a4e00"; + fsType = "xfs"; - "/boot" = { - device = "/dev/disk/by-uuid/631D-23D2"; - fsType = "vfat"; - options = [ - "fmask=0077" - "dmask=0077" - ]; - }; - - "/mnt" = { - device = "/dev/disk/by-uuid/1432aeae-71e9-4f34-97dc-cf0fe74a4e00"; - fsType = "xfs"; - options = [ - "noauto" - "x-systemd.automount" - "x-systemd.after=mount-vm-disk.service" - ]; - }; + options = [ + "noauto" + "x-systemd.automount" + "x-systemd.after=mount-vm-disk.service" + ]; }; + # Vergil doesn't have a swap device but ../shared/fs-layouts/single-disk-xfs.nix defines one. + # This shouldn't be an issue at runtime but explicit removal reduces log spam. swapDevices = [ ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;