2024-07-24 16:15:46 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
REPO_ROOT="${SCRIPT_DIR}/.."
|
|
|
|
cd $REPO_ROOT
|
|
|
|
|
2024-07-24 16:21:50 +01:00
|
|
|
MODE=""
|
|
|
|
if [ -z "${1-}" ]; then
|
|
|
|
MODE=switch
|
|
|
|
fi
|
|
|
|
|
2024-07-24 16:20:58 +01:00
|
|
|
if command -v nom &> /dev/null && [ "$MODE" == "switch" ]; then
|
2024-07-24 16:15:46 +01:00
|
|
|
nix build "${REPO_ROOT}#homeConfigurations.$(hostname)-$(whoami).activationPackage" "$@" --keep-failed --log-format internal-json -v |& nom --json
|
2024-07-24 16:38:54 +01:00
|
|
|
./result/activate
|
2024-07-24 16:15:46 +01:00
|
|
|
else
|
|
|
|
echo "Install nix-output-monitor for better output"
|
2024-07-24 16:20:58 +01:00
|
|
|
nix run .#home-manager -- --flake "${REPO_ROOT}#$(hostname)-$(whoami)" "$MODE" "$@"
|
2024-07-24 16:15:46 +01:00
|
|
|
fi
|