summaryrefslogtreecommitdiff
path: root/hosts/skadhi/fs.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2026-09-22 21:10:27 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2026-09-22 21:10:27 +0200
commit722004beea7ac07f9a5d2eddc001037df9046911 (patch)
tree8b71df309f695090ebd4f1de17f19c0f2bd32663 /hosts/skadhi/fs.nix
parent06fe427967cb3076ca992566da9615f34523549d (diff)
downloadnixos-722004beea7ac07f9a5d2eddc001037df9046911.tar
nixos-722004beea7ac07f9a5d2eddc001037df9046911.tar.gz
nixos-722004beea7ac07f9a5d2eddc001037df9046911.tar.bz2
nixos-722004beea7ac07f9a5d2eddc001037df9046911.tar.xz
nixos-722004beea7ac07f9a5d2eddc001037df9046911.zip
...
Diffstat (limited to 'hosts/skadhi/fs.nix')
-rw-r--r--hosts/skadhi/fs.nix82
1 files changed, 82 insertions, 0 deletions
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 @@
1{ flake, flakeInputs, pkgs, config, lib, ... }:
2{
3 imports = with flake.nixosModules.systemProfiles; [
4 disko
5 ];
6
7 config = {
8 fileSystems."/persistent".neededForBoot = true;
9 environment.persistence."/persistent" = {
10 hideMounts = true;
11 directories = [
12 "/nix"
13 "/root"
14 "/var/log"
15 "/var/lib/nixos"
16 "/var/lib/sops-nix"
17 "/var/lib/systemd"
18 config.boot.lanzaboote.pkiBundle
19 ];
20 timezone = true;
21 };
22
23 disko.devices = {
24 disk.nvm = {
25 type = "disk";
26 device = "/dev/nvme0n1";
27 content = {
28 type = "gpt";
29 partitions = {
30 ESP = {
31 size = "512M";
32 type = "EF00";
33 content = {
34 type = "filesystem";
35 format = "vfat";
36 mountpoint = "/boot";
37 mountOptions = [
38 "fmask=0033" "dmask=0022"
39 ];
40 };
41 };
42 luks = {
43 size = "100%";
44 content = {
45 type = "luks";
46 name = "nvm";
47 extraFormatArgs = [
48 "--cipher" "aegis128-random"
49 "--key-size" "128"
50 "--integrity" "aead"
51 ];
52 content = {
53 type = "btrfs";
54 extraArgs = let
55 subvols = ["/persistent"] ++ map (p: "/persistent/${p}") ["/nix" "/var/log"];
56 restricted = map (p: "/persistent/${p}") ["/root"];
57 in [
58 "--csum" "blake2"
59 "--compress" "zstd:15"
60 "--rootdir" (toString (pkgs.runCommand "rootdir" {
61 } ''
62 mkdir $out
63 install -d ${lib.concatMapStringsSep " " (p: "$out/${p}") subvols}
64 install -m 0700 -d ${lib.concatMapStringsSep " " (p: "$out/${p}") restricted}
65 ''))
66 ] ++ lib.concatMap (p: ["--subvol" p]) subvols;
67 subvolumes = {
68 "/persistent".mountpoint = "/persistent";
69 "/swap" = {
70 mountpoint = "/.swap";
71 swap.swapfile.size = "96G";
72 };
73 };
74 };
75 };
76 };
77 };
78 };
79 };
80 };
81 };
82}