diff options
| author | Michael Hoang <enzime@users.noreply.github.com> | 2024-11-04 14:00:05 +1100 |
|---|---|---|
| committer | Michael Hoang <enzime@users.noreply.github.com> | 2024-11-07 11:41:51 +1100 |
| commit | 569153467be5f438e4f932a09bfba79adcecf856 (patch) | |
| tree | 00f65e7cce2fd81a6eeac706645bce35ebe7fdc5 /modules | |
| parent | dd48cbd7766baba246f0b2e2bd42baf67e0005d6 (diff) | |
ofborg: automatically add `ofborg` to `known{Users,Groups}`
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/examples/ofborg.nix | 5 | ||||
| -rw-r--r-- | modules/services/ofborg/default.nix | 10 |
2 files changed, 4 insertions, 11 deletions
diff --git a/modules/examples/ofborg.nix b/modules/examples/ofborg.nix index 6cef6e7..ed928b7 100644 --- a/modules/examples/ofborg.nix +++ b/modules/examples/ofborg.nix @@ -18,11 +18,6 @@ with lib; nix.gc.automatic = true; nix.gc.options = "--max-freed $((25 * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | awk '{ print $4 }')))"; - # Manage user for ofborg, this enables creating/deleting users - # depending on what modules are enabled. - users.knownGroups = [ "ofborg" ]; - users.knownUsers = [ "ofborg" ]; - # Used for backwards compatibility, please read the changelog before changing. # $ darwin-rebuild changelog system.stateVersion = 5; diff --git a/modules/services/ofborg/default.nix b/modules/services/ofborg/default.nix index 4c35615..8959cc8 100644 --- a/modules/services/ofborg/default.nix +++ b/modules/services/ofborg/default.nix @@ -46,12 +46,6 @@ in }; config = mkIf cfg.enable { - - assertions = [ - { assertion = elem "ofborg" config.users.knownGroups; message = "set users.knownGroups to enable ofborg group"; } - { assertion = elem "ofborg" config.users.knownUsers; message = "set users.knownUsers to enable ofborg user"; } - ]; - warnings = mkIf (isDerivation cfg.configFile) [ "services.ofborg.configFile is a derivation, credentials will be world readable" ]; @@ -87,9 +81,13 @@ in users.users.ofborg.shell = "/bin/bash"; users.users.ofborg.description = "OfBorg service user"; + users.knownUsers = [ "ofborg" ]; + users.groups.ofborg.gid = mkDefault 531; users.groups.ofborg.description = "Nix group for OfBorg service"; + users.knownGroups = [ "ofborg" ]; + # FIXME: create logfiles automatically if defined. system.activationScripts.preActivation.text = '' mkdir -p '${user.home}' |
