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