about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-08-06 13:07:11 -0700
committerFranck Cuny <franck@fcuny.net>2022-08-06 13:17:18 -0700
commit1464a1ef74af012b5784c2dd13fa371a95419c73 (patch)
tree425263272e849c6fc83ea14ad7a852e152c22941
parentref(tools): simplify the import of tools (diff)
downloadworld-1464a1ef74af012b5784c2dd13fa371a95419c73.tar.gz
fix(modules/secrets): call correct function for group
The function `groupExists` returns a boolean, what we want is
`groupIfExists` which returns the actual name of the group.

Change-Id: I7db50066e13932dd617ffccb9dae40ecb1d383a5
Reviewed-on: https://cl.fcuny.net/c/world/+/701
Tested-by: CI
Reviewed-by: Franck Cuny <franck@fcuny.net>
-rw-r--r--modules/secrets/default.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/secrets/default.nix b/modules/secrets/default.nix
index d4a2fd8..2d8998a 100644
--- a/modules/secrets/default.nix
+++ b/modules/secrets/default.nix
@@ -15,7 +15,8 @@ in
         userExists = u: builtins.hasAttr u config.users.users;
         groupExists = g: builtins.hasAttr g config.users.groups;
 
-        # Only set the user and/or group if they exist, to avoid warnings
+        # Only set the user and/or group if they exist, to avoid
+        # warnings. If they don't exist, we default to root.
         userIfExists = u: if userExists u then u else "root";
         groupIfExists = g: if groupExists g then g else "root";
 
@@ -25,7 +26,7 @@ in
           } // lib.optionalAttrs (attrs ? owner) {
             owner = lib.mkDefault (userIfExists attrs.owner);
           } // lib.optionalAttrs (attrs ? group) {
-            group = lib.mkDefault (groupExists attrs.group);
+            group = lib.mkDefault (groupIfExists attrs.group);
           } // lib.optionalAttrs (attrs ? mode) {
             inherit (attrs) mode;
           } // lib.optionalAttrs (attrs ? path) {