about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--modules/persistence/bluetooth/default.nix10
-rw-r--r--modules/persistence/default.nix5
-rw-r--r--modules/persistence/networkmanager/default.nix12
-rw-r--r--modules/persistence/postfix/default.nix9
-rw-r--r--sys/x220.nix1
5 files changed, 37 insertions, 0 deletions
diff --git a/modules/persistence/bluetooth/default.nix b/modules/persistence/bluetooth/default.nix
new file mode 100644
index 000000000000..0f3bc0852341
--- /dev/null
+++ b/modules/persistence/bluetooth/default.nix
@@ -0,0 +1,10 @@
+{ config, lib, ... }:
+
+{
+  config = lib.mkIf config.hardware.bluetooth.enable {
+    systemd.tmpfiles.rules = [
+      "d /persist/safe/var/lib/bluetooth 0700"
+      "L+ /var/lib/bluetooth - - - - /persist/safe/var/lib/bluetooth"
+    ];
+  };
+}
diff --git a/modules/persistence/default.nix b/modules/persistence/default.nix
new file mode 100644
index 000000000000..eadb66ea3f32
--- /dev/null
+++ b/modules/persistence/default.nix
@@ -0,0 +1,5 @@
+{ ... }:
+
+{
+  imports = [ ./bluetooth ./networkmanager ./postfix ];
+}
diff --git a/modules/persistence/networkmanager/default.nix b/modules/persistence/networkmanager/default.nix
new file mode 100644
index 000000000000..430b6efa1b64
--- /dev/null
+++ b/modules/persistence/networkmanager/default.nix
@@ -0,0 +1,12 @@
+{ config, lib, ... }:
+
+{
+  config = lib.mkIf config.networking.networkmanager.enable {
+    environment.etc."NetworkManager/system-connections".source =
+      "/persist/safe/etc/NetworkManager/system-connections";
+
+    systemd.tmpfiles.rules = [
+      "d /persist/safe/etc/NetworkManager/system-connections 0700"
+    ];
+  };
+}
diff --git a/modules/persistence/postfix/default.nix b/modules/persistence/postfix/default.nix
new file mode 100644
index 000000000000..19a3961ef578
--- /dev/null
+++ b/modules/persistence/postfix/default.nix
@@ -0,0 +1,9 @@
+{ config, lib, ... }:
+
+{
+  config = lib.mkIf (with config.services.postfix; enable && mapFiles ? sasl_passwd) {
+    systemd.tmpfiles.rules = [
+      "L+ /var/lib/postfix/sasl_passwd - - - - /persist/safe/var/lib/postfix/sasl_passwd"
+    ];
+  };
+}
diff --git a/sys/x220.nix b/sys/x220.nix
index ed2316ce9835..a2c10af4b0eb 100644
--- a/sys/x220.nix
+++ b/sys/x220.nix
@@ -3,6 +3,7 @@
 {
   imports = [
     ../modules/nixos-hardware/lenovo/thinkpad/x220
+    ../modules/persistence
     ../modules/workstation/hardware/bluetooth
     ../modules/workstation/physical
   ];