Skip to content

Instantly share code, notes, and snippets.

@shlevy
Created February 21, 2012 13:58
Show Gist options
  • Select an option

  • Save shlevy/1876692 to your computer and use it in GitHub Desktop.

Select an option

Save shlevy/1876692 to your computer and use it in GitHub Desktop.
Strangeness with packageOverrides

$ cat ~/.nixpkgs/config.nix

{
  packageOverrides = pkgs: {
    testEnv = pkgs.buildEnv {
      name = "test";
      paths = [];
    };
  };
}

$ cat test.nix

let pkgs = import ./. {}; in
{
  testEnv = pkgs.buildEnv {
    name = "test";
    paths = [];
  };
}

$ nix-build -A testEnv --dry-run

these derivations will be built:
  /nix/store/agsjh4w2d20fby9vxafv9sx7crzhqhp4-test.drv
  /nix/store/bg0bv4kz2cq959hfq52i4azjrzzdj0bl-perl-5.14.2.drv

$ nix-build -A testEnv test.nix --dry-run

these derivations will be built:
  /nix/store/9spn30n0shxnpyzsr8pf5b6ddbw395dm-test.drv
@edolstra

Copy link
Copy Markdown

Try this patch:

Index: pkgs/top-level/all-packages.nix
===================================================================
--- pkgs/top-level/all-packages.nix     (revision 32455)
+++ pkgs/top-level/all-packages.nix     (working copy)
@@ -241,7 +241,7 @@
   };
 
   buildEnv = import ../build-support/buildenv {
-    inherit runCommand perl;
+    inherit (pkgs) runCommand perl;
   };
 
   dotnetenv = import ../build-support/dotnetenv {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment