From f4062956807a0a9703de166ac4a160a7aca1133c Mon Sep 17 00:00:00 2001 From: Roman Melnikov Date: Thu, 11 May 2023 11:58:02 +0800 Subject: [#210] Add activation script for darwin system and provide a usage example Problem: It's possible to use 'deploy-rs' for deploying 'darwinSystem' configuration from 'nix-darwin' to a darwin system. However, there is no dedicated activatiot script for darwin and thus one has to come up with 'custom' activation script. Solution: 1) Add 'darwin' attribute to 'lib.activate' that provides a script that should be used to activate 'darwinSystem' config with 'deploy-rs'. 2) Add a new 'examples/darwin' example that provides simple flake for deploying configuration to a darwin target. --- flake.nix | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 9b8e6eb..0616cf8 100644 --- a/flake.nix +++ b/flake.nix @@ -106,6 +106,13 @@ home-manager = base: custom base.activationPackage "$PROFILE/activate"; + # Activation script for 'darwinSystem' from nix-darwin. + # 'HOME=/var/root' is needed because 'sudo' on darwin doesn't change 'HOME' directory, + # while 'darwin-rebuild' (which is invoked under the hood) performs some nix-channel + # checks that rely on 'HOME'. As a result, if 'sshUser' is different from root, + # deployment may fail without explicit 'HOME' redefinition. + darwin = base: custom base.config.system.build.toplevel "HOME=/var/root $PROFILE/activate"; + noop = base: custom base ":"; }; -- cgit v1.2.3