aboutsummaryrefslogtreecommitdiff
path: root/profiles/defaults.nix
diff options
context:
space:
mode:
Diffstat (limited to 'profiles/defaults.nix')
-rw-r--r--profiles/defaults.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/profiles/defaults.nix b/profiles/defaults.nix
index 2683c5a..834c28d 100644
--- a/profiles/defaults.nix
+++ b/profiles/defaults.nix
@@ -5,6 +5,17 @@
adminUser,
...
}:
+let
+ inherit (lib // builtins)
+ attrNames
+ hasAttr
+ mkIf
+ length
+ ;
+ hasState =
+ hasAttr "persistence" config.environment && (length (attrNames config.environment.persistence)) > 0;
+ hasSecrets = config.age.secrets != { };
+in
{
imports = [
./cgroups.nix
@@ -145,4 +156,8 @@
vim
wireguard-tools
];
+
+ system.activationScripts.agenixNewGeneration = mkIf (
+ hasSecrets && hasState && config.ephemeralRoot
+ ) { deps = [ "persist-files" ]; };
}