about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorene <ene@sils.li>2023-02-16 18:24:34 +0100
committerene <ene@sils.li>2023-02-16 18:24:34 +0100
commit668c0dbf25b8f31385e38b3699bbdd9226da01fe (patch)
tree0ee70d2df509d03d6f2cfcf28475cd0f002f912e
parentFeat: Add impersistent for persistent files and dirs (diff)
downloadnixos-config-668c0dbf25b8f31385e38b3699bbdd9226da01fe.tar.gz
nixos-config-668c0dbf25b8f31385e38b3699bbdd9226da01fe.zip
Feat(impermanence): Add full stack tempfs
Diffstat (limited to '')
-rw-r--r--system/fileSystemLayouts/default.nix25
-rw-r--r--system/impermanence/default.nix67
2 files changed, 49 insertions, 43 deletions
diff --git a/system/fileSystemLayouts/default.nix b/system/fileSystemLayouts/default.nix
index d861d888..a3ba353b 100644
--- a/system/fileSystemLayouts/default.nix
+++ b/system/fileSystemLayouts/default.nix
@@ -5,6 +5,10 @@
 }:
 with lib; let
   cfg = config.system.fileSystemLayouts;
+  defaultMountOptions = [
+    "compress-force=zstd:15" # This saves disk space, at a performance cost
+    "noatime" # should have some performance upsides, and I don't use it anyways
+  ];
 in {
   options.system.fileSystemLayouts = {
     enable = mkEnableOption (mdDoc "fileSystemLayout");
@@ -30,30 +34,25 @@ in {
       "/nix" = {
         device = cfg.mainDisk;
         fsType = "btrfs";
-        options = ["subvol=nix" "compress-force=zstd:15"];
+        options = ["subvol=nix"] ++ defaultMountOptions;
       };
       "/srv" = {
         device = cfg.mainDisk;
         fsType = "btrfs";
         neededForBoot = true;
-        options = ["subvol=storage" "compress-force=zstd:15"];
+        options = ["subvol=storage"] ++ defaultMountOptions;
       };
       "/boot" = {
         device = cfg.efiDisk;
         fsType = "vfat";
       };
 
-      "/etc/nixos" = {
-        device = "/srv/nix-config";
-        options = ["bind"];
-      };
-
-# This results in infinite recursion, don't ask my why
-#      "${config.users.users.soispha.home}/.config" = {
-#        device = "none";
-#        fsType = "tmpfs";
-#        options = ["defaults" "size=1G" "mode=755"];
-#      };
+      # This results in infinite recursion, don't ask my why
+      #      "${config.users.users.soispha.home}/.config" = {
+      #        device = "none";
+      #        fsType = "tmpfs";
+      #        options = ["defaults" "size=1G" "mode=755"];
+      #      };
     };
     swapDevices = [];
   };
diff --git a/system/impermanence/default.nix b/system/impermanence/default.nix
index 16ac3c47..dd0fa42e 100644
--- a/system/impermanence/default.nix
+++ b/system/impermanence/default.nix
@@ -7,39 +7,46 @@
     impermanence.nixosModules.impermanence
   ];
 
-  environment.persistence."/srv" = {
-    hideMounts = true;
-    directories = [
-      "/var/log"
-      # TODO this needs to be checked
-      #"/var/lib/bluetooth"
-      #"/var/lib/nixos"
-      #"/var/lib/systemd/coredump"
-      {
-        directory = "/var/lib/colord";
-        user = "colord";
-        group = "colord";
-        mode = "u=rwx,g=rx,o=";
-      }
-    ];
-    files = [
-      "/etc/machine-id"
-      {
-        file = "/etc/nix/id_rsa";
-        parentDirectory = {mode = "u=rwx,g=,o=";};
-      }
-    ];
-    users.soispha = {
-      home = "/srv/home/soispha"; # TODO link this to ${config.users.users.soispha.homeDirectory}
+  environment.persistence = {
+    "/srv" = {
+      hideMounts = true;
       directories = [
-        ".local/share"
-        ".cache"
+        "/var/log"
+        # TODO this needs to be checked
+        #"/var/lib/bluetooth"
+        #"/var/lib/nixos"
+        #"/var/lib/systemd/coredump"
+        {
+          directory = "/var/lib/colord";
+          user = "colord";
+          group = "colord";
+          mode = "u=rwx,g=rx,o=";
+        }
+      ];
+      files = [
+        "/etc/machine-id"
+        {
+          file = "/etc/nix/id_rsa";
+          parentDirectory = {mode = "u=rwx,g=,o=";};
+        }
+      ];
+      users.soispha = {
+        home = "/srv/home/soispha"; # TODO link this to ${config.users.users.soispha.homeDirectory}
+        directories = [
+          ".local/share"
+          ".cache"
 
-        "media"
-        "repos"
-        "school"
+          "media"
+          "repos"
+          "school"
+        ];
+        # TODO allowOther = true;
+      };
+    };
+    "/srv/nixos-config" = {
+      directories = [
+        "/etc/nixos"
       ];
-      # TODO allowOther = true;
     };
   };
 }