Instead of calling the home manager directly in the user's list, we add a command for the user to invoke "hms" and have their environment setup in the way that Greg likes.
21 lines
413 B
Nix
21 lines
413 B
Nix
{ pkgs, ... }:
|
|
|
|
pkgs.writeShellScriptBin "hms" ''
|
|
set -eo pipefail
|
|
# Build different targets with GUI or not
|
|
if [ -z "$DISPLAY" ]; then
|
|
target="nogui"
|
|
else
|
|
target="gui"
|
|
fi
|
|
|
|
# Build and switch
|
|
echo "Building $(uname -m)-$target"
|
|
dest=$(mktemp -d)
|
|
pushd "$dest" > /dev/null
|
|
nix build --impure /etc/nixos#homeConfigurations.$(uname -m)-$target.activationPackage
|
|
./result/activate
|
|
popd > /dev/null
|
|
rm -r "$dest"
|
|
''
|