reaktor2: add user option

This commit is contained in:
lassulus 2019-01-27 13:41:51 +01:00
parent aa070d5db7
commit 6271cfaed4

View File

@ -25,7 +25,7 @@ with import <stockholm/lib>;
type = types.listOf types.attrs; type = types.listOf types.attrs;
}; };
stateDir = mkOption { stateDir = mkOption {
default = "/var/lib/${self.config.systemd-service-name}"; default = "/var/lib/${self.config.user}";
readOnly = true; readOnly = true;
type = types.absolute-pathname; type = types.absolute-pathname;
}; };
@ -33,6 +33,10 @@ with import <stockholm/lib>;
default = "reaktor2${optionalString (name != "default") "-${name}"}"; default = "reaktor2${optionalString (name != "default") "-${name}"}";
type = types.filename; type = types.filename;
}; };
user = mkOption {
default = self.config.systemd-service-name;
type = types.str;
};
}; };
})); }));
}; };
@ -43,10 +47,10 @@ with import <stockholm/lib>;
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
User = cfg.systemd-service-name; User = cfg.user;
Group = "reaktor2"; Group = "reaktor2";
DynamicUser = true; DynamicUser = true;
StateDirectory = cfg.systemd-service-name; StateDirectory = cfg.user;
ExecStart = let ExecStart = let
configFile = pkgs.writeJSON configFileName configValue; configFile = pkgs.writeJSON configFileName configValue;
configFileName = "${cfg.systemd-service-name}.config.json"; configFileName = "${cfg.systemd-service-name}.config.json";