From 8328e393ce834ecb6038698d6649427ea1be4a0f Mon Sep 17 00:00:00 2001 From: Mark Nipper Date: Tue, 12 Nov 2024 10:04:38 -0800 Subject: Modularize disko everywhere --- flake.nix | 5 ++ hosts/arrakis/default.nix | 1 + hosts/arrakis/disks.nix | 4 +- hosts/arrakis/hardware-configuration.nix | 37 ------------ hosts/darkstar/default.nix | 1 + hosts/darkstar/disks.nix | 4 +- hosts/darkstar/hardware-configuration.nix | 46 --------------- hosts/ginaz/default.nix | 1 + hosts/ginaz/disks.nix | 96 +++++++++++++++++++++++++++++++ hosts/ginaz/hardware-configuration.nix | 67 ++++++--------------- hosts/jupiter/disks.nix | 2 +- hosts/kaitain/default.nix | 1 + hosts/kaitain/disks.nix | 2 +- hosts/kaitain/hardware-configuration.nix | 29 ---------- hosts/neptune/disks.nix | 2 +- hosts/richese/default.nix | 1 + hosts/richese/disks.nix | 2 +- hosts/richese/hardware-configuration.nix | 29 ---------- hosts/saturn/disks.nix | 2 +- hosts/uranus/disks.nix | 2 +- 20 files changed, 135 insertions(+), 199 deletions(-) create mode 100644 hosts/ginaz/disks.nix diff --git a/flake.nix b/flake.nix index bebe62e..f87cd07 100644 --- a/flake.nix +++ b/flake.nix @@ -55,6 +55,7 @@ arrakis = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs outputs; }; modules = [ + disko.nixosModules.disko ./hosts/arrakis home-manager.nixosModules.home-manager { home-manager.sharedModules = [ sops-nix.homeManagerModules.sops ]; @@ -68,6 +69,7 @@ darkstar = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs outputs; }; modules = [ + disko.nixosModules.disko ./hosts/darkstar home-manager.nixosModules.home-manager { home-manager.users.root = import ./home/root/darkstar.nix; @@ -80,6 +82,7 @@ ginaz = nixpkgs.lib.nixosSystem rec { specialArgs = { inherit inputs outputs; }; modules = [ + disko.nixosModules.disko ./hosts/ginaz home-manager.nixosModules.home-manager { home-manager.sharedModules = [ sops-nix.homeManagerModules.sops ]; @@ -110,6 +113,7 @@ kaitain = nixpkgs.lib.nixosSystem rec { specialArgs = { inherit inputs outputs; }; modules = [ + disko.nixosModules.disko ./hosts/kaitain home-manager.nixosModules.home-manager { home-manager.users.root = import ./home/root/kaitain.nix; @@ -164,6 +168,7 @@ richese = nixpkgs.lib.nixosSystem rec { specialArgs = { inherit inputs outputs; }; modules = [ + disko.nixosModules.disko ./hosts/richese home-manager.nixosModules.home-manager { home-manager.users.root = import ./home/root/richese.nix; diff --git a/hosts/arrakis/default.nix b/hosts/arrakis/default.nix index e3162f5..a66ad3b 100644 --- a/hosts/arrakis/default.nix +++ b/hosts/arrakis/default.nix @@ -107,6 +107,7 @@ ]; imports = [ + ./disks.nix ./hardware-configuration.nix ./services.nix ../common/core diff --git a/hosts/arrakis/disks.nix b/hosts/arrakis/disks.nix index 8680eb3..ca2de37 100644 --- a/hosts/arrakis/disks.nix +++ b/hosts/arrakis/disks.nix @@ -14,7 +14,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/efiboot/efi1"; - mountOptions = [ "defaults" ]; + mountOptions = [ "X-mount.mkdir" "umask=0077" ]; extraArgs = [ "-nESP1" ]; }; }; @@ -49,7 +49,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/efiboot/efi2"; - mountOptions = [ "defaults" ]; + mountOptions = [ "X-mount.mkdir" "umask=0077" ]; extraArgs = [ "-nESP2" ]; }; }; diff --git a/hosts/arrakis/hardware-configuration.nix b/hosts/arrakis/hardware-configuration.nix index 5a4c958..6e96a93 100644 --- a/hosts/arrakis/hardware-configuration.nix +++ b/hosts/arrakis/hardware-configuration.nix @@ -21,38 +21,6 @@ MOZ_DISABLE_RDD_SANDBOX = "1"; }; - fileSystems."/" = { - device = "rpool/local/root"; - fsType = "zfs"; - }; - - fileSystems."/efiboot/efi1" = { - device = "/dev/disk/by-label/ESP1"; - fsType = "vfat"; - options = [ "X-mount.mkdir" "iocharset=iso8859-1" ]; - }; - - fileSystems."/efiboot/efi2" = { - device = "/dev/disk/by-label/ESP2"; - fsType = "vfat"; - options = [ "X-mount.mkdir" "iocharset=iso8859-1" ]; - }; - - fileSystems."/nix" = { - device = "rpool/local/nix"; - fsType = "zfs"; - }; - - fileSystems."/root" = { - device = "rpool/user/home/root"; - fsType = "zfs"; - }; - - fileSystems."/home/nipsy" = { - device = "rpool/user/home/nipsy"; - fsType = "zfs"; - }; - fileSystems."/srv/nfs/keepers" = { device = "/data/home/nipsy/downloads/keepers"; options = [ @@ -83,11 +51,6 @@ ]; }; - swapDevices = [ - { device = "/dev/disk/by-label/swap1"; } - { device = "/dev/disk/by-label/swap2"; } - ]; - hardware = { bluetooth.enable = true; graphics = { diff --git a/hosts/darkstar/default.nix b/hosts/darkstar/default.nix index ac07076..6af2c54 100644 --- a/hosts/darkstar/default.nix +++ b/hosts/darkstar/default.nix @@ -27,6 +27,7 @@ #]; imports = [ + ./disks.nix ./hardware-configuration.nix ./services.nix ../common/core diff --git a/hosts/darkstar/disks.nix b/hosts/darkstar/disks.nix index 7f1df4f..6bb21c9 100644 --- a/hosts/darkstar/disks.nix +++ b/hosts/darkstar/disks.nix @@ -14,7 +14,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/efiboot/efi1"; - mountOptions = [ "defaults" ]; + mountOptions = [ "X-mount.mkdir" "umask=0077" ]; extraArgs = [ "-nESP1" ]; }; }; @@ -49,7 +49,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/efiboot/efi2"; - mountOptions = [ "defaults" ]; + mountOptions = [ "X-mount.mkdir" "umask=0077" ]; extraArgs = [ "-nESP2" ]; }; }; diff --git a/hosts/darkstar/hardware-configuration.nix b/hosts/darkstar/hardware-configuration.nix index 49cc244..d4a76e7 100644 --- a/hosts/darkstar/hardware-configuration.nix +++ b/hosts/darkstar/hardware-configuration.nix @@ -13,51 +13,5 @@ boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "rpool/local/root"; - fsType = "zfs"; - }; - - fileSystems."/efiboot/efi1" = - { device = "/dev/disk/by-label/ESP1"; - fsType = "vfat"; - options = [ "X-mount.mkdir" "iocharset=iso8859-1" ]; - }; - - fileSystems."/efiboot/efi2" = - { device = "/dev/disk/by-label/ESP2"; - fsType = "vfat"; - options = [ "X-mount.mkdir" "iocharset=iso8859-1" ]; - }; - - fileSystems."/nix" = - { device = "rpool/local/nix"; - fsType = "zfs"; - }; - - fileSystems."/root" = - { device = "rpool/user/home/root"; - fsType = "zfs"; - }; - - fileSystems."/home/nipsy" = - { device = "rpool/user/home/nipsy"; - fsType = "zfs"; - }; - - swapDevices = - [ { device = "/dev/disk/by-label/swap1"; } - { device = "/dev/disk/by-label/swap2"; } - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp116s0.useDHCP = lib.mkDefault true; - # networking.interfaces.enp117s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/ginaz/default.nix b/hosts/ginaz/default.nix index 6ef3bef..58703b8 100644 --- a/hosts/ginaz/default.nix +++ b/hosts/ginaz/default.nix @@ -16,6 +16,7 @@ ]; imports = [ + ./disks.nix ./hardware-configuration.nix ../common/core ../common/optional/db.nix diff --git a/hosts/ginaz/disks.nix b/hosts/ginaz/disks.nix new file mode 100644 index 0000000..5093fe8 --- /dev/null +++ b/hosts/ginaz/disks.nix @@ -0,0 +1,96 @@ +{ + disko.devices = { + disk = { + nvme0n1 = { + type = "disk"; + device = "/dev/disk/by-id/nvme-SAMSUNG_MZVL21T0HCLR-00BL2_S64NNX0T233166"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + extraArgs = [ "-nboot" ]; + }; + }; + swap = { + size = "32G"; + type = "8200"; + content = { + type = "swap"; + extraArgs = [ "-L swap" ]; + }; + }; + rpool = { + size = "100%"; + content = { + type = "zfs"; + pool = "rpool"; + }; + }; + }; + }; + }; + }; + zpool = { + rpool = { + type = "zpool"; + rootFsOptions = { + acltype = "posixacl"; + canmount = "off"; + compression = "on"; + dnodesize = "auto"; + relatime = "on"; + xattr = "sa"; + }; + options = { + ashift = "12"; + autotrim = "on"; + }; + datasets = { + "local" = { + type = "zfs_fs"; + options.mountpoint = "none"; + }; + "local/root" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/"; + }; + "local/nix" = { + type = "zfs_fs"; + options = { + atime = "off"; + mountpoint = "legacy"; + }; + mountpoint = "/nix"; + }; + "user" = { + type = "zfs_fs"; + options.mountpoint = "none"; + }; + "user/home" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/home"; + }; + "user/home/root" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/root"; + }; + "user/home/nipsy" = { + type = "zfs_fs"; + options.mountpoint = "legacy"; + mountpoint = "/home/nipsy"; + }; + }; + }; + }; + }; +} diff --git a/hosts/ginaz/hardware-configuration.nix b/hosts/ginaz/hardware-configuration.nix index 6a773e6..cbfda8a 100644 --- a/hosts/ginaz/hardware-configuration.nix +++ b/hosts/ginaz/hardware-configuration.nix @@ -13,57 +13,28 @@ boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "rpool/local/root"; - fsType = "zfs"; + hardware = { + bluetooth.enable = true; + #bluetooth.powerOnBoot = true; + + graphics = { + enable = true; + extraPackages = with pkgs; [ nvidia-vaapi-driver ]; + extraPackages32 = with pkgs.pkgsi686Linux; [ nvidia-vaapi-driver ]; }; - fileSystems."/boot" = - { device = "/dev/disk/by-label/boot"; - fsType = "vfat"; - }; - - fileSystems."/nix" = - { device = "rpool/local/nix"; - fsType = "zfs"; - }; - - fileSystems."/root" = - { device = "rpool/user/home/root"; - fsType = "zfs"; - }; - - fileSystems."/home/nipsy" = - { device = "rpool/user/home/nipsy"; - fsType = "zfs"; - }; - - swapDevices = - [ { device = "/dev/disk/by-label/swap"; } - ]; - - hardware = { - bluetooth.enable = true; - #bluetooth.powerOnBoot = true; - - graphics = { - enable = true; - extraPackages = with pkgs; [ nvidia-vaapi-driver ]; - extraPackages32 = with pkgs.pkgsi686Linux; [ nvidia-vaapi-driver ]; - }; - - nvidia = { - modesetting.enable = true; - open = true; - package = config.boot.kernelPackages.nvidiaPackages.beta; - prime = { - amdgpuBusId = "PCI:4:0:0"; - nvidiaBusId = "PCI:1:0:0"; - offload = { - enable = true; - enableOffloadCmd = true; - }; + nvidia = { + modesetting.enable = true; + open = true; + package = config.boot.kernelPackages.nvidiaPackages.beta; + prime = { + amdgpuBusId = "PCI:4:0:0"; + nvidiaBusId = "PCI:1:0:0"; + offload = { + enable = true; + enableOffloadCmd = true; }; }; }; + }; } diff --git a/hosts/jupiter/disks.nix b/hosts/jupiter/disks.nix index 52e8926..a3d6d72 100644 --- a/hosts/jupiter/disks.nix +++ b/hosts/jupiter/disks.nix @@ -14,7 +14,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = [ "defaults" ]; + mountOptions = [ "umask=0077" ]; extraArgs = [ "-nboot" ]; }; }; diff --git a/hosts/kaitain/default.nix b/hosts/kaitain/default.nix index bd1581c..defaa13 100644 --- a/hosts/kaitain/default.nix +++ b/hosts/kaitain/default.nix @@ -16,6 +16,7 @@ ]; imports = [ + ./disks.nix ./hardware-configuration.nix ../common/core #../common/optional/db.nix diff --git a/hosts/kaitain/disks.nix b/hosts/kaitain/disks.nix index 98a6f86..a626a80 100644 --- a/hosts/kaitain/disks.nix +++ b/hosts/kaitain/disks.nix @@ -14,7 +14,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = [ "defaults" ]; + mountOptions = [ "umask=0077" ]; extraArgs = [ "-nboot" ]; }; }; diff --git a/hosts/kaitain/hardware-configuration.nix b/hosts/kaitain/hardware-configuration.nix index 0ca1a06..f38c16a 100644 --- a/hosts/kaitain/hardware-configuration.nix +++ b/hosts/kaitain/hardware-configuration.nix @@ -12,33 +12,4 @@ boot.initrd.kernelModules = [ ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "rpool/local/root"; - fsType = "zfs"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-label/boot"; - fsType = "vfat"; - }; - - fileSystems."/nix" = - { device = "rpool/local/nix"; - fsType = "zfs"; - }; - - fileSystems."/root" = - { device = "rpool/user/home/root"; - fsType = "zfs"; - }; - - fileSystems."/home/nipsy" = - { device = "rpool/user/home/nipsy"; - fsType = "zfs"; - }; - - swapDevices = - [ { device = "/dev/disk/by-label/swap"; } - ]; } diff --git a/hosts/neptune/disks.nix b/hosts/neptune/disks.nix index 52e8926..a3d6d72 100644 --- a/hosts/neptune/disks.nix +++ b/hosts/neptune/disks.nix @@ -14,7 +14,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = [ "defaults" ]; + mountOptions = [ "umask=0077" ]; extraArgs = [ "-nboot" ]; }; }; diff --git a/hosts/richese/default.nix b/hosts/richese/default.nix index 5cf92c2..a57e142 100644 --- a/hosts/richese/default.nix +++ b/hosts/richese/default.nix @@ -13,6 +13,7 @@ ]; imports = [ + ./disks.nix ./hardware-configuration.nix ../common/core #../common/optional/db.nix diff --git a/hosts/richese/disks.nix b/hosts/richese/disks.nix index 742fac6..576152f 100644 --- a/hosts/richese/disks.nix +++ b/hosts/richese/disks.nix @@ -18,7 +18,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = [ "defaults" ]; + mountOptions = [ "umask=0077" ]; extraArgs = [ "-nboot" ]; }; }; diff --git a/hosts/richese/hardware-configuration.nix b/hosts/richese/hardware-configuration.nix index e4e04cf..d1c33b7 100644 --- a/hosts/richese/hardware-configuration.nix +++ b/hosts/richese/hardware-configuration.nix @@ -12,33 +12,4 @@ boot.initrd.kernelModules = [ ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "rpool/local/root"; - fsType = "zfs"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-label/boot"; - fsType = "vfat"; - }; - - fileSystems."/nix" = - { device = "rpool/local/nix"; - fsType = "zfs"; - }; - - fileSystems."/root" = - { device = "rpool/user/home/root"; - fsType = "zfs"; - }; - - fileSystems."/home/nipsy" = - { device = "rpool/user/home/nipsy"; - fsType = "zfs"; - }; - - swapDevices = - [ { device = "/dev/disk/by-label/swap"; } - ]; } diff --git a/hosts/saturn/disks.nix b/hosts/saturn/disks.nix index 52e8926..a3d6d72 100644 --- a/hosts/saturn/disks.nix +++ b/hosts/saturn/disks.nix @@ -14,7 +14,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = [ "defaults" ]; + mountOptions = [ "umask=0077" ]; extraArgs = [ "-nboot" ]; }; }; diff --git a/hosts/uranus/disks.nix b/hosts/uranus/disks.nix index 52e8926..a3d6d72 100644 --- a/hosts/uranus/disks.nix +++ b/hosts/uranus/disks.nix @@ -14,7 +14,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = [ "defaults" ]; + mountOptions = [ "umask=0077" ]; extraArgs = [ "-nboot" ]; }; }; -- cgit v1.2.3