nixos/scion: introduce package option (#327765)

This commit is contained in:
Matthew Croughan
2024-07-19 02:30:10 +02:00
committed by GitHub
parent 283920fe4e
commit be9599e3d4
5 changed files with 6 additions and 5 deletions
@@ -60,7 +60,7 @@ in
serviceConfig = {
Type = "simple";
Group = if (config.services.scion.scion-dispatcher.enable == true) then "scion" else null;
ExecStart = "${pkgs.scion}/bin/scion-control --config ${configFile}";
ExecStart = "${globalCfg.package}/bin/scion-control --config ${configFile}";
DynamicUser = true;
Restart = "on-failure";
BindPaths = [ "/dev/shm:/run/shm" ];
@@ -56,7 +56,7 @@ in
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.scion}/bin/scion-daemon --config ${configFile}";
ExecStart = "${globalCfg.package}/bin/scion-daemon --config ${configFile}";
Restart = "on-failure";
DynamicUser = true;
${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-daemon";
@@ -65,7 +65,7 @@ in
DynamicUser = true;
BindPaths = [ "/dev/shm:/run/shm" ];
ExecStartPre = "${pkgs.coreutils}/bin/rm -rf /run/shm/dispatcher";
ExecStart = "${pkgs.scion}/bin/scion-dispatcher --config ${configFile}";
ExecStart = "${globalCfg.package}/bin/scion-dispatcher --config ${configFile}";
Restart = "on-failure";
${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-dispatcher";
};
@@ -40,7 +40,7 @@ in
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.scion}/bin/scion-router --config ${configFile}";
ExecStart = "${globalCfg.package}/bin/scion-router --config ${configFile}";
Restart = "on-failure";
DynamicUser = true;
${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-router";
@@ -8,6 +8,7 @@ in
{
options.services.scion = {
enable = mkEnableOption "all of the scion components and services";
package = mkPackageOption pkgs "scion" { };
stateless = mkOption {
type = types.bool;
default = true;
@@ -34,7 +35,7 @@ in
};
config = mkIf cfg.enable {
environment.systemPackages = [
pkgs.scion
cfg.package
];
services.scion = {
scion-dispatcher.enable = true;