about summary refs log tree commit diff stats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--flake.lock16
-rw-r--r--flake.nix10
-rw-r--r--home-manager/default.nix4
-rw-r--r--home-manager/impermanence/default.nix25
-rw-r--r--system/default.nix2
-rw-r--r--system/fileSystemLayouts/default.nix1
-rw-r--r--system/impermanence/default.nix45
7 files changed, 100 insertions, 3 deletions
diff --git a/flake.lock b/flake.lock
index aa5caffa..6da49c2f 100644
--- a/flake.lock
+++ b/flake.lock
@@ -92,6 +92,21 @@
         "type": "github"
       }
     },
+    "impermanence": {
+      "locked": {
+        "lastModified": 1675359654,
+        "narHash": "sha256-FPxzuvJkcO49g4zkWLSeuZkln54bLoTtrggZDJBH90I=",
+        "owner": "nix-community",
+        "repo": "impermanence",
+        "rev": "6138eb8e737bffabd4c8fc78ae015d4fd6a7e2fd",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-community",
+        "repo": "impermanence",
+        "type": "github"
+      }
+    },
     "neovim_config": {
       "flake": false,
       "locked": {
@@ -127,6 +142,7 @@
     "root": {
       "inputs": {
         "home-manager": "home-manager",
+        "impermanence": "impermanence",
         "neovim_config": "neovim_config",
         "nixpkgs": "nixpkgs",
         "strip_js_comments": "strip_js_comments",
diff --git a/flake.nix b/flake.nix
index dd44e2f4..9c602019 100644
--- a/flake.nix
+++ b/flake.nix
@@ -23,6 +23,10 @@
       url = "github:arkenfox/user.js";
       flake = false;
     };
+
+    impermanence = {
+      url = "github:nix-community/impermanence";
+    };
   };
 
   outputs = {
@@ -32,6 +36,7 @@
     neovim_config,
     strip_js_comments,
     user_js,
+    impermanence,
     ...
   } @ inputs: {
     nixosConfigurations.Tiamat = nixpkgs.lib.nixosSystem rec {
@@ -39,6 +44,7 @@
       specialArgs = inputs;
       modules = [
         ./hosts/desktop/configuration.nix
+
         home-manager.nixosModules.home-manager
         {
           home-manager = {
@@ -50,11 +56,9 @@
               inherit user_js;
               inherit system;
               inherit neovim_config;
+              inherit impermanence;
             };
           };
-
-          # Optionally, use home-manager.extraSpecialArgs to pass
-          # arguments to home.nix
         }
       ];
     };
diff --git a/home-manager/default.nix b/home-manager/default.nix
index 4969d565..c11b8d85 100644
--- a/home-manager/default.nix
+++ b/home-manager/default.nix
@@ -5,6 +5,7 @@
   home-manager,
   inputs,
   user_js,
+  impermanence,
   ...
 }: let
   # TODO actually use this in the user config
@@ -15,6 +16,9 @@
   dataHome = "${homeDirectory}/.local/share";
 in {
   imports = [
+# ./impermanence #  TODO doesn't work
+
+
     ./alacritty
     ./cups
     ./firefox
diff --git a/home-manager/impermanence/default.nix b/home-manager/impermanence/default.nix
new file mode 100644
index 00000000..bcb1c62f
--- /dev/null
+++ b/home-manager/impermanence/default.nix
@@ -0,0 +1,25 @@
+# vim: ts=2
+{
+  config,
+  impermanence,
+  ...
+}: {
+  import = [
+    impermanence.nixosModules.home-manager.impermanence
+  ];
+
+  home.persistence."/srv${config.home.homeDirectory}" = {
+    directories = [
+      ".local/share"
+      ".cache"
+
+      "media"
+      "repos"
+      "school"
+    ];
+    files = [
+      ".screenrc"
+    ];
+    allowOther = true;
+  };
+}
diff --git a/system/default.nix b/system/default.nix
index 73f53119..543d889c 100644
--- a/system/default.nix
+++ b/system/default.nix
@@ -6,6 +6,8 @@
     ./locale
     ./packages
     ./sound
+
+    ./impermanence
   ];
 
 }
diff --git a/system/fileSystemLayouts/default.nix b/system/fileSystemLayouts/default.nix
index 9a9b8add..d861d888 100644
--- a/system/fileSystemLayouts/default.nix
+++ b/system/fileSystemLayouts/default.nix
@@ -35,6 +35,7 @@ in {
       "/srv" = {
         device = cfg.mainDisk;
         fsType = "btrfs";
+        neededForBoot = true;
         options = ["subvol=storage" "compress-force=zstd:15"];
       };
       "/boot" = {
diff --git a/system/impermanence/default.nix b/system/impermanence/default.nix
new file mode 100644
index 00000000..16ac3c47
--- /dev/null
+++ b/system/impermanence/default.nix
@@ -0,0 +1,45 @@
+{
+  config,
+  impermanence,
+  ...
+}: {
+  imports = [
+    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}
+      directories = [
+        ".local/share"
+        ".cache"
+
+        "media"
+        "repos"
+        "school"
+      ];
+      # TODO allowOther = true;
+    };
+  };
+}