Be more specific on Darwin

This commit is contained in:
greg-compass
2022-09-09 11:54:18 -05:00
parent 5912ca4bcc
commit d0a233fed7
2 changed files with 35 additions and 24 deletions
+10 -7
View File
@@ -3,16 +3,19 @@
pkgs.writeShellScriptBin "hms" ''
set -eo pipefail
# Build different targets with GUI or not
if [ -z "$DISPLAY" ]; then
target="nogui"
else
target="gui"
fi
arch="$(uname -m)"
if [ "$(uname -s)" == "Darwin" ]; then
# On macOS
src="$HOME/.config/nix/"
target=gui
target="''${arch}-darwin"
else
# On Linux/WSL2 systems
if [ -z "$DISPLAY" ]; then
target="''${arch}-nogui"
else
target="''${arch}-gui"
fi
src=/etc/nixos
fi
@@ -20,7 +23,7 @@ fi
echo "Building $(uname -m)-$target"
dest=$(mktemp -d)
pushd "$dest" > /dev/null
nix build --impure "$src#homeConfigurations.$(uname -m)-$target.activationPackage"
nix build --impure "$src#homeConfigurations.$target.activationPackage"
./result/activate
popd > /dev/null
rm -r "$dest"