1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs synced 2024-10-19 03:47:13 -04:00
nixpkgs/nixos/modules
Eelco Dolstra 2b0aea1793 Allow running NixOS services outside of systemd
The attribute ‘config.systemd.services.<service-name>.runner’
generates a script that runs the service outside of systemd.  This is
useful for testing, and also allows NixOS services to be used outside
of NixOS.  For instance, given a configuration file foo.nix:

  { config, pkgs, ... }:

  { services.postgresql.enable = true;
    services.postgresql.package = pkgs.postgresql92;
    services.postgresql.dataDir = "/tmp/postgres";
  }

you can build and run PostgreSQL as follows:

  $ nix-build -A config.systemd.services.postgresql.runner -I nixos-config=./foo.nix
  $ ./result

This will run the service's ExecStartPre, ExecStart, ExecStartPost and
ExecStopPost commands in an appropriate environment.  It doesn't work
well yet for "forking" services, since it can't track the main
process.  It also doesn't work for services that assume they're always
executed by root.
2013-11-18 18:04:17 +01:00
..
config
hardware
installer
misc
profiles
programs
security
services Allow running NixOS services outside of systemd 2013-11-18 18:04:17 +01:00
system Check whether fileSystems defines the root FS 2013-11-18 18:04:16 +01:00
tasks Check whether fileSystems defines the root FS 2013-11-18 18:04:16 +01:00
testing Allow running NixOS services outside of systemd 2013-11-18 18:04:17 +01:00
virtualisation
module-list.nix Allow running NixOS services outside of systemd 2013-11-18 18:04:17 +01:00
rename.nix