Compare commits

...

10 Commits

Author SHA1 Message Date
Emery Hemingway b4302c3fe8 WiP! Synit support 2023-11-24 19:13:04 +02:00
Sander van der Burg 0e9ec77cc6 Fix test function to work with Nixpkgs 23.05 2023-09-20 18:36:07 +02:00
Sander van der Burg cc90d87001 Make help pages a somewhat prettier by not displaying absolute paths to the executable 2023-09-19 01:22:27 +02:00
Sander van der Burg f0dab5bcef Fix tests work with the NixOS 23.05 test driver, fix translation step of managed-process units, fix s6-rc deployments in Docker containers 2023-09-19 00:49:28 +02:00
Sander van der Burg 78ba5f6b1f Fix supervisor package reference 2022-05-31 18:43:34 +02:00
Sander van der Burg 84bca56fa2 Replace deprecated pathsInNixDB property 2022-03-05 14:55:46 +01:00
Sander van der Burg 90c4cddb62 Fix broken systemd process manager bootstrap 2022-03-05 13:01:22 +01:00
Sander van der Burg b476741b92 Make the activation check for systemd user daemon more robust 2022-03-04 20:36:48 +01:00
Sander van der Burg 6f264ccb43 Fix problem with hanging test step 2022-03-03 20:41:32 +01:00
Sander van der Burg d47fa62293 Fix tests as an unprivileged user 2022-03-03 19:15:28 +01:00
63 changed files with 754 additions and 136 deletions

View File

@ -34,6 +34,7 @@ Currently, the following process managers are supported:
* `cygrunsrv`: Cygwin's [cygrunsrv](http://web.mit.edu/cygwin/cygwin_v1.3.2/usr/doc/Cygwin/cygrunsrv.README)
* `s6-rc`: [s6-rc](https://skarnet.org/software/s6-rc) for managing services
supervised by [s6](https://skarnet.org/software/s6)
* `synit`: [Synit](https://synit.org/)
It can also work with the following solutions that are technically not
categorized as process managers (but can still be used as such):

View File

@ -28,13 +28,13 @@ in
supervisord = import ./supervisord {
inherit createManagedProcess runtimeDir logDir;
inherit (pkgs.pythonPackages) supervisor;
inherit (pkgs.python3Packages) supervisor;
};
extendableSupervisord = import ./supervisord/extendable.nix {
inherit createManagedProcess libDir runtimeDir logDir;
inherit (pkgs) writeTextFile;
inherit (pkgs.pythonPackages) supervisor;
inherit (pkgs.python3Packages) supervisor;
};
docker = import ./docker {

View File

@ -17,7 +17,7 @@ in
services.disnix.enable = true;
services.openssh.enable = true;
networking.firewall.enable = false;
environment.systemPackages = [ pkgs.pythonPackages.supervisor nixproc-generate-config ];
environment.systemPackages = [ pkgs.python3Packages.supervisor nixproc-generate-config ];
};
test2 = {pkgs, ...}:
@ -36,6 +36,6 @@ in
services.disnix.enable = true;
services.openssh.enable = true;
networking.firewall.enable = false;
environment.systemPackages = [ pkgs.pythonPackages.supervisor nixproc-generate-config ];
environment.systemPackages = [ pkgs.python3Packages.supervisor nixproc-generate-config ];
};
}

View File

@ -20,7 +20,7 @@ in
pkgs.disnix
];
pathsInNixDB = [ processesEnvSystem ];
additionalPaths = [ processesEnvSystem ];
deployProcessManager = "";

View File

@ -36,7 +36,7 @@ in
pkgs.docker
];
pathsInNixDB = [ processesEnvProcessManager processesEnvSystem ];
additionalPaths = [ processesEnvProcessManager processesEnvSystem ];
deployProcessManager = ''
machine.succeed(

View File

@ -25,7 +25,7 @@ in
pkgs.s6-rc
];
pathsInNixDB = [ processesEnvProcessManager processesEnvSystem ];
additionalPaths = [ processesEnvProcessManager processesEnvSystem ];
deployProcessManager = ''
machine.succeed(

View File

@ -1,8 +1,8 @@
{pkgs, common, input, result}:
result // {
contents = result.contents or [] ++ [ pkgs.pythonPackages.supervisor ];
contents = result.contents or [] ++ [ pkgs.python3Packages.supervisor ];
config = result.config or {} // {
Cmd = [ "${pkgs.pythonPackages.supervisor}/bin/supervisord" "--nodaemon" "--configuration" "/etc/supervisor/supervisord.conf" "--logfile" "/var/log/supervisord.log" "--pidfile" "/var/run/supervisord.pid" ];
Cmd = [ "${pkgs.python3Packages.supervisor}/bin/supervisord" "--nodaemon" "--configuration" "/etc/supervisor/supervisord.conf" "--logfile" "/var/log/supervisord.log" "--pidfile" "/var/run/supervisord.pid" ];
};
}

View File

@ -22,10 +22,10 @@ in
systemPackages = [
tools.sysvinit
tools.supervisord
pkgs.pythonPackages.supervisor
pkgs.python3Packages.supervisor
];
pathsInNixDB = [ processesEnvProcessManager processesEnvSystem ];
additionalPaths = [ processesEnvProcessManager processesEnvSystem ];
deployProcessManager = ''
machine.succeed(

View File

@ -0,0 +1,37 @@
{ pkgs ? import <nixpkgs> { inherit system; }
, system ? builtins.currentSystem
, stateDir ? "/var"
, runtimeDir ? "${stateDir}/run"
, logDir ? "${stateDir}/log"
, cacheDir ? "${stateDir}/cache"
, spoolDir ? "${stateDir}/spool"
, lockDir ? "${stateDir}/lock"
, libDir ? "${stateDir}/lib"
, tmpDir ? (if stateDir == "/var" then "/tmp" else "${stateDir}/tmp")
, forceDisableUserChange ? false
, callingUser ? null
, callingGroup ? null
, extraParams ? {}
, exprFile ? null
}@args:
let
processesFun = import exprFile;
processesFormalArgs = builtins.functionArgs processesFun;
processesArgs = builtins.intersectAttrs processesFormalArgs (args // {
processManager = "synit";
} // extraParams);
processes = if exprFile == null then {} else processesFun processesArgs;
in
pkgs.buildEnv {
name = "synit";
paths = map (processName:
let
process = builtins.getAttr processName processes;
in
process.pkg
) (builtins.attrNames processes);
}

View File

@ -0,0 +1,30 @@
{ stdenv, lib, execline, writeTextFile }:
{ name, description, initialize, daemon, daemonArgs, instanceName, pidFile
, foregroundProcess, foregroundProcessArgs, path, environment, directory, umask
, nice, user, dependencies, credentials, overrides, postInstall }:
let
util = import ../util { inherit lib; };
generator = import ./preserves-generator.nix { inherit lib; };
toPreserves = generator.toPreserves { };
escapeArgs = args:
lib.concatMapStringsSep " "
(arg: ''"${lib.replaceStrings [ ''"'' ] [ ''\"'' ] (toString arg)}"'') args;
processSpec = {
argv = "${daemon} ${toString daemonArgs}";
env = environment;
} // (lib.attrsets.optionalAttrs (directory != null) { dir = directory; });
in writeTextFile {
name = "services-${name}";
destination = "/services/${name}.pr";
text = ''
<metadata <daemon ${name}> { description: "${description}" }>
<require-service <daemon ${name}>>
<daemon ${name} ${toPreserves processSpec}>
'';
}

View File

@ -0,0 +1,52 @@
{ lib }:
let inherit (lib) isAttrs isBool isFunction isList;
in rec {
/* Generates text-encoded Preserves from an arbitrary value.
Records are generated for lists with a final element in
the form of `{ record = «label»; }`.
Type: toPreserves :: a -> string
Example:
toPreserves { } [{ a = 0; b = 1; } "c" [ true false ] { record = "foo"; }]
=> "<foo { a: 0 b: 1 } \"c\" [ #t #f ]>"
*/
toPreserves = { }@args:
let
toPreserves' = toPreserves args;
concatItems = toString;
recordLabel = list:
with builtins;
let len = length list;
in if len == 0 then
null
else
let end = elemAt list (len - 1);
in if (isAttrs end) && (attrNames end) == [ "record" ] then
end
else
null;
in v:
if isAttrs v then
"{ ${
concatItems
(lib.attrsets.mapAttrsToList (key: val: "${key}: ${toPreserves' val}")
v)
} }"
else if isList v then
let label = recordLabel v;
in if label == null then
"[ ${concatItems (map toPreserves' v)} ]"
else
"<${label.record} ${concatItems (map toPreserves' (lib.lists.init v))}>"
else if isBool v then
(if v then "#t" else "#f")
else if isFunction v then
abort "generators.toPreserves: cannot convert a function to Preserves"
else if isNull v then
"null"
else
builtins.toJSON v;
}

View File

@ -23,13 +23,14 @@ in
tools.systemd
];
pathsInNixDB = [ processesEnvSystem ];
additionalPaths = [ processesEnvSystem ];
deployProcessManager = ''
machine.succeed("mkdir -p /etc/systemd-mutable/system")
'' + pkgs.lib.optionalString profileSettings.params.forceDisableUserChange ''
machine.wait_for_unit("display-manager.service")
machine.wait_until_succeeds("pgrep -f 'systemd --user'")
machine.wait_for_file("/run/user/1000/systemd")
'';
deploySystem = ''

View File

@ -18,7 +18,7 @@ in
tools.sysvinit
];
pathsInNixDB = [ processesEnvSystem ];
additionalPaths = [ processesEnvSystem ];
deployProcessManager = "";

View File

@ -12,7 +12,7 @@ result // {
ln -s ../run /var/run
# Always create nobody/nogroup
groupadd -g 65534 -r nogroup
useradd -u 65534 -r nobody -g nogroup -d /dev/null
groupadd -g 999 -r nogroup
useradd -u 999 -r nobody -g nogroup -d /dev/null
'';
}

View File

@ -2,8 +2,6 @@
result // {
runAsRoot = result.runAsRoot or "" + ''
${pkgs.gnused}/bin/sed -i -e "s/CREATE_MAIL_SPOOL=yes/CREATE_MAIL_SPOOL=no/" /etc/default/useradd
mkdir -p /etc/pam.d
cat > /etc/pam.d/su <<EOF
account required pam_unix.so
@ -15,6 +13,20 @@ result // {
EOF
sed -i -e "s|PATH=/bin:/usr/bin|PATH=/bin:/usr/bin:/nix/var/nix/profiles/default/bin|" /etc/login.defs
cat > /etc/nsswitch.conf <<EOF
passwd: files
group: files [success=merge]
shadow: files
hosts: mymachines files myhostname dns
networks: files
ethers: files
services: files
protocols: files
rpc: files
EOF
'';
contents = result.contents or [] ++ [ pkgs.su pkgs.shadow ];

View File

@ -17,9 +17,22 @@ let
inherit pkgs stateDir runtimeDir logDir tmpDir forceDisableUserChange processManager;
};
properties = builtins.fromJSON (builtins.readFile configFile);
configFileString = builtins.readFile configFile;
normalizedProperties = properties // pkgs.lib.optionalAttrs (properties ? dependencies) {
properties = builtins.fromJSON (builtins.unsafeDiscardStringContext configFileString);
# This attribute is a hack. It readds the dependencies of the JSON file as context to a frequently used string property so that the generated configuration artifact retains the runtime dependencies of the original JSON file.
# This hack is needed because builtins.fromJSON can't work with strings that have context.
propertiesWithContext = properties // pkgs.lib.optionalAttrs (properties ? process) {
process = pkgs.lib.addContextFrom configFileString properties.process;
} // pkgs.lib.optionalAttrs (properties ? foregroundProcess) {
foregroundProcess = pkgs.lib.addContextFrom configFileString properties.foregroundProcess;
} // pkgs.lib.optionalAttrs (properties ? daemon) {
daemon = pkgs.lib.addContextFrom configFileString properties.daemon;
};
normalizedProperties = propertiesWithContext // pkgs.lib.optionalAttrs (properties ? dependencies) {
dependencies = map (dependency: createManagedProcessFromConfig "${dependency}/${builtins.substring 33 (builtins.stringLength dependency) (baseNameOf dependency)}.json") properties.dependencies;
};
in

View File

@ -41,7 +41,7 @@ let
createSupervisordProgram = import ../../backends/supervisord/create-supervisord-program.nix {
inherit (pkgs) writeTextFile stdenv lib;
inherit (pkgs.pythonPackages) supervisor;
inherit (pkgs.python3Packages) supervisor;
inherit createCredentials basePackages forceDisableUserChange runtimeDir;
};
@ -113,6 +113,11 @@ let
inherit (pkgs) stdenv writeTextFile lib execline s6;
inherit s6-rc basePackages tmpDir runtimeDir forceDisableUserChange;
};
generateSynitService = import ../../backends/synit/generate-synit-service.nix {
inherit (pkgs) stdenv lib execline writeTextFile;
};
in
import ../agnostic/create-managed-process.nix {
inherit processManager;
@ -128,5 +133,6 @@ import ../agnostic/create-managed-process.nix {
supervisord = generateSupervisordProgram;
systemd = generateSystemdService;
sysvinit = generateSystemVInitScript;
synit = generateSynitService;
};
}

View File

@ -11,7 +11,7 @@ let
inherit pkgs system;
};
testSystemVariantForProcessManager = {processManager, profileSettings, exprFile, extraParams ? {}, nixosConfig ? null, systemPackages ? [], initialTests ? null, readiness ? null, tests ? null, postTests ? null}:
testSystemVariantForProcessManager = {name, processManager, profileSettings, exprFile, extraParams ? {}, nixosConfig ? null, systemPackages ? [], initialTests ? null, readiness ? null, tests ? null, postTests ? null}:
let
processManagerModule = builtins.getAttr processManager processManagerModules;
@ -31,7 +31,9 @@ let
with import "${nixpkgs}/nixos/lib/testing-python.nix" { inherit system; };
makeTest {
machine =
inherit name;
nodes.machine =
{pkgs, lib, ...}:
{
@ -40,7 +42,7 @@ let
++ processManagerSettings.nixosModules
++ lib.optional (nixosConfig != null) nixosConfig;
virtualisation.pathsInNixDB = processManagerSettings.pathsInNixDB;
virtualisation.additionalPaths = processManagerSettings.additionalPaths;
nix.extraOptions = ''
substitute = false
@ -77,13 +79,14 @@ let
let
instance = builtins.getAttr instanceName processes;
in
tests ({ inherit instanceName instance; } // processManagerSettings.params)
tests ({ inherit instanceName instance processManager; } // processManagerSettings.params)
) (builtins.attrNames processes))
+ pkgs.lib.optionalString (postTests != null) (postTests (processManagerSettings.params // { inherit processes; }));
};
in
{ processManagers
{ name
, processManagers
, profiles
, exprFile
, extraParams ? {}
@ -102,7 +105,7 @@ pkgs.lib.genAttrs profiles (profile:
in
pkgs.lib.genAttrs processManagers (processManager:
testSystemVariantForProcessManager {
inherit processManager profileSettings exprFile extraParams nixosConfig systemPackages initialTests readiness tests postTests;
inherit name processManager profileSettings exprFile extraParams nixosConfig systemPackages initialTests readiness tests postTests;
}
)
)

View File

@ -28,13 +28,15 @@ let
env = "NIX_PATH=nixpkgs=${nixpkgs} SYSTEMD_TARGET_DIR=/etc/systemd-mutable/system";
in
makeTest {
machine =
name = "multi-process-images";
nodes.machine =
{pkgs, ...}:
{
virtualisation.pathsInNixDB = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [ dockerProcessEnv ];
virtualisation.additionalPaths = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [ dockerProcessEnv ];
virtualisation.writableStore = true;
virtualisation.diskSize = 4096;
virtualisation.diskSize = 8192;
virtualisation.memorySize = 8192;
dysnomia = {
@ -57,7 +59,7 @@ makeTest {
# Deploy Docker as a systemd unit
machine.succeed(
"${env} nixproc-systemd-switch ${nix-processmgmt}/tests/processes-docker.nix"
"${env} nixproc-systemd-switch ${nix-processmgmt}/nixproc/backends/docker/test-module/processes-docker.nix"
)
machine.wait_for_unit("nix-process-docker")

View File

@ -1,6 +1,7 @@
{ pkgs, testService, processManagers, profiles }:
testService {
name = "docker";
exprFile = ./processes.nix;
systemPackages = [ pkgs.docker ];

View File

@ -1,6 +1,7 @@
{ pkgs, testService, processManagers, profiles }:
testService {
name = "nginx-reverse-proxy-hostbased";
exprFile = ./processes.nix;
readiness = {instanceName, instance, ...}:

View File

@ -41,6 +41,7 @@ let
};
in
testService {
name = "s6-svscan";
exprFile = ./processes.nix;
systemPackages = [ pkgs.s6-rc ];

View File

@ -26,8 +26,9 @@ let
};
in
testService {
name = "supervisord";
exprFile = ./processes.nix;
systemPackages = [ pkgs.pythonPackages.supervisor ];
systemPackages = [ pkgs.python3Packages.supervisor ];
readiness = {instanceName, instance, ...}:
''

View File

@ -22,11 +22,13 @@ let
env = "NIX_PATH=nixpkgs=${nixpkgs}";
in
makeTest {
machine =
name = "webapps-agnostic-config";
nodes.machine =
{pkgs, ...}:
{
virtualisation.pathsInNixDB = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
virtualisation.additionalPaths = [ pkgs.stdenv pkgs.stdenvNoCC ] ++ pkgs.coreutils.all ++ [
webappUnprivilegedAutoModeConfig
webappUnprivilegedAutoModeSysvinit
];

View File

@ -49,11 +49,20 @@ let
env = "NIX_PATH=nixpkgs=${nixpkgs} DISNIX_DATA_DIR=${disnixDataDir}";
in
makeTest {
machine =
name = "webapps-agnostic-disnix";
nodes.machine =
{pkgs, ...}:
{
virtualisation.pathsInNixDB = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [ processesEnvForeground processesEnvDaemon processesEnvAuto processesEnvAdvanced processesEnvNoUserChange processesEnvEmpty ];
virtualisation.additionalPaths = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
processesEnvForeground
processesEnvDaemon
processesEnvAuto
processesEnvAdvanced
processesEnvNoUserChange
processesEnvEmpty
];
virtualisation.writableStore = true;
virtualisation.memorySize = 1024;
@ -65,6 +74,7 @@ makeTest {
description = "Unprivileged user";
home = "/home/unprivileged";
createHome = true;
isNormalUser = true;
};
};

View File

@ -7,7 +7,6 @@ let
dockerProcessEnv = import ../nixproc/backends/systemd/build-systemd-env.nix {
exprFile = ../nixproc/backends/docker/test-module/processes-docker.nix;
inherit stateDir;
};
processesEnvForeground = import ../nixproc/backends/docker/build-docker-env.nix {
@ -56,15 +55,27 @@ let
env = "NIX_PATH=nixpkgs=${nixpkgs} SYSTEMD_TARGET_DIR=/etc/systemd-mutable/system";
in
makeTest {
machine =
name = "webapps-agnostic-docker";
nodes.machine =
{pkgs, ...}:
{
virtualisation.pathsInNixDB = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [ dockerProcessEnv processesEnvForeground processesEnvDaemon processesEnvAuto processesEnvAdvanced processesEnvUnprivileged processesEnvEmpty ];
virtualisation.additionalPaths = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
dockerProcessEnv
processesEnvForeground
processesEnvDaemon
processesEnvAuto
processesEnvAdvanced
processesEnvUnprivileged
processesEnvEmpty
];
virtualisation.writableStore = true;
virtualisation.memorySize = 8192;
virtualisation.diskSize = 4096;
boot.extraSystemdUnitPaths = [ "/etc/systemd-mutable/system" ];
# We can't download any substitutes in a test environment. To make tests
# faster, we disable substitutes so that Nix does not waste any time by
# attempting to download them.

View File

@ -45,11 +45,13 @@ let
env = "NIX_PATH=nixpkgs=${nixpkgs} SYSTEMD_TARGET_DIR=/etc/systemd-mutable/system";
in
makeTest {
machine =
name = "webapps-agnostic-s6-rc";
nodes.machine =
{pkgs, ...}:
{
virtualisation.pathsInNixDB = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
virtualisation.additionalPaths = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
s6-svscanProcessEnv
processesEnvForeground
processesEnvDaemon
@ -62,6 +64,8 @@ makeTest {
virtualisation.writableStore = true;
virtualisation.memorySize = 1024;
boot.extraSystemdUnitPaths = [ "/etc/systemd-mutable/system" ];
# We can't download any substitutes in a test environment. To make tests
# faster, we disable substitutes so that Nix does not waste any time by
# attempting to download them.

View File

@ -14,11 +14,13 @@ let
env = "NIX_PATH=nixpkgs=${nixpkgs}";
in
makeTest {
machine =
name = "webapps-agnostic-supervisord-stateless";
nodes.machine =
{pkgs, ...}:
{
virtualisation.pathsInNixDB = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [ processesEnvAuto ];
virtualisation.additionalPaths = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [ processesEnvAuto ];
virtualisation.writableStore = true;
virtualisation.memorySize = 1024;
@ -31,7 +33,8 @@ makeTest {
environment.systemPackages = [
pkgs.stdenv
pkgs.pythonPackages.supervisor
pkgs.daemon
pkgs.python3Packages.supervisor
pkgs.dysnomia
tools.common
tools.systemd
@ -51,7 +54,7 @@ makeTest {
# Deploy the advanced example with multiple instances and see if it works
machine.succeed(
"${env} nixproc-supervisord-deploy-stateless ${nix-processmgmt}/examples/webapps-agnostic/processes.nix &"
"${env} daemon --inherit --unsafe -- nixproc-supervisord-deploy-stateless ${nix-processmgmt}/examples/webapps-agnostic/processes.nix"
)
machine.wait_for_open_port(9001)

View File

@ -45,11 +45,13 @@ let
env = "NIX_PATH=nixpkgs=${nixpkgs} SYSTEMD_TARGET_DIR=/etc/systemd-mutable/system SUPERVISORD_CONF_DIR=/var/lib/supervisord";
in
makeTest {
machine =
name = "webapps-agnostic-supervisord";
nodes.machine =
{pkgs, ...}:
{
virtualisation.pathsInNixDB = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
virtualisation.additionalPaths = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
supervisordProcessEnv
processesEnvForeground
processesEnvDaemon
@ -62,6 +64,8 @@ makeTest {
virtualisation.writableStore = true;
virtualisation.memorySize = 1024;
boot.extraSystemdUnitPaths = [ "/etc/systemd-mutable/system" ];
# We can't download any substitutes in a test environment. To make tests
# faster, we disable substitutes so that Nix does not waste any time by
# attempting to download them.
@ -71,7 +75,7 @@ makeTest {
environment.systemPackages = [
pkgs.stdenv
pkgs.pythonPackages.supervisor
pkgs.python3Packages.supervisor
pkgs.dysnomia
tools.common
tools.systemd

View File

@ -22,11 +22,13 @@ let
env = "NIX_PATH=nixpkgs=${nixpkgs} XDG_RUNTIME_DIR=/run/user/1000";
in
makeTest {
machine =
name = "webapps-agnostic-systemd-user";
nodes.machine =
{pkgs, lib, ...}:
{
virtualisation.pathsInNixDB = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [ processesEnvAuto processesEnvEmpty ];
virtualisation.additionalPaths = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [ processesEnvAuto processesEnvEmpty ];
virtualisation.writableStore = true;
virtualisation.memorySize = 1024;
@ -100,6 +102,7 @@ makeTest {
start_all()
machine.wait_for_unit("display-manager.service")
machine.wait_until_succeeds("pgrep -f 'systemd --user'")
machine.wait_for_file("/run/user/1000/systemd")
# Do an undeploy to force the state to get initialized
machine.succeed(

View File

@ -25,6 +25,11 @@ let
exprFile = ../examples/webapps-agnostic/processes-advanced.nix;
};
processesEnvUnprivileged = import ../nixproc/backends/systemd/build-systemd-env.nix {
exprFile = ../examples/webapps-agnostic/processes.nix;
forceDisableUserChange = true;
};
processesEnvEmpty = import ../nixproc/backends/systemd/build-systemd-env.nix {
exprFile = null;
};
@ -36,11 +41,20 @@ let
env = "NIX_PATH=nixpkgs=${nixpkgs} SYSTEMD_TARGET_DIR=/etc/systemd-mutable/system";
in
makeTest {
machine =
name = "webapps-agnostic-systemd";
nodes.machine =
{pkgs, ...}:
{
virtualisation.pathsInNixDB = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [ processesEnvForeground processesEnvDaemon processesEnvAuto processesEnvAdvanced processesEnvEmpty ];
virtualisation.additionalPaths = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
processesEnvForeground
processesEnvDaemon
processesEnvAuto
processesEnvAdvanced
processesEnvUnprivileged
processesEnvEmpty
];
virtualisation.writableStore = true;
virtualisation.memorySize = 1024;

View File

@ -61,11 +61,13 @@ let
env = "NIX_PATH=nixpkgs=${nixpkgs}";
in
makeTest {
machine =
name = "webapps-agnostic-sysvinit";
nodes.machine =
{pkgs, ...}:
{
virtualisation.pathsInNixDB = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
virtualisation.additionalPaths = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
webappUnprivilegedForegroundMode
webappUnprivilegedDaemonMode
webappUnprivilegedAutoMode
@ -87,6 +89,7 @@ makeTest {
description = "Unprivileged user";
home = "/home/unprivileged";
createHome = true;
isNormalUser = true;
};
};

View File

@ -45,11 +45,13 @@ let
env = "NIX_PATH=nixpkgs=${nixpkgs}";
in
makeTest {
machine =
name = "webapps-sysvinit";
nodes.machine =
{pkgs, ...}:
{
virtualisation.pathsInNixDB = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
virtualisation.additionalPaths = [ pkgs.stdenv ] ++ pkgs.coreutils.all ++ [
webappUnprivileged
processesEnv
processesEnvUnprivileged
@ -69,6 +71,7 @@ makeTest {
description = "Unprivileged user";
home = "/home/unprivileged";
createHome = true;
isNormalUser = true;
};
};

View File

@ -6,8 +6,10 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
Usage: $me [OPTION] PATH
Deploys a prebuilt sysvinit configuration profile.

View File

@ -6,8 +6,10 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] ACTIVITY [PATH]
Usage: $me [OPTION] ACTIVITY [PATH]
This command runs a deployment activity on all BSD rc scripts in a Nix profile.
The scripts are traversed in the right dependency order.

View File

@ -6,14 +6,16 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] [PATH]
or: $0 --undeploy [OPTION]
or: $0 --rollback [OPTION]
or: $0 --switch-generation NUM [OPTION]
or: $0 --list-generations [OPTION]
or: $0 --delete-generations NUM [OPTION]
or: $0 --delete-all-generations NUM [OPTION]
Usage: $me [OPTION] [PATH]
or: $me --undeploy [OPTION]
or: $me --rollback [OPTION]
or: $me --switch-generation NUM [OPTION]
or: $me --list-generations [OPTION]
or: $me --delete-generations NUM [OPTION]
or: $me --delete-all-generations NUM [OPTION]
This command starts all BSD rc scripts in the provided Nix profile and
optionally deactivates all obsolete sysvinit scripts in the previous Nix

View File

@ -4,9 +4,11 @@
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] [PATH]
or: $0 --undeploy [OPTION]
Usage: $me [OPTION] [PATH]
or: $me --undeploy [OPTION]
This command builds a Nix profile containing multiple sysvinit scripts, and
their start and stop symlinks.

View File

@ -4,8 +4,10 @@
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION]
Usage: $me [OPTION]
Initializes the common state directories so that processes can be managed
properly.

View File

@ -4,8 +4,10 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
Usage: $me [OPTION] PATH
Deploys a prebuilt cygrunsrv configuration profile.

View File

@ -4,14 +4,16 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] [PATH]
or: $0 --undeploy [OPTION]
or: $0 --rollback [OPTION]
or: $0 --switch-generation NUM [OPTION]
or: $0 --list-generations [OPTION]
or: $0 --delete-generations NUM [OPTION]
or: $0 --delete-all-generations NUM [OPTION]
Usage: $me [OPTION] [PATH]
or: $me --undeploy [OPTION]
or: $me --rollback [OPTION]
or: $me --switch-generation NUM [OPTION]
or: $me --list-generations [OPTION]
or: $me --delete-generations NUM [OPTION]
or: $me --delete-all-generations NUM [OPTION]
This command updates the Windows services configuration so that obsolete
services will be stoppped and new services will be started.

View File

@ -47,6 +47,10 @@ rec {
inherit (pkgs) stdenv getopt;
};
synit = import ./synit {
inherit (pkgs) stdenv getopt;
};
systemd = import ./systemd {
inherit (pkgs) stdenv getopt;
};

View File

@ -4,8 +4,10 @@
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
Usage: $me [OPTION] PATH
Deploys a prebuilt Disnix manifest file meant for process management.

View File

@ -2,14 +2,16 @@
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] [PATH]
or: $0 --undeploy [OPTION]
or: $0 --rollback [OPTION]
or: $0 --switch-generation NUM [OPTION]
or: $0 --list-generations [OPTION]
or: $0 --delete-generations NUM [OPTION]
or: $0 --delete-all-generations NUM [OPTION]
Usage: $me [OPTION] [PATH]
or: $me --undeploy [OPTION]
or: $me --rollback [OPTION]
or: $me --switch-generation NUM [OPTION]
or: $me --list-generations [OPTION]
or: $me --delete-generations NUM [OPTION]
or: $me --delete-all-generations NUM [OPTION]
This command uses Disnix's deployment facilities to deploy a set of running
processes taking the process dependencies into account for activating and

View File

@ -4,8 +4,10 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
Usage: $me [OPTION] PATH
Deploys a prebuilt Docker configuration profile.

View File

@ -4,14 +4,16 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] [PATH]
or: $0 --undeploy [OPTION]
or: $0 --rollback [OPTION]
or: $0 --switch-generation NUM [OPTION]
or: $0 --list-generations [OPTION]
or: $0 --delete-generations NUM [OPTION]
or: $0 --delete-all-generations NUM [OPTION]
Usage: $me [OPTION] [PATH]
or: $me --undeploy [OPTION]
or: $me --rollback [OPTION]
or: $me --switch-generation NUM [OPTION]
or: $me --list-generations [OPTION]
or: $me --delete-generations NUM [OPTION]
or: $me --delete-all-generations NUM [OPTION]
This command repopulates a folder with systemd configuration files and updates
the configuration so that obsolete services will be stoppped and new services

View File

@ -4,8 +4,10 @@
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] -P MANAGER PATH
Usage: $me [OPTION] -P MANAGER PATH
Takes a JSON representation of a managed process configuration and translates
it to a process manager specific configuration.

View File

@ -4,11 +4,13 @@
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Assigns unique IDs to process instances based on their ID requirements and ID
resources configuration.
Usage: $0 [OPTION] --id-resources id_resources_nix [PATH]
Usage: $me [OPTION] --id-resources id_resources_nix [PATH]
Options:
--id-resources=id_resources_nix

View File

@ -4,8 +4,10 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
Usage: $me [OPTION] PATH
Deploys a prebuilt launchd configuration profile.

View File

@ -4,14 +4,16 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
or: $0 --undeploy [OPTION]
or: $0 --rollback [OPTION]
or: $0 --switch-generation NUM [OPTION]
or: $0 --list-generations [OPTION]
or: $0 --delete-generations NUM [OPTION]
or: $0 --delete-all-generations NUM [OPTION]
Usage: $me [OPTION] PATH
or: $me --undeploy [OPTION]
or: $me --rollback [OPTION]
or: $me --switch-generation NUM [OPTION]
or: $me --list-generations [OPTION]
or: $me --delete-generations NUM [OPTION]
or: $me --delete-all-generations NUM [OPTION]
This command repopulates a folder with launchd plist files and updates the
configuration so that obsolete services will be stoppped and new services will

View File

@ -4,8 +4,10 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
Usage: $me [OPTION] PATH
Deploys a prebuilt s6-rc configuration profile. It requires an already running
s6-svscan service.

View File

@ -4,14 +4,16 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
or: $0 --undeploy [OPTION]
or: $0 --rollback [OPTION]
or: $0 --switch-generation NUM [OPTION]
or: $0 --list-generations [OPTION]
or: $0 --delete-generations NUM [OPTION]
or: $0 --delete-all-generations NUM [OPTION]
Usage: $me [OPTION] PATH
or: $me --undeploy [OPTION]
or: $me --rollback [OPTION]
or: $me --switch-generation NUM [OPTION]
or: $me --list-generations [OPTION]
or: $me --delete-generations NUM [OPTION]
or: $me --delete-all-generations NUM [OPTION]
This command repopulates a folder with systemd configuration files and updates
the configuration so that obsolete services will be stoppped and new services

View File

@ -4,8 +4,10 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION]
Usage: $me [OPTION]
Starts the s6-svscan service for supervising process trees.

View File

@ -2,8 +2,10 @@
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
Usage: $me [OPTION] PATH
This command starts supervisord with a provided configuration and set of
services in foreground mode. When the configuration changes, supervisord and all

View File

@ -4,8 +4,10 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
Usage: $me [OPTION] PATH
Deploys a prebuilt systemd configuration profile.

View File

@ -4,14 +4,16 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
or: $0 --undeploy [OPTION]
or: $0 --rollback [OPTION]
or: $0 --switch-generation NUM [OPTION]
or: $0 --list-generations [OPTION]
or: $0 --delete-generations NUM [OPTION]
or: $0 --delete-all-generations NUM [OPTION]
Usage: $me [OPTION] PATH
or: $me --undeploy [OPTION]
or: $me --rollback [OPTION]
or: $me --switch-generation NUM [OPTION]
or: $me --list-generations [OPTION]
or: $me --delete-generations NUM [OPTION]
or: $me --delete-all-generations NUM [OPTION]
This command repopulates the conf.d sub directory of a supervisord configuration
and updates the live configuration so that obsolete services will be stopped and

20
tools/synit/default.nix Normal file
View File

@ -0,0 +1,20 @@
{ stdenv, getopt }:
stdenv.mkDerivation {
name = "nixproc-synit-tools";
buildCommand = ''
mkdir -p $out/bin
sed -e "s|/bin/bash|$SHELL|" \
-e "s|@getopt@|${getopt}/bin/getopt|" \
-e "s|@commonchecks@|${../commonchecks}|" \
${./nixproc-synit-switch.in} > $out/bin/nixproc-synit-switch
chmod +x $out/bin/nixproc-synit-switch
sed -e "s|/bin/bash|$SHELL|" \
-e "s|@getopt@|${getopt}/bin/getopt|" \
-e "s|@commonchecks@|${../commonchecks}|" \
${./nixproc-synit-deploy.in} > $out/bin/nixproc-synit-deploy
chmod +x $out/bin/nixproc-synit-deploy
'';
}

View File

@ -0,0 +1,132 @@
#!/bin/bash -e
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $me [OPTION] PATH
Deploys a prebuilt Synit configuration profile.
Options:
-p, --profile=NAME Name of the Nix profile that stores the sysvinit scripts
(defaults to: processes)
-o, --old-profile=PATH
Path to the previously deployed Nix profile (by default,
it gets auto detected)
--state-dir Changes the directory in which the state of the
processes are stored
--runtime-dir Changes the directory in which the PID files are stored
--log-dir Changes the directory in which the log files are stored
--tmp-dir Changes the directory in which temp files are stored
--cache-dir Changes the directory in which cache files are stored
--spool-dir Changes the directory in which spool files are stored
--lock-dir Changes the directory in which lock files are stored
--lib-dir Changes the directory in which state files are stored
--force-disable-user-change
Forces to not create users, groups or change user
permissions
--runlevel=LEVEL Specifies which runlevel to activate (defaults to the
runlevel of the system)
-h, --help Shows the usage of this command
Environment:
NIX_STATE_DIR Overrides the location of the Nix state directory
NIXPROC_STATE_DIR Changes the directory in which the state of the
processes is stored
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
NIXPROC_LOG_DIR Changes the directory in which log files are stored
NIXPROC_TMP_DIR Changes the directory in which temp files are stored
NIXPROC_CACHE_DIR Changes the directory in which cache files are stored
NIXPROC_SPOOL_DIR Changes the directory in which spool files are stored
NIXPROC_LOCK_DIR Changes the directory in which lock files are stored
NIXPROC_LIB_DIR Changes the directory in which state files are stored
NIXPROC_FORCE_DISABLE_USER_CHANGE
Forces to not create users, groups or change user
permissions
EOF
}
# Parse valid argument options
PARAMS=`@getopt@ -n $0 -o p:o:h -l profile:,old-profile:,state-dir:,runtime-dir:,log-dir:,tmp-dir:,cache-dir:,spool-dir:,lock-dir:,lib-dir:,force-disable-user-change,runlevel:,help -- "$@"`
if [ $? != 0 ]
then
showUsage
exit 1
fi
# Evaluate valid options
eval set -- "$PARAMS"
while [ "$1" != "--" ]
do
case "$1" in
-p|--profile)
profile="$2"
;;
-o|--old-profile)
oldProfilePath="$2"
;;
--state-dir)
stateDirArg="--state-dir $2"
;;
--runtime-dir)
runtimeDirArg="--runtime-dir $2"
;;
--log-dir)
logDirArg="--log-dir $2"
;;
--tmp-dir)
tmpDirArg="--tmp-dir $2"
;;
--cache-dir)
cacheDirArg="--cache-dir $2"
;;
--spool-dir)
spoolDirArg="--spool-dir $2"
;;
--lock-dir)
lockDirArg="--lock-dir $2"
;;
--lib-dir)
libDirArg="--lib-dir $2"
;;
--force-disable-user-change)
forceDisableUserChangeArg="--force-disable-user-change"
;;
--runlevel)
runlevel="$2"
;;
-h|--help)
showUsage
exit 0
;;
esac
shift
done
shift
profilePath="$1"
# Validate the given options
source @commonchecks@
checkNixStateDir
checkProfile
composeOldProfilePath
# TODO
# Delete obsolete users and groups
deleteObsoleteUsers
deleteObsoleteGroups
# Set new profile
setNixProfile

View File

@ -0,0 +1,192 @@
#!/bin/bash
set -e
shopt -s nullglob
# Shows the usage of this command to the user
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $me [OPTION] [PATH]
or: $me --undeploy [OPTION]
or: $me --rollback [OPTION]
or: $me --switch-generation NUM [OPTION]
or: $me --list-generations [OPTION]
or: $me --delete-generations NUM [OPTION]
or: $me --delete-all-generations NUM [OPTION]
This command repopulates a folder with Synit configuration files and updates
the configuration so that obsolete services will be stoppped and new services
will be started.
If the provided path is a file then it is considered a Nix expression that
produces a Nix profile. If the provided path is a directory, then it is
considered a pre-built Nix profile.
Options:
--undeploy Undeploys all previously deployed processes
--rollback Rolls back to the previous deployment
--switch-generation=NUM
Switches to a previous deployment generation
--list-generations
Lists all profile generations of the current deployment
--delete-generations=NUM
Deletes the specified generations. The number can
correspond to generation numbers, days (d postfix) or
'old'.
--delete-all-generations
Deletes all profile generations. This is useful when a
deployment has been discarded
-p, --profile=NAME Name of the Nix profile that stores the sysvinit scripts
(defaults to: processes)
-o, --old-profile=PATH
Path to the previously deployed Nix profile (by default,
it gets auto detected)
--runlevel=LEVEL Specifies which runlevel to activate (defaults to the
runlevel of the system)
--state-dir Changes the directory in which the state of the
processes are stored
--runtime-dir Changes the directory in which the PID files are stored
--log-dir Changes the directory in which the log files are stored
--tmp-dir Changes the directory in which temp files are stored
--cache-dir Changes the directory in which cache files are stored
--spool-dir Changes the directory in which spool files are stored
--lock-dir Changes the directory in which lock files are stored
--lib-dir Changes the directory in which state files are stored
--force-disable-user-change
Forces to not create users, groups or change user
permissions
--show-trace Shows a trace of the output
--extra-params=PARAMS
A string with an attribute set in the Nix expression
language propagating extra parameters to the input models
-h, --help Shows the usage of this command
Environment:
NIX_STATE_DIR Overrides the location of the Nix state directory
NIXPROC_PROCESSES Path to a processes model
NIXPROC_STATE_DIR Changes the directory in which the state of the
processes is stored
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
NIXPROC_LOG_DIR Changes the directory in which log files are stored
NIXPROC_TMP_DIR Changes the directory in which temp files are stored
NIXPROC_CACHE_DIR Changes the directory in which cache files are stored
NIXPROC_SPOOL_DIR Changes the directory in which spool files are stored
NIXPROC_LOCK_DIR Changes the directory in which lock files are stored
NIXPROC_LIB_DIR Changes the directory in which state files are stored
NIXPROC_FORCE_DISABLE_USER_CHANGE
Forces to not create users, groups or change user
permissions
EOF
}
# Parse valid argument options
PARAMS=`@getopt@ -n $0 -o p:o:h -l undeploy,rollback,switch-generation:,list-generations,delete-generations:,delete-all-generations,profile:,old-profile:,state-dir:,runtime-dir:,log-dir:,tmp-dir:,cache-dir:,spool-dir:,lock-dir:,lib-dir:,force-disable-user-change,runlevel:,show-trace,extra-params:,help -- "$@"`
if [ $? != 0 ]
then
showUsage
exit 1
fi
# Evaluate valid options
eval set -- "$PARAMS"
while [ "$1" != "--" ]
do
case "$1" in
--undeploy)
undeploy=1
;;
--rollback)
operation="switchGenerations"
;;
--switch-to-generation)
operation="switchGenerations"
generationId=$2
;;
--list-generations)
operation="listGenerations"
;;
--delete-generations)
operation="deleteGenerations"
generations="$2"
;;
--delete-all-generations)
operation="deleteAllGenerations"
;;
-p|--profile)
profileArg="-p $2"
;;
-o|--old-profile)
oldProfileArg="-o $2"
;;
--state-dir)
stateDirArg="--state-dir $2"
;;
--runtime-dir)
runtimeDirArg="--runtime-dir $2"
;;
--log-dir)
logDirArg="--log-dir $2"
;;
--tmp-dir)
tmpDirArg="--tmp-dir $2"
;;
--cache-dir)
cacheDirArg="--cache-dir $2"
;;
--spool-dir)
spoolDirArg="--spool-dir $2"
;;
--lock-dir)
lockDirArg="--lock-dir $2"
;;
--lib-dir)
libDirArg="--lib-dir $2"
;;
--force-disable-user-change)
forceDisableUserChangeArg="--force-disable-user-change"
;;
--runlevel)
runlevel="$2"
runlevelArg="--runlevel $runlevel"
;;
--show-trace)
showTraceArg="--show-trace"
;;
--extra-params)
extraParamsArg=("--extra-params" "$2")
;;
-h|--help)
showUsage
exit 0
;;
esac
shift
done
shift
# Validate the given options
source @commonchecks@
checkProcessesFile "$1"
checkNixStateDir
checkProfile
composeProfileBaseDir
# Execute the deployment
deploy()
{
nixproc-synit-deploy $runlevelArg $profileArg $oldProfileArg $profilePath $stateDirArg $runtimeDirArg $logDirArg $tmpDirArg $cacheDirArg $spoolDirArg $lockDirArg $libDirArg $forceDisableUserChange
}
executeDeploymentOperation synit

View File

@ -4,8 +4,10 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
Usage: $me [OPTION] PATH
Deploys a prebuilt systemd configuration profile.

View File

@ -4,14 +4,16 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
or: $0 --undeploy [OPTION]
or: $0 --rollback [OPTION]
or: $0 --switch-generation NUM [OPTION]
or: $0 --list-generations [OPTION]
or: $0 --delete-generations NUM [OPTION]
or: $0 --delete-all-generations NUM [OPTION]
Usage: $me [OPTION] PATH
or: $me --undeploy [OPTION]
or: $me --rollback [OPTION]
or: $me --switch-generation NUM [OPTION]
or: $me --list-generations [OPTION]
or: $me --delete-generations NUM [OPTION]
or: $me --delete-all-generations NUM [OPTION]
This command repopulates a folder with systemd configuration files and updates
the configuration so that obsolete services will be stoppped and new services

View File

@ -4,8 +4,10 @@
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] PATH
Usage: $me [OPTION] PATH
Deploys a prebuilt sysvinit configuration profile.

View File

@ -6,8 +6,10 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] ACTIVITY [PATH]
Usage: $me [OPTION] ACTIVITY [PATH]
This command runs a deployment activity on all sysvinit scripts in a Nix
profile. The scripts are traversed in sequence order.

View File

@ -6,14 +6,16 @@ shopt -s nullglob
showUsage()
{
me="$(basename "$0")"
cat <<EOF
Usage: $0 [OPTION] [PATH]
or: $0 --undeploy [OPTION]
or: $0 --rollback [OPTION]
or: $0 --switch-generation NUM [OPTION]
or: $0 --list-generations [OPTION]
or: $0 --delete-generations NUM [OPTION]
or: $0 --delete-all-generations NUM [OPTION]
Usage: $me [OPTION] [PATH]
or: $me --undeploy [OPTION]
or: $me --rollback [OPTION]
or: $me --switch-generation NUM [OPTION]
or: $me --list-generations [OPTION]
or: $me --delete-generations NUM [OPTION]
or: $me --delete-all-generations NUM [OPTION]
This command starts all sysvinit scripts in the provided Nix profile and
optionally deactivates all obsolete sysvinit scripts in the previous Nix