Files
nixos/overlays/hms.sh
T

37 lines
729 B
Bash
Raw Normal View History

2022-11-10 11:15:49 -06:00
# vim: set ft=bash:
set -eo pipefail
# Build different targets with GUI or not
arch="$(uname -m)"
if [ "$(uname -s)" == "Darwin" ]; then
# On macOS
2023-05-09 12:01:29 -05:00
src="${HOME}/.config/darwin/"
2023-03-06 23:31:58 -06:00
flavor="gui"
2023-05-09 12:01:29 -05:00
if [ "${arch}" == "arm64" ]; then
arch=aarch64
fi
arch="${arch}-darwin"
2022-12-24 00:36:36 -06:00
elif [ x"${WSL_DISTRO_NAME}" != "x" ]; then
src=/etc/nixos
2023-03-06 23:31:58 -06:00
flavor="cli"
arch="${arch}-linux"
2022-11-10 11:15:49 -06:00
else
2023-03-06 23:31:58 -06:00
# On Linux systems
2022-11-10 11:15:49 -06:00
if [ -z "${DISPLAY}" ]; then
2023-03-06 23:31:58 -06:00
flavor="cli"
2022-11-10 11:15:49 -06:00
else
2023-03-06 23:31:58 -06:00
flavor="gdm"
2022-11-10 11:15:49 -06:00
fi
src=/etc/nixos
arch="${arch}-linux"
2022-11-10 11:15:49 -06:00
fi
# Build and switch
2023-03-06 23:31:58 -06:00
echo "Building ${flavor}.${arch}"
2022-11-10 11:15:49 -06:00
dest=$(mktemp -d)
pushd "${dest}" > /dev/null
2023-03-06 23:31:58 -06:00
nix build "${src}#homeConfigurations.${flavor}.${arch}.activationPackage"
2022-11-10 11:15:49 -06:00
./result/activate
popd > /dev/null
rm -r "${dest}"