2024-11-12 00:39:15 +01:00
|
|
|
sudo nvim /etc/nixos/configuration.nix
|
2024-11-12 00:53:28 +01:00
|
|
|
sudo nixos-rebuild switch &>nixos-switch.log || (
|
2024-08-17 12:43:48 +02:00
|
|
|
cat nixos-switch.log | grep --color error && false)
|
|
|
|
gen=$(nixos-rebuild list-generations | grep current)
|
2024-11-12 00:50:33 +01:00
|
|
|
sudo cp /etc/nixos/configuration.nix ./nixos/configuration.nix
|
2024-08-17 12:43:48 +02:00
|
|
|
git add .
|
|
|
|
git commit -m "$gen"
|
2024-11-12 00:53:28 +01:00
|
|
|
if grep -q "error" nixos-switch.log; then
|
2024-08-17 12:55:49 +02:00
|
|
|
echo "There was an error in your Nix Config, please fix it before you push to git"
|
2024-08-17 12:58:47 +02:00
|
|
|
else
|
|
|
|
git push
|
2024-08-17 12:50:49 +02:00
|
|
|
fi
|
2024-08-17 12:43:48 +02:00
|
|
|
|