nixhome/build.sh

19 lines
643 B
Bash
Executable File

#!/usr/bin/env bash
cd $(dirname $0)
# assume that if there are no args, you want to switch to the configuration
cmd=${1:-switch}
shift
homemanager="/home/nora/.nix-profile/bin/home-manager"
nixpkgs_pin=$(nix eval --raw -f npins/default.nix nixpkgs)
nixgl_pin=$(nix eval --raw -f npins/default.nix nixgl)
homemanager_pin=$(nix eval --raw -f npins/default.nix home-manager)
nix_path="nixpkgs=${nixpkgs_pin}:nixgl=${nixgl_pin}:home-manager=${homemanager_pin}"
# without --fast, nixos-rebuild will compile nix and use the compiled nix to
# evaluate the config, wasting several seconds
env NIX_PATH="${nix_path}" "${homemanager}" "$cmd" "$@"