From 878ea506e0026d617076e2bbeba5a20a3b8e2a6e Mon Sep 17 00:00:00 2001 From: Sander van der Burg Date: Sun, 21 Mar 2021 14:48:11 +0100 Subject: [PATCH] Use configurable libDir property --- service-containers-agnostic/constructors.nix | 5 +++-- .../supervisord/extendable-supervisord.nix | 7 ++++--- services-agnostic/constructors.nix | 13 +++++++------ services-agnostic/dbus-daemon/default.nix | 4 ++-- services-agnostic/hydra/hydra-server.nix | 4 ++-- services-agnostic/influxdb/default.nix | 4 ++-- services-agnostic/influxdb/simpleinfluxdb.nix | 6 +++--- services-agnostic/sshd/default.nix | 4 ++-- .../supervisord/extendable-supervisord.nix | 4 ++-- 9 files changed, 27 insertions(+), 24 deletions(-) diff --git a/service-containers-agnostic/constructors.nix b/service-containers-agnostic/constructors.nix index 05de0d3..d393696 100644 --- a/service-containers-agnostic/constructors.nix +++ b/service-containers-agnostic/constructors.nix @@ -5,6 +5,7 @@ , runtimeDir , cacheDir , spoolDir +, libDir , tmpDir , forceDisableUserChange , processManager @@ -13,7 +14,7 @@ let constructors = import ../services-agnostic/constructors.nix { - inherit nix-processmgmt pkgs stateDir logDir runtimeDir cacheDir spoolDir tmpDir forceDisableUserChange processManager ids; + inherit nix-processmgmt pkgs stateDir logDir runtimeDir cacheDir spoolDir libDir tmpDir forceDisableUserChange processManager ids; }; in { @@ -81,7 +82,7 @@ in }; extendableSupervisord = import ./supervisord/extendable-supervisord.nix { - inherit stateDir; + inherit libDir; inherit (pkgs) lib; supervisordConstructorFun = constructors.extendableSupervisord; dysnomia = pkgs.dysnomia.override (origArgs: { diff --git a/service-containers-agnostic/supervisord/extendable-supervisord.nix b/service-containers-agnostic/supervisord/extendable-supervisord.nix index e2a3b2a..4ed9d67 100644 --- a/service-containers-agnostic/supervisord/extendable-supervisord.nix +++ b/service-containers-agnostic/supervisord/extendable-supervisord.nix @@ -1,6 +1,7 @@ -{supervisordConstructorFun, lib, dysnomia, stateDir}: +{supervisordConstructorFun, lib, dysnomia, libDir}: -{ instanceSuffix ? "", instanceName ? "supervisord${instanceSuffix}" +{ instanceSuffix ? "" +, instanceName ? "supervisord${instanceSuffix}" , containerName ? "supervisord-program${instanceSuffix}" , inetHTTPServerPort ? 9001 , postInstall ? "" @@ -9,7 +10,7 @@ }: let - supervisordTargetDir = "${stateDir}/lib/${instanceName}/conf.d"; + supervisordTargetDir = "${libDir}/${instanceName}/conf.d"; pkg = supervisordConstructorFun { inherit instanceName inetHTTPServerPort; diff --git a/services-agnostic/constructors.nix b/services-agnostic/constructors.nix index a0f3827..7e7c646 100644 --- a/services-agnostic/constructors.nix +++ b/services-agnostic/constructors.nix @@ -5,6 +5,7 @@ , runtimeDir , cacheDir , spoolDir +, libDir , tmpDir , forceDisableUserChange , processManager @@ -52,7 +53,7 @@ in }; dbus-daemon = import ./dbus-daemon { - inherit createManagedProcess stateDir runtimeDir ids; + inherit createManagedProcess libDir runtimeDir ids; inherit (pkgs) lib dbus writeTextFile; }; @@ -88,18 +89,18 @@ in }; hydra-server = import ./hydra/hydra-server.nix { - inherit createManagedProcess stateDir forceDisableUserChange; + inherit createManagedProcess libDir forceDisableUserChange; inherit (pkgs) lib writeTextFile postgresql su; hydra = pkgs.hydra-unstable; }; influxdb = import ./influxdb { - inherit createManagedProcess stateDir; + inherit createManagedProcess libDir; inherit (pkgs) influxdb; }; simpleInfluxdb = import ./influxdb/simpleinfluxdb.nix { - inherit createManagedProcess stateDir; + inherit createManagedProcess libDir; inherit (pkgs) influxdb writeTextFile; }; @@ -139,7 +140,7 @@ in }; sshd = import ./sshd { - inherit createManagedProcess stateDir runtimeDir tmpDir forceDisableUserChange; + inherit createManagedProcess libDir runtimeDir tmpDir forceDisableUserChange; inherit (pkgs) writeTextFile openssh; }; @@ -164,7 +165,7 @@ in }; extendableSupervisord = import ./supervisord/extendable-supervisord.nix { - inherit createManagedProcess stateDir runtimeDir logDir; + inherit createManagedProcess libDir runtimeDir logDir; inherit (pkgs) writeTextFile; inherit (pkgs.pythonPackages) supervisor; }; diff --git a/services-agnostic/dbus-daemon/default.nix b/services-agnostic/dbus-daemon/default.nix index 3e09dcc..9e1dda9 100644 --- a/services-agnostic/dbus-daemon/default.nix +++ b/services-agnostic/dbus-daemon/default.nix @@ -1,4 +1,4 @@ -{createManagedProcess, lib, writeTextFile, dbus, stateDir, runtimeDir, ids ? {}}: +{createManagedProcess, lib, writeTextFile, dbus, libDir, runtimeDir, ids ? {}}: {extraConfig ? "", busType ? "system", services ? []}: let @@ -101,7 +101,7 @@ in createManagedProcess { name = "dbus-daemon"; initialize = '' - mkdir -p ${stateDir}/lib/dbus + mkdir -p ${libDir}/dbus mkdir -p ${dbusRuntimeDir} ${dbus}/bin/dbus-uuidgen --ensure ''; diff --git a/services-agnostic/hydra/hydra-server.nix b/services-agnostic/hydra/hydra-server.nix index a789672..a7b27b9 100644 --- a/services-agnostic/hydra/hydra-server.nix +++ b/services-agnostic/hydra/hydra-server.nix @@ -1,4 +1,4 @@ -{createManagedProcess, lib, writeTextFile, hydra, postgresql, su, stateDir, forceDisableUserChange}: +{createManagedProcess, lib, writeTextFile, hydra, postgresql, su, libDir, forceDisableUserChange}: { instanceSuffix ? "" , instanceName ? "hydra-server${instanceSuffix}" @@ -11,7 +11,7 @@ , user ? "hydra-www${instanceSuffix}" , listenHost ? "*" , port ? 3000 -, baseDir ? "${stateDir}/lib/${hydraInstanceName}" +, baseDir ? "${libDir}/${hydraInstanceName}" , dbi ? null , gcRootsDir ? "/nix/var/nix/gcroots/${hydraInstanceName}" , hydraURL ? "http://localhost" diff --git a/services-agnostic/influxdb/default.nix b/services-agnostic/influxdb/default.nix index f734ca3..93f7891 100644 --- a/services-agnostic/influxdb/default.nix +++ b/services-agnostic/influxdb/default.nix @@ -1,4 +1,4 @@ -{createManagedProcess, influxdb, stateDir}: +{createManagedProcess, influxdb, libDir}: { instanceSuffix ? "" , instanceName ? "influxdb${instanceSuffix}" @@ -10,7 +10,7 @@ let user = instanceName; group = instanceName; - influxdbStateDir = "${stateDir}/lib/${instanceName}"; + influxdbStateDir = "${libDir}/${instanceName}"; in createManagedProcess { inherit instanceName user postInstall; diff --git a/services-agnostic/influxdb/simpleinfluxdb.nix b/services-agnostic/influxdb/simpleinfluxdb.nix index 8434ec6..65f4af0 100644 --- a/services-agnostic/influxdb/simpleinfluxdb.nix +++ b/services-agnostic/influxdb/simpleinfluxdb.nix @@ -1,4 +1,4 @@ -{createManagedProcess, influxdb, writeTextFile, stateDir}: +{createManagedProcess, influxdb, writeTextFile, libDir}: { instanceSuffix ? "" , instanceName ? "influxdb${instanceSuffix}" @@ -11,7 +11,7 @@ }: let - influxdbStateDir = "${stateDir}/lib/${instanceName}"; + influxdbStateDir = "${libDir}/${instanceName}"; configFile = writeTextFile { name = "influxdb.conf"; @@ -34,7 +34,7 @@ let }; in import ./default.nix { - inherit createManagedProcess influxdb stateDir; + inherit createManagedProcess influxdb libDir; } { inherit instanceName configFile postInstall; } diff --git a/services-agnostic/sshd/default.nix b/services-agnostic/sshd/default.nix index 69018d7..acef266 100644 --- a/services-agnostic/sshd/default.nix +++ b/services-agnostic/sshd/default.nix @@ -1,4 +1,4 @@ -{createManagedProcess, writeTextFile, openssh, stateDir, runtimeDir, tmpDir, forceDisableUserChange}: +{createManagedProcess, writeTextFile, openssh, libDir, runtimeDir, tmpDir, forceDisableUserChange}: { instanceSuffix ? "" # The service is called sshd, and not openssh, because it relies on a hardcoded assumption that the privilege separation user is named sshd @@ -8,7 +8,7 @@ }: let - sshdStateDir = "${stateDir}/lib/${instanceName}"; + sshdStateDir = "${libDir}/${instanceName}"; sshdConfig = writeTextFile { name = "sshd_config"; diff --git a/services-agnostic/supervisord/extendable-supervisord.nix b/services-agnostic/supervisord/extendable-supervisord.nix index d69aea2..06b1a23 100644 --- a/services-agnostic/supervisord/extendable-supervisord.nix +++ b/services-agnostic/supervisord/extendable-supervisord.nix @@ -1,4 +1,4 @@ -{createManagedProcess, writeTextFile, supervisor, runtimeDir, logDir, stateDir}: +{createManagedProcess, writeTextFile, supervisor, runtimeDir, logDir, libDir}: { instanceSuffix ? "" , instanceName ? "supervisord${instanceSuffix}" @@ -7,7 +7,7 @@ }: let - includeDir = "${stateDir}/lib/${instanceName}/conf.d"; + includeDir = "${libDir}/${instanceName}/conf.d"; in import ./default.nix { inherit createManagedProcess supervisor logDir runtimeDir;