Nixpkgs: dontUnpack doesnt prevent src from unpacking / doesnt disable unpackPhase

Created on 26 Jul 2019  路  6Comments  路  Source: NixOS/nixpkgs

with file

echo "asdfasdf" > text

with derivation

let
  pkgs = import <nixpkgs> {};
in

with pkgs;

stdenv.mkDerivation {
  name = "asdfasdf";

  version = "0.1";

  src = ./text;

  dontUnpack = true; # not fu**** working

  installPhase = ''
    echo "not even executed"
  '';
}

I have an error

$ nix-build tmp.nix
these derivations will be built:
  /nix/store/jg78zmy6qc29s5sgkligpbr88zidv41k-asdfasdf.drv
building '/nix/store/jg78zmy6qc29s5sgkligpbr88zidv41k-asdfasdf.drv'...
unpacking sources
unpacking source archive /nix/store/wwba4yf2422aai9d796r2gfmzj1mvrs5-text
do not know how to unpack source archive /nix/store/wwba4yf2422aai9d796r2gfmzj1mvrs5-text
builder for '/nix/store/jg78zmy6qc29s5sgkligpbr88zidv41k-asdfasdf.drv' failed with exit code 1
error: build of '/nix/store/jg78zmy6qc29s5sgkligpbr88zidv41k-asdfasdf.drv' failed

why dontUnpack not working?

expected output

unpacking sources
unpacking source archive /nix/store/3hnf69pky6mqaxv4jxly9fyywqpq6iml-FoxitReader
do not know how to unpack source archive /nix/store/3hnf69pky6mqaxv4jxly9fyywqpq6iml-FoxitReader

should not be printed


$ cat /nix/store/jg78zmy6qc29s5sgkligpbr88zidv41k-asdfasdf.drv
Derive([("out","/nix/store/dc76i7sciyhmmlnl317s2w0p6nj396p1-asdfasdf","","")],[("/nix/store/1kircip4wskspsqqzxbmh6ss73iqh9ah-bash-4.4-p23.drv",["out"]),("/nix/store/fjhmb2fr7fx5azg89ldqywkmj5604z08-stdenv-linux.drv",["out"])],["/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh","/nix/store/wwba4yf2422aai9d796r2gfmzj1mvrs5-text"],"x86_64-linux","/nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash",["-e","/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"],[("buildInputs",""),("builder","/nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash"),("configureFlags",""),("depsBuildBuild",""),("depsBuildBuildPropagated",""),("depsBuildTarget",""),("depsBuildTargetPropagated",""),("depsHostHost",""),("depsHostHostPropagated",""),("depsTargetTarget",""),("depsTargetTargetPropagated",""),("doCheck",""),("doInstallCheck",""),("dontUnpack","1"),("installPhase","echo \"not even executed\"\n"),("name","asdfasdf"),("nativeBuildInputs",""),("out","/nix/store/dc76i7sciyhmmlnl317s2w0p6nj396p1-asdfasdf"),("outputs","out"),("propagatedBuildInputs",""),("propagatedNativeBuildInputs",""),("src","/nix/store/wwba4yf2422aai9d796r2gfmzj1mvrs5-text"),("stdenv","/nix/store/xf82nnr3v80bnh8s8w630h5wv52kgm3l-stdenv-linux"),("strictDeps",""),("system","x86_64-linux"),("version","0.1")])
nix-info
system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.1.3, channels(srghma): "", channels(root): "nixos-19.03.173165.55b8860aa20, nixpkgs-19.09pre186274.104f8a0e1a1, nixpkgs-unstable", nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Also asked here https://stackoverflow.com/questions/57225745/how-to-disable-unpack-phase-to-prevent-error-do-not-know-how-to-unpack-source-a/57228687#57228687

bug

Most helpful comment

Many of the dont<Phase> attributes were not yet implemented in the current and past stable releases. So, if you intend to use it with the current stable or older stables, use instead unpackPhase = ":".

All 6 comments

With which specific build of nixpkgs was this observed? Could you provide a copy of your .drv? (I can't reproduce it here).

With which specific build of nixpkgs was this observed? Could you provide a copy of your .drv? (I can't reproduce it here).

Updated the description, you can paste

Derive([("out","/nix/store/dc76i7sciyhmmlnl317s2w0p6nj396p1-asdfasdf","","")],[("/nix/store/1kircip4wskspsqqzxbmh6ss73iqh9ah-bash-4.4-p23.drv",["out"]),("/nix/store/fjhmb2fr7fx5azg89ldqywkmj5604z08-stdenv-linux.drv",["out"])],["/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh","/nix/store/wwba4yf2422aai9d796r2gfmzj1mvrs5-text"],"x86_64-linux","/nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash",["-e","/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"],[("buildInputs",""),("builder","/nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash"),("configureFlags",""),("depsBuildBuild",""),("depsBuildBuildPropagated",""),("depsBuildTarget",""),("depsBuildTargetPropagated",""),("depsHostHost",""),("depsHostHostPropagated",""),("depsTargetTarget",""),("depsTargetTargetPropagated",""),("doCheck",""),("doInstallCheck",""),("dontUnpack","1"),("installPhase","echo \"not even executed\"\n"),("name","asdfasdf"),("nativeBuildInputs",""),("out","/nix/store/dc76i7sciyhmmlnl317s2w0p6nj396p1-asdfasdf"),("outputs","out"),("propagatedBuildInputs",""),("propagatedNativeBuildInputs",""),("src","/nix/store/wwba4yf2422aai9d796r2gfmzj1mvrs5-text"),("stdenv","/nix/store/xf82nnr3v80bnh8s8w630h5wv52kgm3l-stdenv-linux"),("strictDeps",""),("system","x86_64-linux"),("version","0.1")])

to ./my.drv and you will have derivation

@charles-dyfis-net well, I cant reproduce the issue with https://nixos.org/channels/nixpkgs-unstable

dontUnpack = true is working here, no unpacking is executed, preUnpack and postUnpack phases are also not executed as expected

this is not working on nixpkgs version 19.03.173165.55b8860aa20, but working on 19.09.pre186274.104f8a0e1a1

dont know if the fix should be pushed to older versions of nixpkgs @charles-dyfis-net

Many of the dont<Phase> attributes were not yet implemented in the current and past stable releases. So, if you intend to use it with the current stable or older stables, use instead unpackPhase = ":".

Was this page helpful?
0 / 5 - 0 ratings