nix-processmgmt-services/example-deployments/services/processes.nix

121 lines
2.7 KiB
Nix
Raw Normal View History

2020-01-27 23:11:29 +00:00
{ pkgs ? import <nixpkgs> { inherit system; }
, system ? builtins.currentSystem
, stateDir ? "/var"
, runtimeDir ? "${stateDir}/run"
, logDir ? "${stateDir}/log"
2020-04-16 18:09:25 +00:00
, cacheDir ? "${stateDir}/cache"
2020-01-27 23:11:29 +00:00
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, processManager
2020-01-27 23:11:29 +00:00
}:
let
ids = if builtins.pathExists ./ids.nix then (import ./ids.nix).ids else {};
2021-02-17 23:14:36 +00:00
constructors = import ../../services-agnostic/constructors.nix {
inherit pkgs stateDir runtimeDir logDir tmpDir cacheDir forceDisableUserChange processManager ids;
2020-01-27 23:11:29 +00:00
};
in
rec {
apache = rec {
port = ids.httpPorts.apache or 0;
2020-01-27 23:11:29 +00:00
pkg = constructors.simpleWebappApache {
2020-01-27 23:11:29 +00:00
inherit port;
serverAdmin = "root@localhost";
2020-01-27 23:11:29 +00:00
};
requiresUniqueIdsFor = [ "httpPorts" "uids" "gids" ];
2020-01-27 23:11:29 +00:00
};
mysql = rec {
port = ids.mysqlPorts.mysql or 0;
2020-01-27 23:11:29 +00:00
pkg = constructors.mysql {
inherit port;
};
requiresUniqueIdsFor = [ "mysqlPorts" "uids" "gids" ];
2020-01-27 23:11:29 +00:00
};
postgresql = rec {
port = ids.postgresqlPorts.postgresql or 0;
2020-01-27 23:11:29 +00:00
pkg = constructors.postgresql {
inherit port;
};
requiresUniqueIdsFor = [ "postgresqlPorts" "uids" "gids" ];
2020-01-27 23:11:29 +00:00
};
tomcat = rec {
httpPort = ids.httpPorts.tomcat or 0;
httpsPort = ids.httpsPorts.tomcat or 0;
serverPort = ids.tomcatServerPorts.tomcat or 0;
ajpPort = ids.tomcatAJPPorts.tomcat or 0;
2020-01-27 23:11:29 +00:00
pkg = constructors.simpleAppservingTomcat {
inherit httpPort httpsPort serverPort ajpPort;
2020-01-27 23:11:29 +00:00
};
requiresUniqueIdsFor = [ "httpPorts" "httpsPorts" "tomcatServerPorts" "tomcatAJPPorts" "uids" "gids" ];
2020-01-27 23:11:29 +00:00
};
2020-04-16 18:09:25 +00:00
mongodb = rec {
port = ids.mongodbPorts.mongodb or 0;
pkg = constructors.simpleMongodb {
inherit port;
};
requiresUniqueIdsFor = [ "mongodbPorts" "uids" "gids" ];
2020-05-05 21:45:20 +00:00
};
supervisord = rec {
inetHTTPServerPort = ids.inetHTTPPorts.supervisord or 0;
pkg = constructors.extendableSupervisord {
inherit inetHTTPServerPort;
};
requiresUniqueIdsFor = [ "inetHTTPPorts" ];
2020-04-16 18:09:25 +00:00
};
svnserve = rec {
port = ids.svnPorts.svnserve or 0;
pkg = constructors.svnserve {
inherit port;
svnBaseDir = "/repos";
svnGroup = "root";
};
requiresUniqueIdsFor = [ "svnPorts" ];
2020-05-30 14:50:22 +00:00
};
influxdb = rec {
httpPort = ids.influxdbPorts.influxdb or 0;
rpcPort = httpPort + 2;
pkg = constructors.simpleInfluxdb {
inherit httpPort rpcPort;
};
requiresUniqueIdsFor = [ "influxdbPorts" "uids" "gids" ];
2020-05-30 14:50:22 +00:00
};
2020-07-08 21:13:14 +00:00
openssh = rec {
port = ids.sshPorts.openssh or 0;
2020-10-26 20:58:30 +00:00
pkg = constructors.openssh {
2020-10-26 20:58:30 +00:00
inherit port;
};
requiresUniqueIdsFor = [ "sshPorts" "uids" "gids" ];
};
2020-07-08 21:13:14 +00:00
docker = {
pkg = constructors.docker;
};
2020-01-27 23:11:29 +00:00
}