-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #213 from serokell/rvem/darwin-activation
[#210] Add activation script for darwin system and provide a usage example
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: 2023 Serokell <https://serokell.io/> | ||
SPDX-License-Identifier: MPL-2.0 | ||
--> | ||
|
||
# Example nix-darwin system deployment | ||
|
||
## Prerequisites | ||
|
||
1) Install `nix` and `nix-darwin` (the latter creates `/run` sets up `/etc/nix/nix.conf` symlink and so on) | ||
on the target machine. | ||
2) Enable remote login on the mac to allow ssh access. | ||
3) `deploy-rs` doesn't support password provisioning for `sudo`, so the `sshUser` should | ||
have passwordless `sudo` access. | ||
|
||
## Deploying | ||
|
||
Run `nix run github:serokell/deploy-rs -- --ssh-user <user>`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters