feat(sterni/machines): prevent deploy if hostname doesn't match
Change-Id: I5a850e0d98069483e89d90022b624feba60ceebc Reviewed-on: https://cl.tvl.fyi/c/depot/+/10179 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
6a5faac11d
commit
77b990b0b2
1 changed files with 5 additions and 1 deletions
|
@ -10,9 +10,13 @@ let
|
|||
(lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./.));
|
||||
|
||||
# TODO(sterni): share code with rebuild-system
|
||||
localDeployScriptFor = { system, ... }:
|
||||
localDeployScriptFor = { system, config, ... }:
|
||||
pkgs.writeShellScript "local-deploy-${system.name}" ''
|
||||
set -eu
|
||||
if [[ "$(hostname)" != "${config.networking.hostName}" ]]; then
|
||||
echo "$0: unexpected hostname: $(hostname). Are you deploying on the right machine?"
|
||||
exit 1
|
||||
fi
|
||||
nix-env -p /nix/var/nix/profiles/system --set "${system}"
|
||||
"${system}/bin/switch-to-configuration" switch
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue