From b54cca8634b725c290ce855687ff021e0ad2dc77 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Tue, 25 Jul 2023 18:08:31 -0400 Subject: [PATCH] hosts/*: pull filesystems into their own files --- hosts/Infini-DESKTOP/default.nix | 1 + hosts/Infini-DESKTOP/filesystems.nix | 83 ++++++++++++++++++ .../Infini-DESKTOP/hardware-configuration.nix | 86 +------------------ hosts/Infini-FRAMEWORK/default.nix | 1 + hosts/Infini-FRAMEWORK/filesystems.nix | 60 +++++++++++++ .../hardware-configuration.nix | 64 +------------- hosts/Infini-SERVER/default.nix | 1 + hosts/Infini-SERVER/filesystems.nix | 80 +++++++++++++++++ .../Infini-SERVER/hardware-configuration.nix | 86 +------------------ 9 files changed, 229 insertions(+), 233 deletions(-) create mode 100644 hosts/Infini-DESKTOP/filesystems.nix create mode 100644 hosts/Infini-FRAMEWORK/filesystems.nix create mode 100644 hosts/Infini-SERVER/filesystems.nix diff --git a/hosts/Infini-DESKTOP/default.nix b/hosts/Infini-DESKTOP/default.nix index 97c9193..4653bc7 100644 --- a/hosts/Infini-DESKTOP/default.nix +++ b/hosts/Infini-DESKTOP/default.nix @@ -8,6 +8,7 @@ private.nixosModules.wireless ./hardware-configuration.nix + ./filesystems.nix ]; system.stateVersion = "21.11"; diff --git a/hosts/Infini-DESKTOP/filesystems.nix b/hosts/Infini-DESKTOP/filesystems.nix new file mode 100644 index 0000000..e46b5f2 --- /dev/null +++ b/hosts/Infini-DESKTOP/filesystems.nix @@ -0,0 +1,83 @@ +{ config, lib, pkgs, ... }: +let + uuid = uuid: "/dev/disk/by-uuid/${uuid}"; + + esp = uuid "1DB7-2844"; + main = uuid "13f97ece-823e-4785-b06e-6c284105d379"; + backup = uuid "dabfc36b-20d1-4b09-8f55-4f9df7499741"; + hydrus = uuid "2a025f29-4058-4a76-8f38-483f0925375d"; + + commonOptions = [ "autodefrag" "noatime" "ssd" ]; +in +{ + fileSystems = { + "/" = { + device = "none"; + fsType = "tmpfs"; + options = [ "defaults" "size=28G" "mode=755" ]; + }; + + "/media/main" = { + device = main; + fsType = "btrfs"; + options = commonOptions; + }; + + "/media/backup" = { + device = backup; + fsType = "btrfs"; + options = commonOptions; + }; + + "/persist" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=root" ] ++ commonOptions; + neededForBoot = true; + }; + + "/persist/srv" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=root/srv" ] ++ commonOptions; + neededForBoot = true; + }; + + "/etc/ssh" = { + device = main; + fsType = "btrfs"; + options = [ "subvolid=262" ] ++ commonOptions; + neededForBoot = true; + }; + + "/nix" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=nix" ] ++ commonOptions; + neededForBoot = true; + }; + + "/boot" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=boot" ] ++ commonOptions; + neededForBoot = true; + }; + + "/boot/efi" = { + device = esp; + fsType = "vfat"; + neededForBoot = true; + }; + + "/home/infinidoge/Hydrus" = { + device = hydrus; + fsType = "btrfs"; + options = [ "subvol=Hydrus" ] ++ commonOptions; + }; + }; + + swapDevices = [ + { device = uuid "37916097-dbb9-4a74-b761-17043629642a"; } + ]; +} diff --git a/hosts/Infini-DESKTOP/hardware-configuration.nix b/hosts/Infini-DESKTOP/hardware-configuration.nix index 149511b..3ed546a 100644 --- a/hosts/Infini-DESKTOP/hardware-configuration.nix +++ b/hosts/Infini-DESKTOP/hardware-configuration.nix @@ -1,95 +1,11 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ config, lib, pkgs, ... }: -let - uuid = uuid: "/dev/disk/by-uuid/${uuid}"; -in { - imports = [ ]; - boot.initrd.availableKernelModules = [ "nvme" "ahci" "xhci_pci" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems = - let - main = uuid "13f97ece-823e-4785-b06e-6c284105d379"; - backup = uuid "dabfc36b-20d1-4b09-8f55-4f9df7499741"; - esp = uuid "1DB7-2844"; - - commonOptions = [ "autodefrag" "noatime" "ssd" ]; - in - { - "/" = { - device = "none"; - fsType = "tmpfs"; - options = [ "defaults" "size=28G" "mode=755" ]; - }; - - "/persist" = { - device = main; - fsType = "btrfs"; - options = [ "subvol=root" ] ++ commonOptions; - neededForBoot = true; - }; - - "/persist/srv" = { - device = main; - fsType = "btrfs"; - options = [ "subvol=root/srv" ] ++ commonOptions; - neededForBoot = true; - }; - - "/etc/ssh" = { - device = main; - fsType = "btrfs"; - options = [ "subvolid=262" ] ++ commonOptions; - neededForBoot = true; - }; - - "/media/main" = { - device = main; - fsType = "btrfs"; - options = commonOptions; - }; - - "/media/backup" = { - device = backup; - fsType = "btrfs"; - options = commonOptions; - }; - - "/nix" = { - device = main; - fsType = "btrfs"; - options = [ "subvol=nix" ] ++ commonOptions; - neededForBoot = true; - }; - - "/boot" = { - device = main; - fsType = "btrfs"; - options = [ "subvol=boot" ] ++ commonOptions; - neededForBoot = true; - }; - - "/boot/efi" = { - device = esp; - fsType = "vfat"; - neededForBoot = true; - }; - - "/home/infinidoge/Hydrus" = { - device = uuid "2a025f29-4058-4a76-8f38-483f0925375d"; - fsType = "btrfs"; - options = [ "subvol=Hydrus" ] ++ commonOptions; - }; - }; - - swapDevices = [ - { device = uuid "37916097-dbb9-4a74-b761-17043629642a"; } - ]; - info = { monitors = 3; model = "Custom Desktop"; diff --git a/hosts/Infini-FRAMEWORK/default.nix b/hosts/Infini-FRAMEWORK/default.nix index b66867e..fec579e 100644 --- a/hosts/Infini-FRAMEWORK/default.nix +++ b/hosts/Infini-FRAMEWORK/default.nix @@ -9,6 +9,7 @@ ]) ./hardware-configuration.nix + ./filesystems.nix ]; system.stateVersion = "21.11"; diff --git a/hosts/Infini-FRAMEWORK/filesystems.nix b/hosts/Infini-FRAMEWORK/filesystems.nix new file mode 100644 index 0000000..5ff303a --- /dev/null +++ b/hosts/Infini-FRAMEWORK/filesystems.nix @@ -0,0 +1,60 @@ +{ config, lib, pkgs, ... }: + +let + uuid = uuid: "/dev/disk/by-uuid/${uuid}"; + main = uuid "a44af0ff-5667-465d-b80a-1934d1aab8d9"; + commonOptions = [ "autodefrag" "noatime" "ssd" ]; +in +{ + fileSystems = { + "/" = { + device = "none"; + fsType = "tmpfs"; + options = [ "defaults" "size=8G" "mode=755" ]; + }; + + "/media/main" = { + device = main; + fsType = "btrfs"; + options = commonOptions; + }; + + "/persist" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=root" ] ++ commonOptions; + neededForBoot = true; + }; + + "/etc/ssh" = { + device = main; + fsType = "btrfs"; + options = [ "subvolid=628" ] ++ commonOptions; + neededForBoot = true; + }; + + "/nix" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=nix" ] ++ commonOptions; + neededForBoot = true; + }; + + "/boot" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=boot" ] ++ commonOptions; + neededForBoot = true; + }; + + "/boot/efi" = { + device = uuid "3FC9-0182"; + fsType = "vfat"; + neededForBoot = true; + }; + }; + + swapDevices = [ + { device = uuid "28672ffb-9f1c-462b-b49d-8a14b3dd72b3"; } + ]; +} diff --git a/hosts/Infini-FRAMEWORK/hardware-configuration.nix b/hosts/Infini-FRAMEWORK/hardware-configuration.nix index f34c84f..c068438 100644 --- a/hosts/Infini-FRAMEWORK/hardware-configuration.nix +++ b/hosts/Infini-FRAMEWORK/hardware-configuration.nix @@ -1,73 +1,11 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ config, lib, pkgs, ... }: -let - uuid = uuid: "/dev/disk/by-uuid/${uuid}"; -in { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems = - let - main = uuid "a44af0ff-5667-465d-b80a-1934d1aab8d9"; - commonOptions = [ "autodefrag" "noatime" "ssd" ]; - in - { - "/" = { - device = "none"; - fsType = "tmpfs"; - options = [ "defaults" "size=8G" "mode=755" ]; - }; - - "/persist" = { - device = main; - fsType = "btrfs"; - options = [ "subvol=root" ] ++ commonOptions; - neededForBoot = true; - }; - - "/etc/ssh" = { - device = main; - fsType = "btrfs"; - options = [ "subvolid=628" ] ++ commonOptions; - neededForBoot = true; - }; - - "/media/main" = { - device = main; - fsType = "btrfs"; - options = commonOptions; - }; - - "/nix" = { - device = main; - fsType = "btrfs"; - options = [ "subvol=nix" ] ++ commonOptions; - neededForBoot = true; - }; - - "/boot" = { - device = main; - fsType = "btrfs"; - options = [ "subvol=boot" ] ++ commonOptions; - neededForBoot = true; - }; - - "/boot/efi" = { - device = uuid "3FC9-0182"; - fsType = "vfat"; - neededForBoot = true; - }; - }; - - swapDevices = [{ device = uuid "28672ffb-9f1c-462b-b49d-8a14b3dd72b3"; }]; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; info.model = "Framework Laptop"; diff --git a/hosts/Infini-SERVER/default.nix b/hosts/Infini-SERVER/default.nix index 81d6599..2408536 100644 --- a/hosts/Infini-SERVER/default.nix +++ b/hosts/Infini-SERVER/default.nix @@ -5,6 +5,7 @@ private.nixosModules.minecraft-servers private.nixosModules.nitter ./hardware-configuration.nix + ./filesystems.nix ]; system.stateVersion = "22.05"; diff --git a/hosts/Infini-SERVER/filesystems.nix b/hosts/Infini-SERVER/filesystems.nix new file mode 100644 index 0000000..e47d012 --- /dev/null +++ b/hosts/Infini-SERVER/filesystems.nix @@ -0,0 +1,80 @@ +{ config, lib, pkgs, ... }: + +let + uuid = uuid: "/dev/disk/by-uuid/${uuid}"; + + main = uuid "5f24b2a6-643d-4abd-a3b2-61ee124700b5"; + esp = uuid "A2B8-4C6E"; + data = uuid "59abb0ff-fe4e-4061-87d2-b728b937656a"; + + commonOptions = [ "autodefrag" "noatime" "ssd" ]; +in +{ + + fileSystems = { + "/" = { + device = "tmpfs"; + fsType = "tmpfs"; + options = [ "defaults" "size=4G" "mode=755" ]; + }; + + "/media/main" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=/" ] ++ commonOptions; + neededForBoot = true; + }; + + "/media/data" = lib.mkIf (data != null) { + device = data; + fsType = "btrfs"; + options = [ "subvol=/" ] ++ commonOptions; + neededForBoot = true; + }; + + "/persist" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=root" ] ++ commonOptions; + neededForBoot = true; + }; + + "/etc/ssh" = { + device = main; + fsType = "btrfs"; + options = [ "subvolid=264" ] ++ commonOptions; + neededForBoot = true; + }; + + "/persist/srv" = lib.mkIf (data != null) { + device = data; + fsType = "btrfs"; + options = [ "subvol=root/srv" ] ++ commonOptions; + neededForBoot = true; + }; + + "/nix" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=nix" ] ++ commonOptions; + neededForBoot = true; + }; + + "/boot" = { + device = main; + fsType = "btrfs"; + options = [ "subvol=boot" ] ++ commonOptions; + neededForBoot = true; + }; + + "/boot/efi" = { + device = esp; + fsType = "vfat"; + neededForBoot = true; + }; + }; + + swapDevices = [ + { device = uuid "b064d69c-0310-4a94-a0de-a4b358f54f9e"; } + ]; +} diff --git a/hosts/Infini-SERVER/hardware-configuration.nix b/hosts/Infini-SERVER/hardware-configuration.nix index 3061dc5..d017e16 100644 --- a/hosts/Infini-SERVER/hardware-configuration.nix +++ b/hosts/Infini-SERVER/hardware-configuration.nix @@ -1,94 +1,10 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ config, lib, pkgs, ... }: -let - uuid = uuid: "/dev/disk/by-uuid/${uuid}"; -in { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - boot.initrd.availableKernelModules = [ "nvme" "usb_storage" "xhci_pci" "ahci" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" "kvm-intel" ]; boot.extraModulePackages = [ ]; - boot.kernelParams = [ "boot.shell_on_fail" ]; - boot.supportedFilesystems = [ "btrfs" ]; - - fileSystems = - let - main = uuid "5f24b2a6-643d-4abd-a3b2-61ee124700b5"; - esp = uuid "A2B8-4C6E"; - data = uuid "59abb0ff-fe4e-4061-87d2-b728b937656a"; - - commonOptions = [ "autodefrag" "noatime" "ssd" ]; - in - { - "/" = { - device = "tmpfs"; - fsType = "tmpfs"; - options = [ "defaults" "size=4G" "mode=755" ]; - }; - - "/media/main" = { - device = main; - fsType = "btrfs"; - options = [ "subvol=/" ] ++ commonOptions; - neededForBoot = true; - }; - - "/media/data" = lib.mkIf (data != null) { - device = data; - fsType = "btrfs"; - options = [ "subvol=/" ] ++ commonOptions; - neededForBoot = true; - }; - - "/persist" = { - device = main; - fsType = "btrfs"; - options = [ "subvol=root" ] ++ commonOptions; - neededForBoot = true; - }; - - "/etc/ssh" = { - device = main; - fsType = "btrfs"; - options = [ "subvolid=264" ] ++ commonOptions; - neededForBoot = true; - }; - - "/persist/srv" = lib.mkIf (data != null) { - device = data; - fsType = "btrfs"; - options = [ "subvol=root/srv" ] ++ commonOptions; - neededForBoot = true; - }; - - "/nix" = { - device = main; - fsType = "btrfs"; - options = [ "subvol=nix" ] ++ commonOptions; - neededForBoot = true; - }; - - "/boot" = { - device = main; - fsType = "btrfs"; - options = [ "subvol=boot" ] ++ commonOptions; - neededForBoot = true; - }; - - "/boot/efi" = { - device = esp; - fsType = "vfat"; - neededForBoot = true; - }; - }; - - swapDevices = [ - { device = uuid "b064d69c-0310-4a94-a0de-a4b358f54f9e"; } - ]; powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; }