119 current 2024-12-31 04:42:05 25.05.20241217.d3c42f1 6.6.66 *

This commit is contained in:
2024-12-31 04:42:12 -05:00
parent 69ed9b2d4d
commit b04b26c00d
10 changed files with 108 additions and 95 deletions

View File

@@ -4,13 +4,13 @@
set -e
# Edit your config
$EDITOR configuration.nix
# $EDITOR configuration.nix
# cd to your config dir
pushd ~/dotfiles/nixos/
pushd /home/synchronous/nix-cfg
# Early return if no changes were detected (thanks @singiamtel!)
if git diff --quiet '*.nix'; then
if git --git-dir /home/synchronous/nix-cfg/.git diff --quiet '*.nix'; then
echo "No changes detected, exiting."
popd
exit 0
@@ -21,18 +21,19 @@ alejandra . &>/dev/null \
|| ( alejandra . ; echo "formatting failed!" && exit 1)
# Shows your changes
git diff -U0 '*.nix'
git --git-dir /home/synchronous/nix-cfg/.git diff
# -U0 '*.nix'
echo "NixOS Rebuilding..."
# Rebuild, output simplified errors, log trackebacks
sudo nixos-rebuild switch &>nixos-switch.log || (cat nixos-switch.log | grep --color error && exit 1)
sudo nixos-rebuild switch --flake /home/synchronous/nix-cfg/flake.nix &>nixos-switch.log || (cat nixos-switch.log | grep --color error && exit 1)
# Get current generation metadata
current=$(nixos-rebuild list-generations | grep current)
# Commit all changes witih the generation metadata
git commit -am "$current"
git --git-dir /home/synchronous/nix-cfg/.git commit -am "$current"
# Back to where you were
popd