who needs temporary files and tee and whatever when you can have BASH SCRIPTS :3
This commit is contained in:
parent
87c2e38720
commit
361dd6dc67
4 changed files with 22 additions and 31 deletions
27
justfile
27
justfile
|
@ -5,17 +5,7 @@ check:
|
|||
nix flake check
|
||||
|
||||
switch *args:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
configuration=$(sudo nixos-rebuild dry-activate --flake . --keep-going {{args}})
|
||||
echo $configuration
|
||||
read -n1 -p "Activate new configuration? [y/N] " answer
|
||||
if [[ $answer =~ ^[Yy]$ ]]; then
|
||||
sudo "$configuration/bin/switch-to-configuration" switch
|
||||
else
|
||||
echo "Not activating :("
|
||||
exit 1
|
||||
fi
|
||||
bash switch.sh {{args}}
|
||||
|
||||
rollback:
|
||||
sudo nixos-rebuild switch --rollback
|
||||
|
@ -27,21 +17,8 @@ deploy system user="leo":
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
flake=$(nix eval --impure --raw --expr "(builtins.getFlake \"git+file://$PWD\").outPath")
|
||||
sshout=$(mktemp)
|
||||
|
||||
nix copy "$flake" --to "ssh://{{user}}@{{system}}"
|
||||
ssh -t "{{user}}@{{system}}" "sudo nixos-rebuild dry-activate --flake $flake --keep-going" | tee "$sshout"
|
||||
configuration=$(tail -n1 "$sshout" | grep -Po "/nix/store/[\w\d\.\-]+")
|
||||
echo "$configuration"
|
||||
rm "$sshout"
|
||||
|
||||
read -n1 -p "Activate new configuration? [y/N] " answer
|
||||
if [[ $answer =~ ^[Yy]$ ]]; then
|
||||
ssh -t "{{user}}@{{system}}" "sudo \"$configuration/bin/switch-to-configuration\" switch"
|
||||
else
|
||||
echo "Not activating :("
|
||||
exit 1
|
||||
fi
|
||||
ssh -t "{{user}}@{{system}}" "bash $flake/switch.sh"
|
||||
|
||||
lint *args:
|
||||
statix check -i flake.nix **/hardware-configuration.nix {{args}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue