mytools/nswitch
2024-11-11 02:31:05 +01:00

14 lines
460 B
Bash
Executable file

#!/usr/bin/env bash
# from https://github.com/0atman/noboilerplate/blob/main/scripts/38-nixos.md#dont-use-nix-env
# docstring=quick edit (or ling xD) for nixos config
set -E -o pipefail
cd ~/Projects/NixOS/
nvim
nix fmt . &>/dev/null
git diff -U0 *.nix
echo "NixOS Rebuilding..."
sudo nixos-rebuild switch &>nixos-switch.log || (
cat nixos-switch.log | grep --color error && false)
gen=$(nixos-rebuild list-generations | grep current)
git commit -am "$gen"