From be9599e3d4a4b271b19f6da3501522503f6c9cfe Mon Sep 17 00:00:00 2001 From: Matthew Croughan Date: Fri, 19 Jul 2024 01:30:10 +0100 Subject: [PATCH] nixos/scion: introduce package option (#327765) --- nixos/modules/services/networking/scion/scion-control.nix | 2 +- nixos/modules/services/networking/scion/scion-daemon.nix | 2 +- nixos/modules/services/networking/scion/scion-dispatcher.nix | 2 +- nixos/modules/services/networking/scion/scion-router.nix | 2 +- nixos/modules/services/networking/scion/scion.nix | 3 ++- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/networking/scion/scion-control.nix b/nixos/modules/services/networking/scion/scion-control.nix index 0cc190d619b6..8b6733ac0c24 100644 --- a/nixos/modules/services/networking/scion/scion-control.nix +++ b/nixos/modules/services/networking/scion/scion-control.nix @@ -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" ]; diff --git a/nixos/modules/services/networking/scion/scion-daemon.nix b/nixos/modules/services/networking/scion/scion-daemon.nix index 6ee2a4b505f2..09416178d35a 100644 --- a/nixos/modules/services/networking/scion/scion-daemon.nix +++ b/nixos/modules/services/networking/scion/scion-daemon.nix @@ -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"; diff --git a/nixos/modules/services/networking/scion/scion-dispatcher.nix b/nixos/modules/services/networking/scion/scion-dispatcher.nix index 1f4193fae79e..7d2e28be75f7 100644 --- a/nixos/modules/services/networking/scion/scion-dispatcher.nix +++ b/nixos/modules/services/networking/scion/scion-dispatcher.nix @@ -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"; }; diff --git a/nixos/modules/services/networking/scion/scion-router.nix b/nixos/modules/services/networking/scion/scion-router.nix index 47ff320b6a8f..7587a06ed9db 100644 --- a/nixos/modules/services/networking/scion/scion-router.nix +++ b/nixos/modules/services/networking/scion/scion-router.nix @@ -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"; diff --git a/nixos/modules/services/networking/scion/scion.nix b/nixos/modules/services/networking/scion/scion.nix index 0ae959484d32..efab97f7cd8d 100644 --- a/nixos/modules/services/networking/scion/scion.nix +++ b/nixos/modules/services/networking/scion/scion.nix @@ -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;