diff options
author | aszlig <aszlig@redmoonstudios.org> | 2016-04-11 22:24:58 +0200 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2016-04-11 22:24:58 +0200 |
commit | 6e10705754a790bcd44d1f46dfb629678750bb9b (patch) | |
tree | d1579957322b4444a42fedccc5aa900f91ce2c34 /nixos/modules/services/misc/taskserver/default.nix | |
parent | cf0501600abbb247585628d685f8262630c2b3c7 (diff) |
nixos/taskserver: Handle declarative conf via JSON
We now no longer have the stupid --service-helper option, which silences messages about already existing organisations, users or groups. Instead of that option, we now have a new subcommand called "process-json", which accepts a JSON file directly from the specified NixOS module options and creates/deletes the users accordingly. Note that this still has a two issues left to solve in this area: * Deletion is not supported yet. * If a user is created imperatively, the next run of process-json will delete it once deletion is supported. So we need to implement deletion and a way to mark organisations, users and groups as "imperatively managed". Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'nixos/modules/services/misc/taskserver/default.nix')
-rw-r--r-- | nixos/modules/services/misc/taskserver/default.nix | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/nixos/modules/services/misc/taskserver/default.nix b/nixos/modules/services/misc/taskserver/default.nix index b175bd6d67526..7e993627cec43 100644 --- a/nixos/modules/services/misc/taskserver/default.nix +++ b/nixos/modules/services/misc/taskserver/default.nix @@ -142,8 +142,6 @@ let propagatedBuildInputs = [ pkgs.pythonPackages.click ]; }; - ctlcmd = "${nixos-taskserver}/bin/nixos-taskserver --service-helper"; - withMeta = meta: defs: mkMerge [ defs { inherit meta; } ]; in { @@ -432,20 +430,10 @@ in { environment.TASKDDATA = cfg.dataDir; - preStart = '' - ${concatStrings (mapAttrsToList (orgName: attrs: '' - ${ctlcmd} add-org ${mkShellStr orgName} - - ${concatMapStrings (user: '' - echo Creating ${user} >&2 - ${ctlcmd} add-user ${mkShellStr orgName} ${mkShellStr user} - '') attrs.users} - - ${concatMapStrings (group: '' - ${ctlcmd} add-group ${mkShellStr orgName} ${mkShellStr user} - '') attrs.groups} - '') cfg.organisations)} - ''; + preStart = let + jsonOrgs = builtins.toJSON cfg.organisations; + jsonFile = pkgs.writeText "orgs.json" jsonOrgs; + in "${nixos-taskserver}/bin/nixos-taskserver process-json '${jsonFile}'"; serviceConfig = { ExecStart = "@${taskd} taskd server"; |