Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f58c39a4e64c
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2df16bf647ad
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Mar 2, 2019

  1. nixos-rebuild: get Nix from channel

    If our old Nix can’t evaluate the Nixpkgs channel, try the fallback
    from the new channel /first/. That way we can upgrade Nix to a newer
    version and support breaking changes to Nix (like seen in the upgrade
    o Nix 2.0).
    
    This change should be backported to older NixOS versions!
    
    (cherry picked from commit 475c8aa)
    matthewbauer committed Mar 2, 2019
    Copy the full SHA
    2df16bf View commit details
Showing with 11 additions and 1 deletion.
  1. +11 −1 nixos/modules/installer/tools/nixos-rebuild.sh
12 changes: 11 additions & 1 deletion nixos/modules/installer/tools/nixos-rebuild.sh
Original file line number Diff line number Diff line change
@@ -267,6 +267,14 @@ if [ -n "$rollback" -o "$action" = dry-build ]; then
buildNix=
fi

nixSystem() {
machine="$(uname -m)"
if [[ "$machine" =~ i.86 ]]; then
machine=i686
fi
echo $machine-linux
}

prebuiltNix() {
machine="$1"
if [ "$machine" = x86_64 ]; then
@@ -286,7 +294,9 @@ if [ -n "$buildNix" ]; then
nixDrv=
if ! nixDrv="$(nix-instantiate '<nixpkgs/nixos>' --add-root $tmpDir/nix.drv --indirect -A config.nix.package.out "${extraBuildFlags[@]}")"; then
if ! nixDrv="$(nix-instantiate '<nixpkgs>' --add-root $tmpDir/nix.drv --indirect -A nix "${extraBuildFlags[@]}")"; then
nixStorePath="$(prebuiltNix "$(uname -m)")"
if ! nixStorePath="$(nix-instantiate --eval '<nixpkgs/nixos/modules/installer/tools/nix-fallback-paths.nix>' -A $(nixSystem) | sed -e 's/^"//' -e 's/"$//')"; then
nixStorePath="$(prebuiltNix "$(uname -m)")"
fi
if ! nix-store -r $nixStorePath --add-root $tmpDir/nix --indirect \
--option extra-binary-caches https://cache.nixos.org/; then
echo "warning: don't know how to get latest Nix" >&2