[Nix-dev] importing nixpkgs from derivation dumps large path

Danylo Hlynskyi abcz2.uprola at gmail.com
Thu Mar 2 10:59:38 CET 2017


as a workaround you can use fetchFromGitHub or

fetchTarball "https://github.com/NixOS/nixpkgs/archive/${commit}.tar.gz"



2017-03-02 9:01 GMT+02:00 Ganesh Sittampalam <ganesh at earth.li>:

> Hi,
>
> I'm trying to maintain a set of development environments using
> nix-shell. For each environment, I want to keep them pinned at a
> particular git revision of nixpkgs until I explicitly upgrade that
> environment, so I can check that everything still works properly.
>
> I used to manage this manually with a comment on myEnvFun environments.
> While migrating them to nix-shell, I learnt that I can use "import from
> derivation" for this instead and have it expressed within the nix language:
>
>  {
>    env =
>      let pkgs =
>           import
>              (with import <nixpkgs> {} ;
>               fetchgit {
>                 url = <nixpkgs>;
>                 rev = "264d42b";
>                 sha256 =
>                  "19i77afcns8mf88vkxvm3jvkzdkf5x8p8kxnnivhd9l4kslkq3v5";
>               }) {};
>
>      in with pkgs ; stdenv.mkDerivation rec {
>          name = "haskell-http-ghc710";
>          buildInputs = [ stdenv pkgconfig gcc binutils
>                          haskell.compiler.ghc7102
>                          haskellPackages.cabal-install
>                          zlib ];
>      };
>  }
>
> When I instantiate this, e.g. with
>
>  nix-instantiate -I nixpkgs=<some nixpkgs checkout> demo.nix -A env
>
> it takes about 5-10s and prints out this message, though it does complete:
>
> warning: dumping very large path (> 256 MiB); this may run out of memory
>
> I'm aware that this error is typically associated with trying to import
> large files or large trees into the store:
>
> https://github.com/NixOS/nix/issues/358
> https://github.com/NixOS/nixpkgs/issues/12243
>
> I guess that in this case the large tree is the import of the nixpkgs
> tree. Is there any work around or better way to achieve what I want? The
> time taken is annoying particularly because I have a lot of these shells
> that I sometimes want to rebuild all together.
>
> Cheers,
>
> Ganesh
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170302/5adeafc8/attachment-0001.html>


More information about the nix-dev mailing list