From 176141410a00dc8ef4376ea9d67b87a0b96ec68c Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 18 Oct 2025 10:39:01 -0700 Subject: move the disk configuration for rivendell as a profile --- flake/hosts.nix | 1 + machines/nixos/x86_64-linux/rivendell/default.nix | 2 +- machines/nixos/x86_64-linux/rivendell/disks.nix | 67 -------------------- profiles/disk/btrfs-on-luks.nix | 74 +++++++++++++++++++++++ 4 files changed, 76 insertions(+), 68 deletions(-) delete mode 100644 machines/nixos/x86_64-linux/rivendell/disks.nix create mode 100644 profiles/disk/btrfs-on-luks.nix diff --git a/flake/hosts.nix b/flake/hosts.nix index db1b686..ef2b28b 100644 --- a/flake/hosts.nix +++ b/flake/hosts.nix @@ -155,6 +155,7 @@ let { home-manager.users.${adminUser.name}.imports = [ "${self}/home/programs/bat.nix" + { home.stateVersion = "25.05"; } ]; } ] diff --git a/machines/nixos/x86_64-linux/rivendell/default.nix b/machines/nixos/x86_64-linux/rivendell/default.nix index 787f090..700a57f 100644 --- a/machines/nixos/x86_64-linux/rivendell/default.nix +++ b/machines/nixos/x86_64-linux/rivendell/default.nix @@ -9,7 +9,7 @@ imports = [ (modulesPath + "/installer/scan/not-detected.nix") inputs.nixos-hardware.nixosModules.framework-desktop-amd-ai-max-300-series - ./disks.nix + ../../../../profiles/disk/btrfs-on-luks.nix ]; boot.initrd.availableKernelModules = [ diff --git a/machines/nixos/x86_64-linux/rivendell/disks.nix b/machines/nixos/x86_64-linux/rivendell/disks.nix deleted file mode 100644 index 8cb1f32..0000000 --- a/machines/nixos/x86_64-linux/rivendell/disks.nix +++ /dev/null @@ -1,67 +0,0 @@ -let - btrfsopt = [ - "compress=zstd" - "noatime" - ]; -in -{ - disko.devices = { - disk = { - main = { - type = "disk"; - device = "/dev/nvme0n1"; - content = { - type = "gpt"; - partitions = { - ESP = { - size = "2G"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ - "fmask=0022" - "dmask=0022" - ]; - }; - }; - luks = { - size = "100%"; - content = { - type = "luks"; - name = "nixos"; - passwordFile = "/tmp/pass"; - settings = { - allowDiscards = true; - }; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; - subvolumes = { - "@root" = { - mountpoint = "/"; - mountOptions = btrfsopt; - }; - "@home" = { - mountpoint = "/home"; - mountOptions = btrfsopt; - }; - "@nix" = { - mountpoint = "/nix"; - mountOptions = btrfsopt; - }; - "@data" = { - mountpoint = "/data"; - mountOptions = btrfsopt; - }; - }; - }; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/profiles/disk/btrfs-on-luks.nix b/profiles/disk/btrfs-on-luks.nix new file mode 100644 index 0000000..3fe57f7 --- /dev/null +++ b/profiles/disk/btrfs-on-luks.nix @@ -0,0 +1,74 @@ +{ ... }: +let + btrfsopt = [ + "compress=zstd" + "noatime" + ]; +in +{ + services.btrfs.autoScrub.enable = true; + services.btrfs.autoScrub.fileSystems = [ + "/nix" + "/data" + ]; + + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "2G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "fmask=0022" + "dmask=0022" + ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "nixos"; + passwordFile = "/tmp/pass"; + settings = { + allowDiscards = true; + }; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "@root" = { + mountpoint = "/"; + mountOptions = btrfsopt; + }; + "@home" = { + mountpoint = "/home"; + mountOptions = btrfsopt; + }; + "@nix" = { + mountpoint = "/nix"; + mountOptions = btrfsopt; + }; + "@data" = { + mountpoint = "/data"; + mountOptions = btrfsopt; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} -- cgit v1.2.3