Files
nixos/overlays/hms.nix
T

28 lines
511 B
Nix
Raw Normal View History

2022-08-02 01:50:50 -05:00
{ pkgs, ... }:
pkgs.writeShellScriptBin "hms" ''
set -eo pipefail
# Build different targets with GUI or not
if [ -z "$DISPLAY" ]; then
target="nogui"
else
target="gui"
fi
2022-09-07 20:01:51 -05:00
if [ "$(uname -s)" == "Darwin" ]; then
src="$HOME/.config/nix/"
target=gui
else
src=/etc/nixos
fi
2022-08-02 01:50:50 -05:00
# Build and switch
echo "Building $(uname -m)-$target"
dest=$(mktemp -d)
pushd "$dest" > /dev/null
2022-09-07 20:01:51 -05:00
nix build --impure "$src#homeConfigurations.$(uname -m)-$target.activationPackage"
2022-08-02 01:50:50 -05:00
./result/activate
popd > /dev/null
rm -r "$dest"
''