Multiple derivations with the same output

I have a case where two equivalent but different derivations being built:

these 72 derivations will be built:
[...]
  /nix/store/1a7xq5q73an2fcqbqskxx2ccrv9by510-libiconv-1.16.drv
[...]
  /nix/store/xhj2wr189p0c1nyhnb9sfydb8nqmkn8m-libiconv-1.16.drv
[...]
$ cat /nix/store/1a7xq5q73an2fcqbqskxx2ccrv9by510-libiconv-1.16.drv
Derive([("out","/nix/store/h1k6zxi2ba2gn6f2hpy2ckslxbzqgav9-libiconv-1.16","","")],[("/nix/store/3z7c1zfxl7s6hgsr9amv5qal2aypi8c7-libiconv-1.16.tar.gz.drv",["out"]),("/nix/store/9a8iwwf8qzxzjch3b0cxcbbkwskycq1n-stdenv.drv",["out"]),("/nix/store/g8qfvv66z180mlvv78kzac7b872j1qr7-bash-interactive-4.4-p23.drv",["out"])],["/nix/store/8w0kdfqvpfgnhw193j7fihy41p04sbzb-move-cygwin-dlls.sh","/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh","/nix/store/qy5734q2z2n8q2jdkywc78x37wh3vsis-role.bash","/nix/store/x92xjcixakxk1b33wz0anpza8bkblhjh-win-dll-link.sh","/nix/store/xrvbfm0ahaiik1vlxzn3vsp5gyhksy2n-setup-hook.sh"],"x86_64-cygwin","/nix/store/jshp6mkiz6bmwkc4kqn7mzgasn44wrmm-bash-interactive-4.4-p23/bin/bash",["-e","/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"],[("buildInputs",""),("builder","/nix/store/jshp6mkiz6bmwkc4kqn7mzgasn44wrmm-bash-interactive-4.4-p23/bin/bash"),("configureFlags","--disable-static --enable-shared"),("depsBuildBuild",""),("depsBuildBuildPropagated",""),("depsBuildTarget",""),("depsBuildTargetPropagated",""),("depsHostHost",""),("depsHostHostPropagated",""),("depsTargetTarget",""),("depsTargetTargetPropagated",""),("doCheck",""),("doInstallCheck",""),("name","libiconv-1.16"),("nativeBuildInputs","/nix/store/8w0kdfqvpfgnhw193j7fihy41p04sbzb-move-cygwin-dlls.sh /nix/store/x92xjcixakxk1b33wz0anpza8bkblhjh-win-dll-link.sh"),("out","/nix/store/h1k6zxi2ba2gn6f2hpy2ckslxbzqgav9-libiconv-1.16"),("outputs","out"),("patches",""),("pname","libiconv"),("postPatch",""),("propagatedBuildInputs",""),("propagatedNativeBuildInputs",""),("setupHooks","/nix/store/qy5734q2z2n8q2jdkywc78x37wh3vsis-role.bash /nix/store/xrvbfm0ahaiik1vlxzn3vsp5gyhksy2n-setup-hook.sh"),("src","/nix/store/sj0b4l51iksf5f82fxdzzm1dzkfr70r8-libiconv-1.16.tar.gz"),("stdenv","/nix/store/hwlpk90v1ng19fp9finvbwkhl2gd41aa-stdenv"),("strictDeps",""),("system","x86_64-cygwin"),("version","1.16")])%
$ cat /nix/store/xhj2wr189p0c1nyhnb9sfydb8nqmkn8m-libiconv-1.16.drv
Derive([("out","/nix/store/h1k6zxi2ba2gn6f2hpy2ckslxbzqgav9-libiconv-1.16","","")],[("/nix/store/9a8iwwf8qzxzjch3b0cxcbbkwskycq1n-stdenv.drv",["out"]),("/nix/store/g8qfvv66z180mlvv78kzac7b872j1qr7-bash-interactive-4.4-p23.drv",["out"]),("/nix/store/kwcws7g4l8j9099r9cl3vbajfkfz3pbf-libiconv-1.16.tar.gz.drv",["out"])],["/nix/store/8w0kdfqvpfgnhw193j7fihy41p04sbzb-move-cygwin-dlls.sh","/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh","/nix/store/qy5734q2z2n8q2jdkywc78x37wh3vsis-role.bash","/nix/store/x92xjcixakxk1b33wz0anpza8bkblhjh-win-dll-link.sh","/nix/store/xrvbfm0ahaiik1vlxzn3vsp5gyhksy2n-setup-hook.sh"],"x86_64-cygwin","/nix/store/jshp6mkiz6bmwkc4kqn7mzgasn44wrmm-bash-interactive-4.4-p23/bin/bash",["-e","/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"],[("buildInputs",""),("builder","/nix/store/jshp6mkiz6bmwkc4kqn7mzgasn44wrmm-bash-interactive-4.4-p23/bin/bash"),("configureFlags","--disable-static --enable-shared"),("depsBuildBuild",""),("depsBuildBuildPropagated",""),("depsBuildTarget",""),("depsBuildTargetPropagated",""),("depsHostHost",""),("depsHostHostPropagated",""),("depsTargetTarget",""),("depsTargetTargetPropagated",""),("doCheck",""),("doInstallCheck",""),("name","libiconv-1.16"),("nativeBuildInputs","/nix/store/8w0kdfqvpfgnhw193j7fihy41p04sbzb-move-cygwin-dlls.sh /nix/store/x92xjcixakxk1b33wz0anpza8bkblhjh-win-dll-link.sh"),("out","/nix/store/h1k6zxi2ba2gn6f2hpy2ckslxbzqgav9-libiconv-1.16"),("outputs","out"),("patches",""),("pname","libiconv"),("postPatch",""),("propagatedBuildInputs",""),("propagatedNativeBuildInputs",""),("setupHooks","/nix/store/qy5734q2z2n8q2jdkywc78x37wh3vsis-role.bash /nix/store/xrvbfm0ahaiik1vlxzn3vsp5gyhksy2n-setup-hook.sh"),("src","/nix/store/sj0b4l51iksf5f82fxdzzm1dzkfr70r8-libiconv-1.16.tar.gz"),("stdenv","/nix/store/hwlpk90v1ng19fp9finvbwkhl2gd41aa-stdenv"),("strictDeps",""),("system","x86_64-cygwin"),("version","1.16")])%

The difference between them is that they have different derivations for $src, with the same fixed output. This is possibly to do with one of them using system curl, as I’m attempting to set up a bootstrap on cygwin.

When I build, it will attempt to build both, and the second one will fail because the output exists and is read-only.

Does anyone know what’s supposed to happen in this situation?

2 Likes

There’s a mention of this here: Multiple derivations with the same output paths?

But what I’m not sure about is how it’s supposed to be built. Is it supposed to avoid building both? Once either one has been built I can continue building things that depend on either of them.