add check for shodan to not switch but instead just boot rebuild (and added just boot command), and added a check to see if pre-commit file is empty before adding the test hook for this repo

This commit is contained in:
Lillian Violet 2025-07-24 12:18:24 +02:00
parent 33f0eec366
commit 1114f237f6
2 changed files with 21 additions and 2 deletions

View file

@ -1,6 +1,9 @@
build:
sudo echo "sudo check..." && sudo nixos-rebuild --log-format internal-json -v switch --flake .# --show-trace |& nom --json
boot:
sudo echo "sudo check..." && sudo nixos-rebuild --log-format internal-json -v boot --flake .# --show-trace |& nom --json
run:
nix-repl -f flake:nixpkgs
@ -15,7 +18,19 @@ clean:
sudo nix-store --optimise
setup:
#!/run/current-system/sw/bin/bash -e
if [ -s ./.git/hooks/pre-commit ]; then
read -p $"This file already contains the following text:
$(<./.git/hooks/pre-commit)
Do you want to add the test hook (y/N)? (This will NOT delete data)" choice
case "$choice" in
y|Y ) echo "just test" >> ./.git/hooks/pre-commit && chmod +x ./.git/hooks/pre-commit && echo "Added test hook to pre-commit.";;
* ) echo "No test added to pre-commit.";;
esac
else
echo "just test" >> ./.git/hooks/pre-commit && chmod +x ./.git/hooks/pre-commit
fi
push:
git pull

View file

@ -18,7 +18,11 @@ writeShellApplication
git clone https://codeberg.org/Lillian-Violet/NixOS-Config.git ./rebuild
pushd ./rebuild > /dev/null
echo "NixOS Rebuilding..."
if ["''$HOSTNAME" = shodan]; then
just boot
else
just build
fi
popd > /dev/null
echo "Cleaning up repository in '/tmp/rebuild'..."
rm -rf ./rebuild