mirror of
https://git.gay/xqtc/nixos-config
synced 2024-11-22 15:30:33 +01:00
Expanded justfile to cover testing and updates
This commit is contained in:
parent
b9e4385f0c
commit
c38b17ac75
27
justfile
27
justfile
|
@ -6,6 +6,7 @@ default:
|
|||
|
||||
rebuild:
|
||||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
HOSTNAME=$(hostname)
|
||||
if [ $HOSTNAME == "alastor" ]; then
|
||||
nh os switch . -- -vv --impure -j 4;
|
||||
|
@ -13,9 +14,9 @@ rebuild:
|
|||
fi
|
||||
nh os switch . -- -vv;
|
||||
|
||||
|
||||
beleth:
|
||||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
arch=$(nix-instantiate --eval -E 'builtins.currentSystem')
|
||||
arch_sanitized=$(echo $arch | sed 's/^"//;s/"$//')
|
||||
if [ $arch_sanitized == "x86_64-linux" ]; then
|
||||
|
@ -24,3 +25,27 @@ beleth:
|
|||
exit
|
||||
fi
|
||||
@echo "Host arch needs to be 'x86_64-linux'! Aborting...";
|
||||
|
||||
update:
|
||||
nix flake update
|
||||
|
||||
test target="":
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
target={{target}}
|
||||
configurations=$(nix flake show --json --all-systems --quiet | nix run nixpkgs#jq -- -r '.nixosConfigurations | keys[]')
|
||||
|
||||
if [ "$target" == "" ]; then
|
||||
nix flake check;
|
||||
exit
|
||||
fi
|
||||
|
||||
for config in $configurations; do
|
||||
if [ "$config" == "$target" ]; then
|
||||
nix build .#nixosConfigurations.{{target}}.config.system.build.toplevel --dry-run --quiet &> /dev/null
|
||||
echo "Target {{target}}'s configuration is valid!";
|
||||
exit
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Target '$target' does not exist in the NixOS configurations."
|
||||
|
|
Loading…
Reference in a new issue