mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
morph: add livecd-deploy
This commit is contained in:
parent
c8014ded7d
commit
00d7c22d34
1 changed files with 13 additions and 0 deletions
|
@ -79,6 +79,19 @@
|
|||
exec "${morph}/bin/morph" deploy ${morph-config} "$@"
|
||||
'';
|
||||
|
||||
livecd-deploy = sh ''
|
||||
config=".#nixosConfigurations.\"$1\".config"
|
||||
nix build "$config.system.build.toplevel" --out-link "$(mktemp -d)/result"
|
||||
sys="$(nix eval --raw "$config.system.build.toplevel")"
|
||||
ip="$(nix eval --raw "$config.sconfig.morph.deployment.targetHost")"
|
||||
nix copy --to ssh://root@$ip?remote-store=local?root=/mnt "$sys"
|
||||
ssh root@$ip nix-env --store /mnt -p /mnt/nix/var/nix/profiles/system --set "$sys"
|
||||
ssh root@$ip mkdir /mnt/etc
|
||||
ssh root@$ip touch /mnt/etc/NIXOS
|
||||
ssh root@$ip ln -sfn /proc/mounts /mnt/etc/mtab
|
||||
ssh root@$ip NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root /mnt -- /run/current-system/bin/switch-to-configuration boot
|
||||
'';
|
||||
|
||||
push = sh ''
|
||||
exec "${morph}/bin/morph" push ${morph-config} "$@"
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue