aboutsummaryrefslogtreecommitdiff
path: root/examples/darwin/flake.nix
blob: d5d7ae8cf323150bc17bcf207e5eefc87275aca3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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;
  };
}