git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/hledger-web: set capabilites as boolean
347a916Justin Humm
nixos/modules/services/web-apps/hledger-web.nix+27−6
@@ -26,12 +26,28 @@ in {
26 '';
26 '';
27 };
27 };
28
28
29− capabilities = mkOption {
29+ capabilities = {
30+ view = mkOption {
30− type = types.commas;
31+ type = types.bool;
31− default = "view";
32+ default = true;
32− description = ''
33+ description = ''
33− Enable the view, add, and/or manage capabilities. E.g. view,add
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+ '';
34− '';
50+ };
35 };
51 };
36
52
37 stateDir = mkOption {
53 stateDir = mkOption {
@@ -86,6 +102,11 @@ in {
86 users.groups.hledger = {};
102 users.groups.hledger = {};
87
103
88 systemd.services.hledger-web = let
104 systemd.services.hledger-web = let
105+ capabilityString = with cfg.capabilities; concatStringsSep "," (
106+ (optional view "view")
107+ ++ (optional add "add")
108+ ++ (optional manage "manage")
109+ );
89 serverArgs = with cfg; escapeShellArgs ([
110 serverArgs = with cfg; escapeShellArgs ([
90 "--serve"
111 "--serve"
91 "--host=${host}"
112 "--host=${host}"
nixos/tests/hledger-web.nix+1
@@ -19,6 +19,7 @@ rec {
19 host = "127.0.0.1";
19 host = "127.0.0.1";
20 port = 5000;
20 port = 5000;
21 enable = true;
21 enable = true;
22+ capabilities.manage = true;
22 };
23 };
23 networking.firewall.allowedTCPPorts = [ config.services.hledger-web.port ];
24 networking.firewall.allowedTCPPorts = [ config.services.hledger-web.port ];
24 systemd.services.hledger-web.preStart = ''
25 systemd.services.hledger-web.preStart = ''