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. --- examples/darwin/flake.nix | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 examples/darwin/flake.nix (limited to 'examples/darwin/flake.nix') diff --git a/examples/darwin/flake.nix b/examples/darwin/flake.nix new file mode 100644 index 0000000..d5d7ae8 --- /dev/null +++ b/examples/darwin/flake.nix @@ -0,0 +1,39 @@ +{ + description = "Deploy simple 'darwinSystem' to a darwin machine"; + + inputs.deploy-rs.url = "github:serokell/deploy-rs"; + inputs.darwin.url = "github:LnL7/nix-darwin"; + + outputs = { self, nixpkgs, deploy-rs, darwin }: { + darwinConfigurations.example = darwin.lib.darwinSystem { + system = "x86_64-darwin"; + modules = [ + ({lib, config, pkgs, ...}: { + services.nix-daemon.enable = true; + nix = { + settings = { + trusted-users = [ "rvem" ]; + }; + extraOptions = '' + experimental-features = flakes nix-command + ''; + }; + # nix commands are added to PATH in the zsh config + programs.zsh.enable = true; + }) + ]; + }; + deploy = { + # remoteBuild = true; # Uncomment in case the system you're deploying from is not darwin + nodes.example = { + hostname = "localhost"; + profiles.system = { + user = "root"; + path = deploy-rs.lib.x86_64-darwin.activate.darwin self.darwinConfigurations.example; + }; + }; + }; + + checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; + }; +} -- cgit v1.2.3