Use group/user option for Radicale

This commit is contained in:
Pim Kunis 2025-01-04 23:23:41 +01:00
parent e7ddf543c8
commit fe960448c6
3 changed files with 12 additions and 6 deletions

View file

@ -687,16 +687,16 @@
"treefmt-nix": "treefmt-nix_2" "treefmt-nix": "treefmt-nix_2"
}, },
"locked": { "locked": {
"lastModified": 1735985475, "lastModified": 1736029062,
"narHash": "sha256-7blkWqfcvYKfaL2hpy/nWTooHRfJSqaO0a2+XWccqkE=", "narHash": "sha256-7X65+TP0luFpQsA6KV80R05qnWp7NxMaIDryFfJ4MqI=",
"owner": "pizzapim", "owner": "pizzapim",
"repo": "NixNG", "repo": "NixNG",
"rev": "dea65c6a83945c755b9d0097aa2535991daeb907", "rev": "6211c11d7ef2cc8067efcd169e0b8fd02f1816b6",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "pizzapim", "owner": "pizzapim",
"ref": "kubernetes", "ref": "dinit-fixes",
"repo": "NixNG", "repo": "NixNG",
"type": "github" "type": "github"
} }

View file

@ -36,7 +36,7 @@
}; };
nixng = { nixng = {
url = "github:pizzapim/NixNG/kubernetes"; url = "github:pizzapim/NixNG/dinit-fixes";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };

View file

@ -51,12 +51,17 @@ in {
in { in {
init.services.radicale = { init.services.radicale = {
enabled = true; enabled = true;
user = lib.mkDefault "radicale";
group = lib.mkDefault "radicale";
script = pkgs.writeShellScript "radicale-run" '' script = pkgs.writeShellScript "radicale-run" ''
chpst -u ${cfg.user}:${cfg.group} ${cfg.package}/bin/radicale \ ${cfg.package}/bin/radicale \
--config ${configFile} --config ${configFile}
''; '';
}; };
environment.systemPackages = [cfg.package]; environment.systemPackages = [cfg.package];
users.users.${cfg.user} = nglib.mkDefaultRec { users.users.${cfg.user} = nglib.mkDefaultRec {
description = "radicale"; description = "radicale";
group = cfg.group; group = cfg.group;
@ -65,6 +70,7 @@ in {
useDefaultShell = true; useDefaultShell = true;
uid = config.ids.uids.radicale; uid = config.ids.uids.radicale;
}; };
users.groups.${cfg.group} = nglib.mkDefaultRec {gid = config.ids.gids.radicale;}; users.groups.${cfg.group} = nglib.mkDefaultRec {gid = config.ids.gids.radicale;};
ids = { ids = {