From 722004beea7ac07f9a5d2eddc001037df9046911 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 22 Sep 2026 21:10:27 +0200 Subject: ... --- hosts/skadhi/default.nix | 17 +--------- hosts/skadhi/fs.nix | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ hosts/skadhi/hw.nix | 59 ---------------------------------- 3 files changed, 83 insertions(+), 75 deletions(-) create mode 100644 hosts/skadhi/fs.nix (limited to 'hosts/skadhi') diff --git a/hosts/skadhi/default.nix b/hosts/skadhi/default.nix index 62823488..847f9e8f 100644 --- a/hosts/skadhi/default.nix +++ b/hosts/skadhi/default.nix @@ -1,7 +1,7 @@ { flake, flakeInputs, pkgs, config, lib, ... }: { imports = with flake.nixosModules.systemProfiles; [ - ./hw.nix + ./hw.nix ./fs.nix tmpfs-root default-locale openssh niri-unstable networkmanager lanzaboote zswap flakeInputs.nixVirt.nixosModules.default ]; @@ -9,21 +9,6 @@ config = { system.stateVersion = "26.05"; - fileSystems."/persistent".neededForBoot = true; - environment.persistence."/persistent" = { - hideMounts = true; - directories = [ - "/nix" - "/root" - "/var/log" - "/var/lib/nixos" - "/var/lib/sops-nix" - "/var/lib/systemd" - config.boot.lanzaboote.pkiBundle - ]; - timezone = true; - }; - boot = { initrd = { systemd = { diff --git a/hosts/skadhi/fs.nix b/hosts/skadhi/fs.nix new file mode 100644 index 00000000..cbeef6f9 --- /dev/null +++ b/hosts/skadhi/fs.nix @@ -0,0 +1,82 @@ +{ flake, flakeInputs, pkgs, config, lib, ... }: +{ + imports = with flake.nixosModules.systemProfiles; [ + disko + ]; + + config = { + fileSystems."/persistent".neededForBoot = true; + environment.persistence."/persistent" = { + hideMounts = true; + directories = [ + "/nix" + "/root" + "/var/log" + "/var/lib/nixos" + "/var/lib/sops-nix" + "/var/lib/systemd" + config.boot.lanzaboote.pkiBundle + ]; + timezone = true; + }; + + disko.devices = { + disk.nvm = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "fmask=0033" "dmask=0022" + ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "nvm"; + extraFormatArgs = [ + "--cipher" "aegis128-random" + "--key-size" "128" + "--integrity" "aead" + ]; + content = { + type = "btrfs"; + extraArgs = let + subvols = ["/persistent"] ++ map (p: "/persistent/${p}") ["/nix" "/var/log"]; + restricted = map (p: "/persistent/${p}") ["/root"]; + in [ + "--csum" "blake2" + "--compress" "zstd:15" + "--rootdir" (toString (pkgs.runCommand "rootdir" { + } '' + mkdir $out + install -d ${lib.concatMapStringsSep " " (p: "$out/${p}") subvols} + install -m 0700 -d ${lib.concatMapStringsSep " " (p: "$out/${p}") restricted} + '')) + ] ++ lib.concatMap (p: ["--subvol" p]) subvols; + subvolumes = { + "/persistent".mountpoint = "/persistent"; + "/swap" = { + mountpoint = "/.swap"; + swap.swapfile.size = "96G"; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/skadhi/hw.nix b/hosts/skadhi/hw.nix index 0eb16b7a..02fb5c0e 100644 --- a/hosts/skadhi/hw.nix +++ b/hosts/skadhi/hw.nix @@ -16,64 +16,5 @@ ''; nixpkgs.system = "x86_64-linux"; - - disko.devices = { - disk.nvm = { - type = "disk"; - device = "/dev/nvme0n1"; - content = { - type = "gpt"; - partitions = { - ESP = { - size = "512M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ - "fmask=0033" "dmask=0022" - ]; - }; - }; - luks = { - size = "100%"; - content = { - type = "luks"; - name = "nvm"; - extraFormatArgs = [ - "--cipher" "aegis128-random" - "--key-size" "128" - "--integrity" "aead" - ]; - content = { - type = "btrfs"; - extraArgs = let - subvols = ["/persistent"] ++ map (p: "/persistent/${p}") ["/nix" "/var/log"]; - restricted = map (p: "/persistent/${p}") ["/root"]; - in [ - "--csum" "blake2" - "--compress" "zstd:15" - "--rootdir" (toString (pkgs.runCommand "rootdir" { - } '' - mkdir $out - install -d ${lib.concatMapStringsSep " " (p: "$out/${p}") subvols} - install -m 0700 -d ${lib.concatMapStringsSep " " (p: "$out/${p}") restricted} - '')) - ] ++ lib.concatMap (p: ["--subvol" p]) subvols; - subvolumes = { - "/persistent".mountpoint = "/persistent"; - "/swap" = { - mountpoint = "/.swap"; - swap.swapfile.size = "96G"; - }; - }; - }; - }; - }; - }; - }; - }; - }; }; } -- cgit v1.2.3