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: 921b2ccff895
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3dedec4ab831
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Mar 26, 2019

  1. pkgs/top-level/stage.nix: don't override overlays and config in `…

    …nixpkgsFun`
    
    `nixpkgsFun` already sets them via `args`. Doing this also introduces unexpected
    hard to debug errors, see the patch.
    oxij authored and danbst committed Mar 26, 2019
    Copy the full SHA
    e8dac0c View commit details
  2. pkgsMusl, pkgsi686Linux, pkgsStatic: fix infinite recursion with over…

    …lays
    
    Consider example:
    
    $ nix-instantiate ./nixos -A system --arg configuration '
        {
          boot.isContainer = true;
          nixpkgs.overlays = [ (self: super: {
            nix = self.pkgsStatic.nix;
          }) ];
        }'
    
    When resolving package through overlays, we figure out that
    
      nix == self.pkgsStatic.nix
      =>
      nix == (import <nixpkgs> { inherit overlays; }).nix
      =>
      nix == (import <nixpkgs> { overlays = [(self: super: { nix = self.pkgsStatic.nix; })];}).nix
    
    and we enter infinite recursion of nixpkgs evaluations.
    
    The proper fix should terminate recursion by assigning self fixpoint
    to inner custom package set. But I get infinite recursion somehow, so
    I use `super`. It is less correct modulo deep custom overrides, but behaves
    correctly for simple cases and doesn't OOM evaluator.
    
    Fixes #57984
    danbst committed Mar 26, 2019

    Verified

    This commit was signed with the committer’s verified signature.
    jtojnar Jan Tojnar
    Copy the full SHA
    3dedec4 View commit details
Showing with 17 additions and 2 deletions.
  1. +8 −0 pkgs/top-level/default.nix
  2. +9 −2 pkgs/top-level/stage.nix
8 changes: 8 additions & 0 deletions pkgs/top-level/default.nix
Original file line number Diff line number Diff line change
@@ -83,6 +83,14 @@ in let
# compiling toolchains and 32-bit packages on x86_64). In both those cases we
# want the provided non-native `localSystem` argument to affect the stdenv
# chosen.
#
# NB!!! This thing gets its `config` argument from `args`, i.e. it's actually
# `config0`. It is important to keep it to `config0` format (as opposed to the
# result of `evalModules`, i.e. the `config` variable above) throughout all
# nixpkgs evaluations since the above function `config0 -> config` implemented
# via `evalModules` is not idempotent. In other words, if you add `config` to
# `newArgs`, expect strange very hard to debug errors! (Yes, I'm speaking from
# experience here.)
nixpkgsFun = newArgs: import ./. (args // newArgs);

# Partially apply some arguments for building bootstraping stage pkgs
11 changes: 9 additions & 2 deletions pkgs/top-level/stage.nix
Original file line number Diff line number Diff line change
@@ -135,7 +135,9 @@ let
# default GNU libc on Linux systems. Non-Linux systems are not
# supported.
pkgsMusl = if stdenv.hostPlatform.isLinux then nixpkgsFun {
inherit overlays config;
overlays = [ (self': super': {
pkgsMusl = super';
})] ++ overlays;
${if stdenv.hostPlatform == stdenv.buildPlatform
then "localSystem" else "crossSystem"} = {
parsed = stdenv.hostPlatform.parsed // {
@@ -152,7 +154,9 @@ let
# All packages built for i686 Linux.
# Used by wine, firefox with debugging version of Flash, ...
pkgsi686Linux = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then nixpkgsFun {
inherit overlays config;
overlays = [ (self': super': {
pkgsi686Linux = super';
})] ++ overlays;
${if stdenv.hostPlatform == stdenv.buildPlatform
then "localSystem" else "crossSystem"} = {
parsed = stdenv.hostPlatform.parsed // {
@@ -178,6 +182,9 @@ let
# Fully static packages.
# Currently uses Musl on Linux (couldn’t get static glibc to work).
pkgsStatic = nixpkgsFun ({
overlays = [ (self': super': {
pkgsStatic = super';
})] ++ overlays;
crossOverlays = [ (import ./static.nix) ];
} // lib.optionalAttrs stdenv.hostPlatform.isLinux {
crossSystem = {