mirror of
https://git.gay/xqtc/nixos-config
synced 2024-11-23 14:40:32 +01:00
70 lines
2 KiB
Makefile
70 lines
2 KiB
Makefile
beleth-host := "root@88.99.90.90"
|
|
beleth-user-host:= "xqtc@88.99.90.90"
|
|
|
|
default:
|
|
@just --choose
|
|
|
|
rebuild:
|
|
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
HOSTNAME=$(hostname)
|
|
if [ $HOSTNAME == "alastor" ]; then
|
|
nh os switch . -- -vv --impure -j 4;
|
|
exit
|
|
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
|
|
nixos-rebuild switch --flake '.#beleth' --build-host {{beleth-host}} --target-host {{beleth-host}};
|
|
ssh {{beleth-user-host}} "cd nixos-config && git pull && cd && sh build_website.sh";
|
|
ssh {{beleth-user-host}} "cd && cd /var/www/cheats-rs/ && git pull && zola build";
|
|
exit
|
|
# fi
|
|
# @echo "Host arch needs to be 'x86_64-linux'! Aborting...";
|
|
|
|
beleth-non-nixos:
|
|
set -euxo pipefail
|
|
ssh {{beleth-user-host}} "cd nixos-config && git pull"
|
|
ssh {{beleth-host}} "cd /home/xqtc/nixos-config && nixos-rebuild --flake . switch && echo meow"
|
|
ssh {{beleth-user-host}} "cd && cd /var/www/cheats-rs/ && git pull && zola build && cd && sh build_website.sh";
|
|
|
|
website:
|
|
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
ssh {{beleth-user-host}} "cd && cd nixos-config && git pull && cd && cd /var/www/website/ && git pull && cd && sh build_website.sh";
|
|
exit
|
|
|
|
update:
|
|
nix flake update
|
|
nh os build .
|
|
|
|
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;
|
|
nix store gc;
|
|
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."
|
|
|
|
gc profile="all":
|
|
nh clean {{profile}}
|