diff options
Diffstat (limited to 'nixos/rebuild')
-rwxr-xr-x | nixos/rebuild | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/nixos/rebuild b/nixos/rebuild index d902bd8..9e62b33 100755 --- a/nixos/rebuild +++ b/nixos/rebuild @@ -23,8 +23,13 @@ nixpkgsPath=$( ' ) -# FIXME: change into host directory for host-specific garbage collector roots -cd "$top" -# nixos-rebuild always reads Nixpkgs from the NIX_PATH, -# so we need to set it explicitly to our pinned version -exec nixos-rebuild "$@" -I nixpkgs="$nixpkgsPath" -I nixos-config="$configPath" -I top="$top" +( + # The result symlink created in the current directory is registered as a root of the Nix + # garbage collector, so it's important that we call nixos-rebuild from the host directory. + # (nix-build has an --out-link option but that option cannot be set via nixos-rebuild). + cd $top/hosts/$HOSTNAME && + + # nixos-rebuild always reads Nixpkgs from the NIX_PATH, + # so we need to set it explicitly to our pinned version + exec nixos-rebuild "$@" -I nixpkgs="$nixpkgsPath" -I nixos-config="$configPath" -I top="$top" +) |