Eliminate references to stdenv.lib, some Disnix adjustments
This commit is contained in:
parent
ce1d009393
commit
9f4001fb4b
|
@ -17,7 +17,11 @@ let
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
openssh = rec {
|
openssh = rec {
|
||||||
pkg = constructors.openssh {};
|
pkg = constructors.openssh {
|
||||||
|
extraSSHDConfig = ''
|
||||||
|
UsePAM yes
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
dbus-daemon = {
|
dbus-daemon = {
|
||||||
|
|
|
@ -110,6 +110,9 @@ rec {
|
||||||
|
|
||||||
pkg = constructors.openssh {
|
pkg = constructors.openssh {
|
||||||
inherit port;
|
inherit port;
|
||||||
|
extraSSHDConfig = ''
|
||||||
|
UsePAM yes
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
requiresUniqueIdsFor = [ "sshPorts" "uids" "gids" ];
|
requiresUniqueIdsFor = [ "sshPorts" "uids" "gids" ];
|
||||||
|
|
|
@ -41,7 +41,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
simpleMongodb = import ./mongodb/simplemongodb.nix {
|
simpleMongodb = import ./mongodb/simplemongodb.nix {
|
||||||
inherit (pkgs) stdenv;
|
inherit (pkgs) lib;
|
||||||
mongodbConstructorFun = constructors.simpleMongodb;
|
mongodbConstructorFun = constructors.simpleMongodb;
|
||||||
dysnomia = pkgs.dysnomia.override (origArgs: {
|
dysnomia = pkgs.dysnomia.override (origArgs: {
|
||||||
enableMongoDatabase = true;
|
enableMongoDatabase = true;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{mongodbConstructorFun, stdenv, dysnomia}:
|
{mongodbConstructorFun, lib, dysnomia}:
|
||||||
|
|
||||||
{ instanceSuffix ? "", instanceName ? "mongodb${instanceSuffix}"
|
{ instanceSuffix ? "", instanceName ? "mongodb${instanceSuffix}"
|
||||||
, containerName ? "mongo-database${instanceSuffix}"
|
, containerName ? "mongo-database${instanceSuffix}"
|
||||||
|
@ -18,8 +18,8 @@ let
|
||||||
mkdir -p $out/etc/dysnomia/containers
|
mkdir -p $out/etc/dysnomia/containers
|
||||||
cat > $out/etc/dysnomia/containers/${containerName} <<EOF
|
cat > $out/etc/dysnomia/containers/${containerName} <<EOF
|
||||||
mongoPort=${toString port}
|
mongoPort=${toString port}
|
||||||
${stdenv.lib.optionalString (mongoDumpArgs != null) (toString mongoDumpArgs)}
|
${lib.optionalString (mongoDumpArgs != null) (toString mongoDumpArgs)}
|
||||||
${stdenv.lib.optionalString (mongoRestoreArgs != null) (toString mongoRestoreArgs)}
|
${lib.optionalString (mongoRestoreArgs != null) (toString mongoRestoreArgs)}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Copy the Dysnomia module that manages a Mongo database
|
# Copy the Dysnomia module that manages a Mongo database
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, tomcat, jre, stateDir, runtimeDir, tmpDir, forceDisableUserChange, commonLibs ? []}:
|
{createManagedProcess, lib, tomcat, jre, stateDir, runtimeDir, tmpDir, forceDisableUserChange, commonLibs ? []}:
|
||||||
{instanceSuffix ? "", instanceName ? "tomcat${instanceSuffix}", tomcatConfigFiles, postInstall ? ""}:
|
{instanceSuffix ? "", instanceName ? "tomcat${instanceSuffix}", tomcatConfigFiles, postInstall ? ""}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -49,7 +49,7 @@ createManagedProcess rec {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
chown -R ${user}:${group} ${baseDir}
|
chown -R ${user}:${group} ${baseDir}
|
||||||
''}
|
''}
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, runCommand, apacheHttpd, php, writeTextFile, logDir, runtimeDir, cacheDir, forceDisableUserChange}:
|
{createManagedProcess, lib, runCommand, apacheHttpd, php, writeTextFile, logDir, runtimeDir, cacheDir, forceDisableUserChange}:
|
||||||
|
|
||||||
{ instanceSuffix ? ""
|
{ instanceSuffix ? ""
|
||||||
, instanceName ? "apache${instanceSuffix}"
|
, instanceName ? "apache${instanceSuffix}"
|
||||||
|
@ -42,7 +42,7 @@ let
|
||||||
"alias"
|
"alias"
|
||||||
"dir"
|
"dir"
|
||||||
]
|
]
|
||||||
++ stdenv.lib.optional enableCGI "cgi";
|
++ lib.optional enableCGI "cgi";
|
||||||
|
|
||||||
apacheLogDir = "${logDir}/${instanceName}";
|
apacheLogDir = "${logDir}/${instanceName}";
|
||||||
|
|
||||||
|
@ -59,21 +59,21 @@ import ./default.nix {
|
||||||
inherit createManagedProcess apacheHttpd cacheDir;
|
inherit createManagedProcess apacheHttpd cacheDir;
|
||||||
} {
|
} {
|
||||||
inherit instanceName dependencies postInstall;
|
inherit instanceName dependencies postInstall;
|
||||||
environment = stdenv.lib.optionalAttrs enablePHP {
|
environment = lib.optionalAttrs enablePHP {
|
||||||
PHPRC = phpIni;
|
PHPRC = phpIni;
|
||||||
};
|
};
|
||||||
|
|
||||||
initialize = ''
|
initialize = ''
|
||||||
mkdir -m0700 -p ${apacheLogDir}
|
mkdir -m0700 -p ${apacheLogDir}
|
||||||
|
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
chown ${user}:${group} ${apacheLogDir}
|
chown ${user}:${group} ${apacheLogDir}
|
||||||
''}
|
''}
|
||||||
|
|
||||||
if [ ! -e "${documentRoot}" ]
|
if [ ! -e "${documentRoot}" ]
|
||||||
then
|
then
|
||||||
mkdir -p "${documentRoot}"
|
mkdir -p "${documentRoot}"
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
chown ${user}:${group} ${documentRoot}
|
chown ${user}:${group} ${documentRoot}
|
||||||
''}
|
''}
|
||||||
fi
|
fi
|
||||||
|
@ -85,7 +85,7 @@ import ./default.nix {
|
||||||
ErrorLog "${apacheLogDir}/error_log"
|
ErrorLog "${apacheLogDir}/error_log"
|
||||||
PidFile "${runtimeDir}/${instanceName}.pid"
|
PidFile "${runtimeDir}/${instanceName}.pid"
|
||||||
|
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
User ${user}
|
User ${user}
|
||||||
Group ${group}
|
Group ${group}
|
||||||
''}
|
''}
|
||||||
|
@ -95,17 +95,17 @@ import ./default.nix {
|
||||||
|
|
||||||
Listen ${toString port}
|
Listen ${toString port}
|
||||||
|
|
||||||
${stdenv.lib.concatMapStrings (module: ''
|
${lib.concatMapStrings (module: ''
|
||||||
LoadModule ${module}_module ${apacheHttpd}/modules/mod_${module}.so
|
LoadModule ${module}_module ${apacheHttpd}/modules/mod_${module}.so
|
||||||
'') baseModules}
|
'') baseModules}
|
||||||
${stdenv.lib.concatMapStrings (module:
|
${lib.concatMapStrings (module:
|
||||||
if builtins.isAttrs module then ''
|
if builtins.isAttrs module then ''
|
||||||
LoadModule ${module.name}_module ${module.module}
|
LoadModule ${module.name}_module ${module.module}
|
||||||
'' else if builtins.isString module then ''
|
'' else if builtins.isString module then ''
|
||||||
LoadModule ${module}_module ${apacheHttpd}/modules/mod_${module}.so
|
LoadModule ${module}_module ${apacheHttpd}/modules/mod_${module}.so
|
||||||
'' else throw "Unknown type for module!"
|
'' else throw "Unknown type for module!"
|
||||||
) modules}
|
) modules}
|
||||||
${stdenv.lib.optionalString enablePHP ''
|
${lib.optionalString enablePHP ''
|
||||||
LoadModule php7_module ${php}/modules/libphp7.so
|
LoadModule php7_module ${php}/modules/libphp7.so
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ import ./default.nix {
|
||||||
|
|
||||||
DocumentRoot "${documentRoot}"
|
DocumentRoot "${documentRoot}"
|
||||||
|
|
||||||
${stdenv.lib.optionalString enablePHP ''
|
${lib.optionalString enablePHP ''
|
||||||
<FilesMatch \.php$>
|
<FilesMatch \.php$>
|
||||||
SetHandler application/x-httpd-php
|
SetHandler application/x-httpd-php
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
|
|
|
@ -24,7 +24,7 @@ in
|
||||||
|
|
||||||
simpleWebappApache = import ./apache/simple-webapp-apache.nix {
|
simpleWebappApache = import ./apache/simple-webapp-apache.nix {
|
||||||
inherit createManagedProcess logDir cacheDir runtimeDir forceDisableUserChange;
|
inherit createManagedProcess logDir cacheDir runtimeDir forceDisableUserChange;
|
||||||
inherit (pkgs) stdenv runCommand apacheHttpd php writeTextFile;
|
inherit (pkgs) lib runCommand apacheHttpd php writeTextFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
reverseProxyApache = import ./apache/reverse-proxy-apache.nix {
|
reverseProxyApache = import ./apache/reverse-proxy-apache.nix {
|
||||||
|
@ -34,7 +34,7 @@ in
|
||||||
|
|
||||||
tomcat = import ./apache-tomcat {
|
tomcat = import ./apache-tomcat {
|
||||||
inherit createManagedProcess stateDir runtimeDir tmpDir forceDisableUserChange;
|
inherit createManagedProcess stateDir runtimeDir tmpDir forceDisableUserChange;
|
||||||
inherit (pkgs) stdenv;
|
inherit (pkgs) lib;
|
||||||
jre = pkgs.jre8;
|
jre = pkgs.jre8;
|
||||||
tomcat = pkgs.tomcat9;
|
tomcat = pkgs.tomcat9;
|
||||||
};
|
};
|
||||||
|
@ -48,12 +48,12 @@ in
|
||||||
|
|
||||||
dbus-daemon = import ./dbus-daemon {
|
dbus-daemon = import ./dbus-daemon {
|
||||||
inherit createManagedProcess stateDir runtimeDir;
|
inherit createManagedProcess stateDir runtimeDir;
|
||||||
inherit (pkgs) stdenv dbus writeTextFile;
|
inherit (pkgs) lib dbus writeTextFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
disnix-service = import ./disnix-service {
|
disnix-service = import ./disnix-service {
|
||||||
inherit createManagedProcess;
|
inherit createManagedProcess;
|
||||||
inherit (pkgs) stdenv disnix nix;
|
inherit (pkgs) lib nix disnix dysnomia;
|
||||||
};
|
};
|
||||||
|
|
||||||
docker = import ./docker {
|
docker = import ./docker {
|
||||||
|
@ -72,14 +72,14 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
hydra-queue-runner = import ./hydra/hydra-queue-runner.nix {
|
hydra-queue-runner = import ./hydra/hydra-queue-runner.nix {
|
||||||
inherit (pkgs) stdenv nix;
|
inherit (pkgs) lib nix;
|
||||||
inherit createManagedProcess forceDisableUserChange;
|
inherit createManagedProcess forceDisableUserChange;
|
||||||
hydra = pkgs.hydra-unstable;
|
hydra = pkgs.hydra-unstable;
|
||||||
};
|
};
|
||||||
|
|
||||||
hydra-server = import ./hydra/hydra-server.nix {
|
hydra-server = import ./hydra/hydra-server.nix {
|
||||||
inherit createManagedProcess stateDir forceDisableUserChange;
|
inherit createManagedProcess stateDir forceDisableUserChange;
|
||||||
inherit (pkgs) stdenv writeTextFile postgresql su;
|
inherit (pkgs) lib writeTextFile postgresql su;
|
||||||
hydra = pkgs.hydra-unstable;
|
hydra = pkgs.hydra-unstable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -100,27 +100,27 @@ in
|
||||||
|
|
||||||
simpleMongodb = import ./mongodb/simplemongodb.nix {
|
simpleMongodb = import ./mongodb/simplemongodb.nix {
|
||||||
inherit createManagedProcess runtimeDir stateDir forceDisableUserChange;
|
inherit createManagedProcess runtimeDir stateDir forceDisableUserChange;
|
||||||
inherit (pkgs) stdenv mongodb writeTextFile;
|
inherit (pkgs) lib mongodb writeTextFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
mysql = import ./mysql {
|
mysql = import ./mysql {
|
||||||
inherit createManagedProcess stateDir runtimeDir forceDisableUserChange;
|
inherit createManagedProcess stateDir runtimeDir forceDisableUserChange;
|
||||||
inherit (pkgs) stdenv mysql;
|
inherit (pkgs) lib mysql;
|
||||||
};
|
};
|
||||||
|
|
||||||
nginx = import ./nginx {
|
nginx = import ./nginx {
|
||||||
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
|
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
|
||||||
inherit (pkgs) stdenv nginx;
|
inherit (pkgs) lib nginx;
|
||||||
};
|
};
|
||||||
|
|
||||||
nginxReverseProxyHostBased = import ./nginx/nginx-reverse-proxy-hostbased.nix {
|
nginxReverseProxyHostBased = import ./nginx/nginx-reverse-proxy-hostbased.nix {
|
||||||
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
|
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
|
||||||
inherit (pkgs) stdenv writeTextFile nginx;
|
inherit (pkgs) stdenv lib writeTextFile nginx;
|
||||||
};
|
};
|
||||||
|
|
||||||
nginxReverseProxyPathBased = import ./nginx/nginx-reverse-proxy-pathbased.nix {
|
nginxReverseProxyPathBased = import ./nginx/nginx-reverse-proxy-pathbased.nix {
|
||||||
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
|
inherit createManagedProcess stateDir runtimeDir cacheDir forceDisableUserChange;
|
||||||
inherit (pkgs) stdenv writeTextFile nginx;
|
inherit (pkgs) stdenv lib writeTextFile nginx;
|
||||||
};
|
};
|
||||||
|
|
||||||
nix-daemon = import ./nix-daemon {
|
nix-daemon = import ./nix-daemon {
|
||||||
|
@ -135,12 +135,12 @@ in
|
||||||
|
|
||||||
postgresql = import ./postgresql {
|
postgresql = import ./postgresql {
|
||||||
inherit createManagedProcess stateDir runtimeDir forceDisableUserChange;
|
inherit createManagedProcess stateDir runtimeDir forceDisableUserChange;
|
||||||
inherit (pkgs) stdenv postgresql su;
|
inherit (pkgs) lib postgresql su;
|
||||||
};
|
};
|
||||||
|
|
||||||
simplePostgresql = import ./postgresql/simplepostgresql.nix {
|
simplePostgresql = import ./postgresql/simplepostgresql.nix {
|
||||||
inherit createManagedProcess stateDir runtimeDir forceDisableUserChange;
|
inherit createManagedProcess stateDir runtimeDir forceDisableUserChange;
|
||||||
inherit (pkgs) stdenv writeTextFile postgresql su;
|
inherit (pkgs) lib writeTextFile postgresql su;
|
||||||
};
|
};
|
||||||
|
|
||||||
s6-svscan = import ./s6-svscan {
|
s6-svscan = import ./s6-svscan {
|
||||||
|
@ -161,6 +161,6 @@ in
|
||||||
|
|
||||||
svnserve = import ./svnserve {
|
svnserve = import ./svnserve {
|
||||||
inherit createManagedProcess runtimeDir forceDisableUserChange;
|
inherit createManagedProcess runtimeDir forceDisableUserChange;
|
||||||
inherit (pkgs) stdenv subversion;
|
inherit (pkgs) lib subversion;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, writeTextFile, dbus, stateDir, runtimeDir}:
|
{createManagedProcess, lib, writeTextFile, dbus, stateDir, runtimeDir}:
|
||||||
{extraConfig ? "", packages ? []}:
|
{extraConfig ? "", packages ? []}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -82,7 +82,7 @@ let
|
||||||
</policy>
|
</policy>
|
||||||
|
|
||||||
<!-- Generate service and include directories for each package -->
|
<!-- Generate service and include directories for each package -->
|
||||||
${stdenv.lib.concatMapStrings (package: ''
|
${lib.concatMapStrings (package: ''
|
||||||
<servicedir>${package}/share/dbus-1/system-services</servicedir>
|
<servicedir>${package}/share/dbus-1/system-services</servicedir>
|
||||||
<includedir>${package}/etc/dbus-1/system.d</includedir>
|
<includedir>${package}/etc/dbus-1/system.d</includedir>
|
||||||
<includedir>${package}/share/dbus-1/system.d</includedir>
|
<includedir>${package}/share/dbus-1/system.d</includedir>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, disnix, nix}:
|
{createManagedProcess, lib, nix, disnix, dysnomia}:
|
||||||
{dbus-daemon ? null}:
|
{dbus-daemon ? null}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -7,9 +7,9 @@ in
|
||||||
createManagedProcess {
|
createManagedProcess {
|
||||||
name = "disnix-service";
|
name = "disnix-service";
|
||||||
process = "${disnix}/bin/disnix-service";
|
process = "${disnix}/bin/disnix-service";
|
||||||
path = [ nix ];
|
path = [ nix dysnomia disnix ];
|
||||||
daemonExtraArgs = [ "--daemon" ];
|
daemonExtraArgs = [ "--daemon" ];
|
||||||
dependencies = stdenv.lib.optional (dbus-daemon != null) dbus-daemon.pkg;
|
dependencies = lib.optional (dbus-daemon != null) dbus-daemon.pkg;
|
||||||
|
|
||||||
credentials = {
|
credentials = {
|
||||||
groups = {
|
groups = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, hydra, nix, forceDisableUserChange}:
|
{createManagedProcess, lib, hydra, nix, forceDisableUserChange}:
|
||||||
{nix-daemon, hydra-server, user ? null}:
|
{nix-daemon, hydra-server, user ? null}:
|
||||||
|
|
||||||
# TODO: execStopPost: /bin/hydra-queue-runner --unlock
|
# TODO: execStopPost: /bin/hydra-queue-runner --unlock
|
||||||
|
@ -22,7 +22,7 @@ createManagedProcess {
|
||||||
initialize = ''
|
initialize = ''
|
||||||
mkdir -m 0700 -p ${queueRunnerBaseDir}
|
mkdir -m 0700 -p ${queueRunnerBaseDir}
|
||||||
mkdir -m 0750 -p ${hydra-server.baseDir}/build-logs
|
mkdir -m 0750 -p ${hydra-server.baseDir}/build-logs
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
chown ${user}:${hydra-server.hydraGroup} ${queueRunnerBaseDir} ${hydra-server.baseDir}/build-logs
|
chown ${user}:${hydra-server.hydraGroup} ${queueRunnerBaseDir} ${hydra-server.baseDir}/build-logs
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, writeTextFile, hydra, postgresql, su, stateDir, forceDisableUserChange}:
|
{createManagedProcess, lib, writeTextFile, hydra, postgresql, su, stateDir, forceDisableUserChange}:
|
||||||
|
|
||||||
{ instanceSuffix ? ""
|
{ instanceSuffix ? ""
|
||||||
, instanceName ? "hydra-server${instanceSuffix}"
|
, instanceName ? "hydra-server${instanceSuffix}"
|
||||||
|
@ -32,7 +32,7 @@ let
|
||||||
notification_sender = ${notificationSender}
|
notification_sender = ${notificationSender}
|
||||||
max_servers = 25
|
max_servers = 25
|
||||||
compress_num_threads = 0
|
compress_num_threads = 0
|
||||||
${stdenv.lib.optionalString (logo != null) ''
|
${lib.optionalString (logo != null) ''
|
||||||
hydra_logo = ${logo}
|
hydra_logo = ${logo}
|
||||||
''}
|
''}
|
||||||
gc_roots_dir = ${gcRootsDir}
|
gc_roots_dir = ${gcRootsDir}
|
||||||
|
@ -52,14 +52,14 @@ createManagedProcess {
|
||||||
mkdir -m 0700 -p ${baseDir}/www
|
mkdir -m 0700 -p ${baseDir}/www
|
||||||
mkdir -p ${gcRootsDir}
|
mkdir -p ${gcRootsDir}
|
||||||
|
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
chown ${user}:${hydraGroup} ${baseDir}/www
|
chown ${user}:${hydraGroup} ${baseDir}/www
|
||||||
chown ${hydraUser}:${hydraGroup} ${gcRootsDir}
|
chown ${hydraUser}:${hydraGroup} ${gcRootsDir}
|
||||||
''}
|
''}
|
||||||
|
|
||||||
chmod 2775 ${gcRootsDir}
|
chmod 2775 ${gcRootsDir}
|
||||||
|
|
||||||
${stdenv.lib.optionalString (postgresqlDBMS != null) ''
|
${lib.optionalString (postgresqlDBMS != null) ''
|
||||||
if [ ! -e ${baseDir}/.db-created ]
|
if [ ! -e ${baseDir}/.db-created ]
|
||||||
then
|
then
|
||||||
count=1
|
count=1
|
||||||
|
@ -70,9 +70,9 @@ createManagedProcess {
|
||||||
((count++))
|
((count++))
|
||||||
done
|
done
|
||||||
|
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) "su ${postgresqlDBMS.postgresqlUsername} -c '"}createuser ${hydraUser}${stdenv.lib.optionalString (!forceDisableUserChange) "'"}
|
${lib.optionalString (!forceDisableUserChange) "su ${postgresqlDBMS.postgresqlUsername} -c '"}createuser ${hydraUser}${lib.optionalString (!forceDisableUserChange) "'"}
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) "su ${postgresqlDBMS.postgresqlUsername} -c '"}createdb -O ${hydraUser} ${hydraDatabase}${stdenv.lib.optionalString (!forceDisableUserChange) "'"}
|
${lib.optionalString (!forceDisableUserChange) "su ${postgresqlDBMS.postgresqlUsername} -c '"}createdb -O ${hydraUser} ${hydraDatabase}${lib.optionalString (!forceDisableUserChange) "'"}
|
||||||
echo "create extension if not exists pg_trgm" | ${stdenv.lib.optionalString (!forceDisableUserChange) "su ${postgresqlDBMS.postgresqlUsername} -c '"}psql ${hydraDatabase}${stdenv.lib.optionalString (!forceDisableUserChange) "'"}
|
echo "create extension if not exists pg_trgm" | ${lib.optionalString (!forceDisableUserChange) "su ${postgresqlDBMS.postgresqlUsername} -c '"}psql ${hydraDatabase}${lib.optionalString (!forceDisableUserChange) "'"}
|
||||||
touch ${baseDir}/.db-created
|
touch ${baseDir}/.db-created
|
||||||
fi
|
fi
|
||||||
''}
|
''}
|
||||||
|
@ -86,7 +86,7 @@ createManagedProcess {
|
||||||
inherit baseDir dbi hydraDatabase hydraUser;
|
inherit baseDir dbi hydraDatabase hydraUser;
|
||||||
};
|
};
|
||||||
|
|
||||||
dependencies = [ nix-daemon.pkg ] ++ stdenv.lib.optional (postgresqlDBMS != null) postgresqlDBMS.pkg;
|
dependencies = [ nix-daemon.pkg ] ++ lib.optional (postgresqlDBMS != null) postgresqlDBMS.pkg;
|
||||||
|
|
||||||
credentials = {
|
credentials = {
|
||||||
groups = {
|
groups = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, writeTextFile, mongodb, runtimeDir, stateDir, forceDisableUserChange}:
|
{createManagedProcess, lib, writeTextFile, mongodb, runtimeDir, stateDir, forceDisableUserChange}:
|
||||||
|
|
||||||
{ instanceSuffix ? ""
|
{ instanceSuffix ? ""
|
||||||
, instanceName ? "mongodb${instanceSuffix}"
|
, instanceName ? "mongodb${instanceSuffix}"
|
||||||
|
@ -27,7 +27,7 @@ import ./default.nix {
|
||||||
};
|
};
|
||||||
initialize = ''
|
initialize = ''
|
||||||
mkdir -p ${mongodbDir}
|
mkdir -p ${mongodbDir}
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
chown ${user}:${group} ${mongodbDir}
|
chown ${user}:${group} ${mongodbDir}
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, mysql, stateDir, runtimeDir, forceDisableUserChange}:
|
{createManagedProcess, lib, mysql, stateDir, runtimeDir, forceDisableUserChange}:
|
||||||
|
|
||||||
{ port ? 3306
|
{ port ? 3306
|
||||||
, instanceSuffix ? ""
|
, instanceSuffix ? ""
|
||||||
|
@ -32,7 +32,7 @@ createManagedProcess {
|
||||||
mkdir -m0700 -p ${dataDir}
|
mkdir -m0700 -p ${dataDir}
|
||||||
mkdir -m0700 -p ${instanceRuntimeDir}
|
mkdir -m0700 -p ${instanceRuntimeDir}
|
||||||
|
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
chown ${user}:${group} ${dataDir}
|
chown ${user}:${group} ${dataDir}
|
||||||
chown ${user}:${group} ${instanceRuntimeDir}
|
chown ${user}:${group} ${instanceRuntimeDir}
|
||||||
''}
|
''}
|
||||||
|
@ -45,7 +45,7 @@ createManagedProcess {
|
||||||
|
|
||||||
foregroundProcess = "${mysql}/bin/mysqld";
|
foregroundProcess = "${mysql}/bin/mysqld";
|
||||||
foregroundProcessArgs = [ "--basedir" mysql "--datadir" dataDir "--port" port "--socket" "${instanceRuntimeDir}/mysqld.sock" ]
|
foregroundProcessArgs = [ "--basedir" mysql "--datadir" dataDir "--port" port "--socket" "${instanceRuntimeDir}/mysqld.sock" ]
|
||||||
++ stdenv.lib.optionals (!forceDisableUserChange) [ "--user" user ];
|
++ lib.optionals (!forceDisableUserChange) [ "--user" user ];
|
||||||
|
|
||||||
credentials = {
|
credentials = {
|
||||||
groups = {
|
groups = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, nginx, stateDir, runtimeDir, cacheDir, forceDisableUserChange}:
|
{createManagedProcess, lib, nginx, stateDir, runtimeDir, cacheDir, forceDisableUserChange}:
|
||||||
|
|
||||||
{ configFile
|
{ configFile
|
||||||
, dependencies ? []
|
, dependencies ? []
|
||||||
|
@ -20,7 +20,7 @@ createManagedProcess {
|
||||||
initialize = ''
|
initialize = ''
|
||||||
mkdir -p ${nginxLogDir}
|
mkdir -p ${nginxLogDir}
|
||||||
mkdir -p ${nginxCacheDir}
|
mkdir -p ${nginxCacheDir}
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
chown ${user}:${group} ${nginxLogDir}
|
chown ${user}:${group} ${nginxLogDir}
|
||||||
chown ${user}:${group} ${nginxCacheDir}
|
chown ${user}:${group} ${nginxCacheDir}
|
||||||
''}
|
''}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, writeTextFile, nginx, runtimeDir, stateDir, cacheDir, forceDisableUserChange}:
|
{createManagedProcess, stdenv, lib, writeTextFile, nginx, runtimeDir, stateDir, cacheDir, forceDisableUserChange}:
|
||||||
|
|
||||||
{ port ? 80
|
{ port ? 80
|
||||||
, webapps ? []
|
, webapps ? []
|
||||||
|
@ -17,7 +17,7 @@ let
|
||||||
nginxCacheDir = "${cacheDir}/${instanceName}";
|
nginxCacheDir = "${cacheDir}/${instanceName}";
|
||||||
in
|
in
|
||||||
import ./default.nix {
|
import ./default.nix {
|
||||||
inherit createManagedProcess stdenv nginx stateDir forceDisableUserChange runtimeDir cacheDir;
|
inherit createManagedProcess lib nginx stateDir forceDisableUserChange runtimeDir cacheDir;
|
||||||
} {
|
} {
|
||||||
inherit instanceName;
|
inherit instanceName;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import ./default.nix {
|
||||||
pid ${runtimeDir}/${instanceName}.pid;
|
pid ${runtimeDir}/${instanceName}.pid;
|
||||||
error_log ${nginxLogDir}/error.log;
|
error_log ${nginxLogDir}/error.log;
|
||||||
|
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
user ${user} ${group};
|
user ${user} ${group};
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
@ -48,13 +48,13 @@ import ./default.nix {
|
||||||
uwsgi_temp_path ${nginxCacheDir}/uwsgi;
|
uwsgi_temp_path ${nginxCacheDir}/uwsgi;
|
||||||
scgi_temp_path ${nginxCacheDir}/scgi;
|
scgi_temp_path ${nginxCacheDir}/scgi;
|
||||||
|
|
||||||
${stdenv.lib.concatMapStrings (dependency: ''
|
${lib.concatMapStrings (dependency: ''
|
||||||
upstream webapp${toString dependency.port} {
|
upstream webapp${toString dependency.port} {
|
||||||
server localhost:${toString dependency.port};
|
server localhost:${toString dependency.port};
|
||||||
}
|
}
|
||||||
'') webapps}
|
'') webapps}
|
||||||
|
|
||||||
${stdenv.lib.concatMapStrings (paramName:
|
${lib.concatMapStrings (paramName:
|
||||||
let
|
let
|
||||||
dependency = builtins.getAttr paramName interDependencies;
|
dependency = builtins.getAttr paramName interDependencies;
|
||||||
in
|
in
|
||||||
|
@ -75,7 +75,7 @@ import ./default.nix {
|
||||||
root ${./errorpage};
|
root ${./errorpage};
|
||||||
}
|
}
|
||||||
|
|
||||||
${stdenv.lib.concatMapStrings (dependency: ''
|
${lib.concatMapStrings (dependency: ''
|
||||||
server {
|
server {
|
||||||
listen ${toString port};
|
listen ${toString port};
|
||||||
server_name ${dependency.dnsName};
|
server_name ${dependency.dnsName};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, writeTextFile, nginx, runtimeDir, stateDir, cacheDir, forceDisableUserChange}:
|
{createManagedProcess, stdenv, lib, writeTextFile, nginx, runtimeDir, stateDir, cacheDir, forceDisableUserChange}:
|
||||||
|
|
||||||
{ port ? 80
|
{ port ? 80
|
||||||
, webapps ? []
|
, webapps ? []
|
||||||
|
@ -20,7 +20,7 @@ let
|
||||||
dependencies = webapps ++ (builtins.attrValues interDependencies);
|
dependencies = webapps ++ (builtins.attrValues interDependencies);
|
||||||
in
|
in
|
||||||
import ./default.nix {
|
import ./default.nix {
|
||||||
inherit createManagedProcess stdenv nginx stateDir forceDisableUserChange runtimeDir cacheDir;
|
inherit createManagedProcess lib nginx stateDir forceDisableUserChange runtimeDir cacheDir;
|
||||||
} {
|
} {
|
||||||
inherit instanceName;
|
inherit instanceName;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ import ./default.nix {
|
||||||
pid ${runtimeDir}/${instanceName}.pid;
|
pid ${runtimeDir}/${instanceName}.pid;
|
||||||
error_log ${nginxLogDir}/error.log;
|
error_log ${nginxLogDir}/error.log;
|
||||||
|
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
user ${user} ${group};
|
user ${user} ${group};
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
@ -51,20 +51,20 @@ import ./default.nix {
|
||||||
uwsgi_temp_path ${nginxCacheDir}/uwsgi;
|
uwsgi_temp_path ${nginxCacheDir}/uwsgi;
|
||||||
scgi_temp_path ${nginxCacheDir}/scgi;
|
scgi_temp_path ${nginxCacheDir}/scgi;
|
||||||
|
|
||||||
${stdenv.lib.optionalString enableCache ''
|
${lib.optionalString enableCache ''
|
||||||
${stdenv.lib.concatMapStrings (dependency:
|
${lib.concatMapStrings (dependency:
|
||||||
''
|
''
|
||||||
proxy_cache_path ${nginxCacheDir}/${dependency.name} keys_zone=${dependency.name}:8m inactive=5m max_size=128m;
|
proxy_cache_path ${nginxCacheDir}/${dependency.name} keys_zone=${dependency.name}:8m inactive=5m max_size=128m;
|
||||||
''
|
''
|
||||||
) dependencies}
|
) dependencies}
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${stdenv.lib.concatMapStrings (dependency:
|
${lib.concatMapStrings (dependency:
|
||||||
''
|
''
|
||||||
upstream ${dependency.name} {
|
upstream ${dependency.name} {
|
||||||
ip_hash;
|
ip_hash;
|
||||||
${if dependency ? targets
|
${if dependency ? targets
|
||||||
then stdenv.lib.concatMapStrings (target: "server ${target.properties.hostname}:${toString dependency.port};\n") dependency.targets
|
then lib.concatMapStrings (target: "server ${target.properties.hostname}:${toString dependency.port};\n") dependency.targets
|
||||||
else "server localhost:${dependency.port};\n"
|
else "server localhost:${dependency.port};\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,11 +72,11 @@ import ./default.nix {
|
||||||
) dependencies}
|
) dependencies}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
${stdenv.lib.concatMapStrings (dependency:
|
${lib.concatMapStrings (dependency:
|
||||||
''
|
''
|
||||||
location ${dependency.baseURL} {
|
location ${dependency.baseURL} {
|
||||||
proxy_pass http://${dependency.name};
|
proxy_pass http://${dependency.name};
|
||||||
${stdenv.lib.optionalString enableCache ''
|
${lib.optionalString enableCache ''
|
||||||
proxy_cache ${dependency.name};
|
proxy_cache ${dependency.name};
|
||||||
proxy_cache_key $host$uri$is_args$args;
|
proxy_cache_key $host$uri$is_args$args;
|
||||||
proxy_cache_valid 200 5m;
|
proxy_cache_valid 200 5m;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{createManagedProcess, writeTextFile, openssh, stateDir, runtimeDir, tmpDir, forceDisableUserChange}:
|
{createManagedProcess, writeTextFile, openssh, stateDir, runtimeDir, tmpDir, forceDisableUserChange}:
|
||||||
|
|
||||||
{ instanceSuffix ? ""
|
{ instanceSuffix ? ""
|
||||||
, instanceName ? "sshd${instanceSuffix}"
|
, instanceName ? "openssh${instanceSuffix}"
|
||||||
, port ? 22
|
, port ? 22
|
||||||
, extraSSHDConfig ? ""
|
, extraSSHDConfig ? ""
|
||||||
}:
|
}:
|
||||||
|
@ -17,6 +17,9 @@ let
|
||||||
HostKey ${sshdStateDir}/ssh_host_ed25519_key
|
HostKey ${sshdStateDir}/ssh_host_ed25519_key
|
||||||
|
|
||||||
PidFile ${if forceDisableUserChange then tmpDir else runtimeDir}/${instanceName}.pid
|
PidFile ${if forceDisableUserChange then tmpDir else runtimeDir}/${instanceName}.pid
|
||||||
|
|
||||||
|
Subsystem sftp ${openssh}/libexec/sftp-server
|
||||||
|
|
||||||
${extraSSHDConfig}
|
${extraSSHDConfig}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, postgresql, su, stateDir, runtimeDir, forceDisableUserChange}:
|
{createManagedProcess, lib, postgresql, su, stateDir, runtimeDir, forceDisableUserChange}:
|
||||||
|
|
||||||
{ port ? 5432
|
{ port ? 5432
|
||||||
, instanceSuffix ? ""
|
, instanceSuffix ? ""
|
||||||
|
@ -23,17 +23,17 @@ createManagedProcess rec {
|
||||||
mkdir -m0755 -p ${socketDir}
|
mkdir -m0755 -p ${socketDir}
|
||||||
mkdir -m0700 -p ${dataDir}
|
mkdir -m0700 -p ${dataDir}
|
||||||
|
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
chown ${user}:${group} ${socketDir}
|
chown ${user}:${group} ${socketDir}
|
||||||
chown ${user}:${group} ${dataDir}
|
chown ${user}:${group} ${dataDir}
|
||||||
''}
|
''}
|
||||||
|
|
||||||
if [ ! -e "${dataDir}/PG_VERSION" ]
|
if [ ! -e "${dataDir}/PG_VERSION" ]
|
||||||
then
|
then
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) "su ${user} -c '"}${postgresql}/bin/initdb -D ${dataDir} --no-locale${stdenv.lib.optionalString (!forceDisableUserChange) "'"}
|
${lib.optionalString (!forceDisableUserChange) "su ${user} -c '"}${postgresql}/bin/initdb -D ${dataDir} --no-locale${lib.optionalString (!forceDisableUserChange) "'"}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${stdenv.lib.optionalString (configFile != null) ''
|
${lib.optionalString (configFile != null) ''
|
||||||
ln -sfn ${configFile} ${dataDir}/postgresql.conf
|
ln -sfn ${configFile} ${dataDir}/postgresql.conf
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, writeTextFile, postgresql, su, stateDir, runtimeDir, forceDisableUserChange}:
|
{createManagedProcess, lib, writeTextFile, postgresql, su, stateDir, runtimeDir, forceDisableUserChange}:
|
||||||
|
|
||||||
{ port ? 5432
|
{ port ? 5432
|
||||||
, instanceSuffix ? ""
|
, instanceSuffix ? ""
|
||||||
|
@ -31,26 +31,26 @@ let
|
||||||
toConfigValue = value:
|
toConfigValue = value:
|
||||||
if true == value then "yes"
|
if true == value then "yes"
|
||||||
else if false == value then "no"
|
else if false == value then "no"
|
||||||
else if builtins.isString value then "'${stdenv.lib.replaceStrings ["'"] ["''"] value}'"
|
else if builtins.isString value then "'${lib.replaceStrings ["'"] ["''"] value}'"
|
||||||
else toString value;
|
else toString value;
|
||||||
in
|
in
|
||||||
import ./default.nix {
|
import ./default.nix {
|
||||||
inherit createManagedProcess stdenv postgresql su stateDir runtimeDir forceDisableUserChange;
|
inherit createManagedProcess lib postgresql su stateDir runtimeDir forceDisableUserChange;
|
||||||
} {
|
} {
|
||||||
inherit port instanceSuffix instanceName postInstall;
|
inherit port instanceSuffix instanceName postInstall;
|
||||||
configFile = writeTextFile {
|
configFile = writeTextFile {
|
||||||
name = "";
|
name = "";
|
||||||
text =
|
text =
|
||||||
stdenv.lib.optionalString (authentication != null) ''
|
lib.optionalString (authentication != null) ''
|
||||||
hba_file = '${hbaFile}'
|
hba_file = '${hbaFile}'
|
||||||
''
|
''
|
||||||
+ stdenv.lib.optionalString (identMap != null) ''
|
+ lib.optionalString (identMap != null) ''
|
||||||
ident_file = '${identFile}'
|
ident_file = '${identFile}'
|
||||||
''
|
''
|
||||||
+ ''
|
+ ''
|
||||||
listen_addresses = '${if enableTCPIP then "*" else "localhost"}'
|
listen_addresses = '${if enableTCPIP then "*" else "localhost"}'
|
||||||
''
|
''
|
||||||
+ stdenv.lib.concatMapStrings (name:
|
+ lib.concatMapStrings (name:
|
||||||
let
|
let
|
||||||
value = builtins.getAttr name settings;
|
value = builtins.getAttr name settings;
|
||||||
in
|
in
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{createManagedProcess, stdenv, subversion, runtimeDir, forceDisableUserChange}:
|
{createManagedProcess, lib, subversion, runtimeDir, forceDisableUserChange}:
|
||||||
|
|
||||||
{ instanceSuffix ? ""
|
{ instanceSuffix ? ""
|
||||||
, instanceName ? "svnserve${instanceSuffix}"
|
, instanceName ? "svnserve${instanceSuffix}"
|
||||||
|
@ -16,7 +16,7 @@ createManagedProcess {
|
||||||
inherit instanceName postInstall;
|
inherit instanceName postInstall;
|
||||||
initialize = ''
|
initialize = ''
|
||||||
mkdir -p ${svnBaseDir}
|
mkdir -p ${svnBaseDir}
|
||||||
${stdenv.lib.optionalString (!forceDisableUserChange) ''
|
${lib.optionalString (!forceDisableUserChange) ''
|
||||||
chgrp ${svnGroup} ${svnBaseDir}
|
chgrp ${svnGroup} ${svnBaseDir}
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in New Issue