diff options
| author | Kleidi Bujari <mail@4kb.net> | 2026-10-24 22:52:35 -0700 |
|---|---|---|
| committer | Kleidi Bujari <mail@4kb.net> | 2026-10-24 22:59:09 -0700 |
| commit | 48c8a4145c5a73874797a6de3f05ce584b1d1798 (patch) | |
| tree | bd4c627e8c8944fb7082b7a9982e8d3677c2a2c4 /modules/xnet/persist.nix | |
| parent | 1a181be93f37a94b347b2f5f97a1fef57e11cf89 (diff) | |
| parent | 27db59cac4f3c3e7a1e4187a5f56d4ec61895c5a (diff) | |
| download | depot-48c8a4145c5a73874797a6de3f05ce584b1d1798.tar.gz depot-48c8a4145c5a73874797a6de3f05ce584b1d1798.tar.bz2 depot-48c8a4145c5a73874797a6de3f05ce584b1d1798.zip | |
Diffstat (limited to 'modules/xnet/persist.nix')
| -rw-r--r-- | modules/xnet/persist.nix | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/modules/xnet/persist.nix b/modules/xnet/persist.nix index 10eb883..5e69bae 100644 --- a/modules/xnet/persist.nix +++ b/modules/xnet/persist.nix @@ -10,39 +10,42 @@ let in { options.xnet.persist = mkOption { - type = types.listOf (types.either - types.str - (types.submodule { - options = { - path = mkOption { - type = types.str; - description = "Path to persist"; - }; - user = mkOption { - type = types.nullOr types.str; - default = null; - description = "User ID to set on the persisted directory"; - }; - group = mkOption { - type = types.nullOr types.str; - default = null; - description = "Group ID to set on the persisted directory"; - }; + type = types.listOf ( + types.either types.str ( + types.submodule { + options = { + path = mkOption { + type = types.str; + description = "Path to persist"; + }; + user = mkOption { + type = types.nullOr types.str; + default = null; + description = "User ID to set on the persisted directory"; + }; + group = mkOption { + type = types.nullOr types.str; + default = null; + description = "Group ID to set on the persisted directory"; + }; - mode = mkOption { - type = types.nullOr types.str; - default = null; - description = "Permissions to set"; + mode = mkOption { + type = types.nullOr types.str; + default = null; + description = "Permissions to set"; + }; }; - }; - })); + } + ) + ); default = [ ]; description = "Automatically persisted state."; }; config.systemd.tmpfiles.rules = let - mkEntry = entry: + mkEntry = + entry: let path = if isString entry then entry else entry.path; user = if isString entry then "-" else entry.user; @@ -53,7 +56,11 @@ in link = "L+ ${path} - - - - /persist${path}"; perm = "Z ${mode} ${user} ${group} - -"; in - [ dent link perm ]; + [ + dent + link + perm + ]; entries = map mkEntry config.xnet.persist; in |
