From 1114f237f6659b8e1c04383c0a7425fafb544d63 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Thu, 24 Jul 2025 12:18:24 +0200 Subject: [PATCH] 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 --- justfile | 17 ++++++++++++++++- pkgs/rebuild-no-inhibit/default.nix | 6 +++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index 60f43e4..0406689 100644 --- a/justfile +++ b/justfile @@ -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: - echo "just test" >> ./.git/hooks/pre-commit && chmod +x ./.git/hooks/pre-commit + #!/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 diff --git a/pkgs/rebuild-no-inhibit/default.nix b/pkgs/rebuild-no-inhibit/default.nix index ab38581..f421342 100644 --- a/pkgs/rebuild-no-inhibit/default.nix +++ b/pkgs/rebuild-no-inhibit/default.nix @@ -18,7 +18,11 @@ writeShellApplication git clone https://codeberg.org/Lillian-Violet/NixOS-Config.git ./rebuild pushd ./rebuild > /dev/null echo "NixOS Rebuilding..." - just build + if ["''$HOSTNAME" = shodan]; then + just boot + else + just build + fi popd > /dev/null echo "Cleaning up repository in '/tmp/rebuild'..." rm -rf ./rebuild