git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/hledger-web: set capabilites as boolean
commit347a9168aee712703b6add4933164f2a0d8b41f8 authorJustin Humm <justin.humm@posteo.de> dateFri 12 Mar 2021, 22:09 (6 years ago) parent569940b
2 files changed+28−6
nixos/modules/services/web-apps/hledger-web.nix+27−6 nixos/tests/hledger-web.nix+1
nixos/modules/services/web-apps/hledger-web.nix+27−6
@@ -26,12 +26,28 @@ in {
2626 '';
2727 };
2828
29− capabilities = mkOption {
30− type = types.commas;
31− default = "view";
32− description = ''
33− Enable the view, add, and/or manage capabilities. E.g. view,add
34− '';
29+ capabilities = {
30+ view = mkOption {
31+ type = types.bool;
32+ default = true;
33+ description = ''
34+ Enable the view capability.
35+ '';
36+ };
37+ add = mkOption {
38+ type = types.bool;
39+ default = false;
40+ description = ''
41+ Enable the add capability.
42+ '';
43+ };
44+ manage = mkOption {
45+ type = types.bool;
46+ default = false;
47+ description = ''
48+ Enable the manage capability.
49+ '';
50+ };
3551 };
3652
3753 stateDir = mkOption {
@@ -86,6 +102,11 @@ in {
86102 users.groups.hledger = {};
87103
88104 systemd.services.hledger-web = let
105+ capabilityString = with cfg.capabilities; concatStringsSep "," (
106+ (optional view "view")
107+ ++ (optional add "add")
108+ ++ (optional manage "manage")
109+ );
89110 serverArgs = with cfg; escapeShellArgs ([
90111 "--serve"
91112 "--host=${host}"
nixos/tests/hledger-web.nix+1
@@ -19,6 +19,7 @@ rec {
1919 host = "127.0.0.1";
2020 port = 5000;
2121 enable = true;
22+ capabilities.manage = true;
2223 };
2324 networking.firewall.allowedTCPPorts = [ config.services.hledger-web.port ];
2425 systemd.services.hledger-web.preStart = ''