diff --git a/config.nix b/config.nix index 841ce4ab..1cccbb79 100644 --- a/config.nix +++ b/config.nix @@ -36,7 +36,7 @@ let pkgs.nox ]; - launchd.agents.activate-system = + launchd.daemons.activate-system = { serviceConfig.Program = "${config.system.build.activate}"; serviceConfig.RunAtLoad = true; }; @@ -144,7 +144,7 @@ let if [ -n "$__ETC_ZSHENV_SOURCED" ]; then return; fi export __ETC_ZSHENV_SOURCED=1 - export NIX_PATH=nixpkgs=$HOME/.nix-defexpr/nixpkgs:$NIX_PATH/.nix-defexpr/channels_root + export NIX_PATH=nixpkgs=$HOME/.nix-defexpr/nixpkgs:$HOME/.nix-defexpr/channels_root # Set up secure multi-user builds: non-root users build through the # Nix daemon. diff --git a/modules/launchd/default.nix b/modules/launchd/default.nix index 5d1fc699..b692e744 100644 --- a/modules/launchd/default.nix +++ b/modules/launchd/default.nix @@ -44,13 +44,33 @@ in launchd.agents = mkOption { default = {}; type = types.attrsOf (types.submodule serviceOptions); - description = "Definition of launchd agents."; + description = '' + Definition of per-user launchd agents. + + When a user logs in, a per-user launchd is started. + It does the following: + 1. It loads the parameters for each launch-on-demand user agent from the property list files found in /System/Library/LaunchAgents, /Library/LaunchAgents, and the user’s individual Library/LaunchAgents directory. + 2. It registers the sockets and file descriptors requested by those user agents. + 3. It launches any user agents that requested to be running all the time. + 4. As requests for a particular service arrive, it launches the corresponding user agent and passes the request to it. + 5. When the user logs out, it sends a SIGTERM signal to all of the user agents that it started. + ''; }; launchd.daemons = mkOption { default = {}; type = types.attrsOf (types.submodule serviceOptions); - description = "Definition of launchd daemons."; + description = '' + Definition of launchd daemons. + + After the system is booted and the kernel is running, launchd is run to finish the system initialization. + As part of that initialization, it goes through the following steps: + 1. It loads the parameters for each launch-on-demand system-level daemon from the property list files found in /System/Library/LaunchDaemons/ and /Library/LaunchDaemons/. + 2. It registers the sockets and file descriptors requested by those daemons. + 3. It launches any daemons that requested to be running all the time. + 4. As requests for a particular service arrive, it launches the corresponding daemon and passes the request to it. + 5. When the system shuts down, it sends a SIGTERM signal to all of the daemons that it started. + ''; }; }; diff --git a/modules/system/activation-scripts.nix b/modules/system/activation-scripts.nix index f32e1dee..fe3131d3 100644 --- a/modules/system/activation-scripts.nix +++ b/modules/system/activation-scripts.nix @@ -34,7 +34,7 @@ in config = { - system.build.activate = pkgs.writeText "activate-system" '' + system.build.activate = pkgs.writeScript "activate-system" '' #! ${pkgs.stdenv.shell} # Make this configuration the current configuration.