Skip to content

Add support for deploying to a Mac (nix-darwin) #34

@srid

Description

@srid

I'd like the ability to deploy to a remote Mac machine (say, a Mac mini server) from another Mac machine (say, a Macbook). nixinate is currently hardcoded to deploy nixosConfigurations.foo using nixos-rebuild. To support macOS, we simply want to be able to deploy darwinConfigurations.foo using darwin-rebuild; everything else would more or less remain the same. Here's a demonstration of what this looks like without nixinate:

      apps.aarch64-darwin.deploy-macmini = {
        type = "app";
        program =
          let
            host = "user@192.52.31.40";
            machine = "myhost";
            pkgs = inputs.nixpkgs.legacyPackages.aarch64-darwin;
          in
          (pkgs.writeShellApplication {
            name = "deploy-to-mac";
            text = ''
              set -x
              nix copy ${self} --to ssh://${host}
              ssh -t ${host} "darwin-rebuild switch --flake ${self}#${machine}"
            '';
          }) + "/bin/deploy-to-mac";
      };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions