Differences in evaulation with fixed-output dependencies under Darwin and Linux

Hey everyone,

I’ve been seeing a bit of weird behaviour and was wondering if this is somehow intentional and I’m missing something or if it is indeed a bug.

I have an application using Playwright (and end-to-end testing framework that basically remote-controls a bunch of browsers) from this PR. The thing is Playwright needs precompiled binarys – mainly Chrome and Firefox – to work. Normally it would download them on the fly, but their location can be passed in using an environment variable. My flake currently looks something like this:

{
  packages = rec {
    playwright-browsers = runCommand "playwright-browsers" {
      outputHashMode = "recursive";
      outputHashAlgo = "sha256";
      outputHash = {
        x86_64-linux = "sha256-OT0YjNBDAb7x4Y1Vh3SlrCZRg4UaD6U2910pSMDbD9Y=";
        x86_64-darwin = "sha256-D68dImCeVI4CiRC07kbahZvzFI3y2dShXPal0IH/UHo=";
      }.${stdenv.hostPlatform.system} or (throw "Unsupported system");

      nativeBuildInputs = lib.optional stdenv.isLinux pkgs.autoPatchelfHook;
    } ''
      export PLAYWRIGHT_BROWSERS_PATH=$out
      ${python.pkgs.playwright}/bin/playwright install
      rm -r $out/.links

      ${lib.optionalString stdenv.isLinux ''
        autoPatchelf $out --ignore-missing="*"
      ''}
    '';

    myapp-base = ...;

    myapp = writeShellScriptBin "myapp" ''
      export PLAYWRIGHT_BROWSERS_PATH=${playwright-browsers}
      exec ${myapp-base}/bin/myapp "$@"
    '';
  }
}

Now here comes the part I don’t fully understand yet. When I run nix build .#myapp I get a the wrapped myapp script as expected, which does work. The only problem is that Nix doesn’t actually see playwright-browsers as a dependency of myapp. When I copy the latter’s closure to another system, the browser bundle doesn’t get copied and it doesn’t work:

# nix why-depends .#myapp .#playwright-browsers
warning: Git tree '/myapp' is dirty
warning: Git tree '/myapp' is dirty
this derivation will be built:
  /nix/store/x1pp4hhlhy2js8wrhfj9q3a5q8snnv73-playwright-browsers.drv
'/nix/store/alr90n1w24brrwifzckraqka42acrlmp-myapp' does not depend on '/nix/store/mkssfmx9vy7izyxy6ylqys9lnblbymaq-playwright-browsers'

The last output was run inside the nixos/nix container from Docker hub (but I’ve also verified this behavior on a NixOS machine). What’s weird to me is that on my Darwin machine, it works:

# nix why-depends .#myapp .#playwright-browsers
/nix/store/5is7r0dwsf71adgsflcx8w6zsqkb0rhk-myapp
└───/nix/store/ffh5fm97cdx7jsjkk0z5679vr4c24cg9-playwright-browsers

I’ve tried debugging with nix build -vvvv .#myapp (inside the container) and here is what I got:

building '/nix/store/x1pp4hhlhy2js8wrhfj9q3a5q8snnv73-playwright-browsers.drv'...
building of '/nix/store/x1pp4hhlhy2js8wrhfj9q3a5q8snnv73-playwright-browsers.drv!out' from .drv file: got EOF
building of '/nix/store/x1pp4hhlhy2js8wrhfj9q3a5q8snnv73-playwright-browsers.drv!out' from .drv file: woken up
building of '/nix/store/x1pp4hhlhy2js8wrhfj9q3a5q8snnv73-playwright-browsers.drv!out' from .drv file: build done
killing process 3168
builder process for '/nix/store/x1pp4hhlhy2js8wrhfj9q3a5q8snnv73-playwright-browsers.drv' finished
killing all processes running under uid '30001'
scanning for references for output 'out' in temp location '/nix/store/mkssfmx9vy7izyxy6ylqys9lnblbymaq-playwright-browsers'
found reference to 'qm2lv1gpbyn0rsfai40cbvj3h4gz69yc' at offset '13'
warning: dumping very large path (> 256 MiB); this may run out of memory
locking path '/nix/store/g2clr8qscq2ax8vl15f0di8d5arxsq0g-playwright-browsers'
lock acquired on '/nix/store/g2clr8qscq2ax8vl15f0di8d5arxsq0g-playwright-browsers.lock'
unreferenced input: '/nix/store/07qa4yv2whpvkq38wwsx8q9mind7mjny-openexr-2.5.7'
unreferenced input: '/nix/store/0aan01487sa684bh5p0vyzdifhfgl0q6-lvm2-2.03.16-lib'
unreferenced input: '/nix/store/0cwbv111cr44bn3f71ayva8l2agpbbna-icu4c-71.1'
unreferenced input: '/nix/store/0gzd0049bywqhzi5anbydsxil7r1lfrj-binutils-2.38'
unreferenced input: '/nix/store/0igcwngcdhfhy6rjq4mjcjjr1rycgw5i-python3.10-websockets-10.3'
unreferenced input: '/nix/store/16p24hkglyc38vq7yri2lgwprf9m4pv9-linux-headers-5.18'
unreferenced input: '/nix/store/1ayz7sydm1rbkfspzy6qq5ih21d1mi3z-gnutls-3.7.6'
unreferenced input: '/nix/store/1ha7qy2fzqj8rvjchi6kw2lcyr1zpm2c-dav1d-1.0.0'
unreferenced input: '/nix/store/1i5y55x4b4m9qkx5dqbmr1r6bvrqbanw-multiple-outputs.sh'
unreferenced input: '/nix/store/1mypggfh0pnf59811rn20wgpr21x7a9c-libgcrypt-1.10.1'
unreferenced input: '/nix/store/1rqksyzxkl81r4703m6a0gns5pjc5njs-libXdmcp-1.1.3'
unreferenced input: '/nix/store/1rsj0mw8vqlnhk59wkw4i3yal4qw19k0-libXrender-0.9.10'
unreferenced input: '/nix/store/1x4rndszllklqnp8kx3bz6gi5i56hsy6-gnused-4.8'
unreferenced input: '/nix/store/1y5lfhgphjcbwslg4dyj7gsal6lk3f11-pcre-8.45'
unreferenced input: '/nix/store/25wavkgdy7bkf628j123ifjkxg9s85wk-gnumake-4.3'
unreferenced input: '/nix/store/29rjl9zcwrcyiis232yj6cd09nl0y1b5-perl5.34.1-XML-Parser-2.46'
unreferenced input: '/nix/store/2ggbc04aiq9zf09g49gz9hi3wgk1i4vk-harfbuzz-3.3.2'
unreferenced input: '/nix/store/2gknqdvw7ndma2miwj2pxvdacpncn88p-python3.10-pyopenssl-22.0.0-dev'
unreferenced input: '/nix/store/2iwzjvrqnmczlr37rkbkgwhk5mxjy4fd-perl5.34.1-HTTP-Negotiate-6.01'
unreferenced input: '/nix/store/2wx0faw05ncvgaz5jihd5pda1mzw63mb-libselinux-3.3'
unreferenced input: '/nix/store/2xw47ifi36kra81j6jlmh8qmm3lqvm02-libjxl-0.6.1'
unreferenced input: '/nix/store/2ykjh2r46c55h5lklf2ypms9dchahpi4-libtool-2.4.7-lib'
unreferenced input: '/nix/store/2zskajz26vc74r56j5n9z6hixqqv5z49-python3.10-charset-normalizer-2.0.12'
unreferenced input: '/nix/store/31809rj7dg5mxhyx9bryg4acig890nn9-libnfnetlink-1.0.2'
unreferenced input: '/nix/store/32lmja6d2jmz79ssd59z6vrx2rqz211l-python3.10-twisted-22.4.0'
unreferenced input: '/nix/store/36j0fhmcd8pcqc395n6jfhkif0khdkp7-expat-2.4.8'
unreferenced input: '/nix/store/38ychklifhkvfjzgqr1i97916cmiwdhj-glib-2.72.3'
unreferenced input: '/nix/store/3g4rb3ypnl0hv8s52rv91kbx8rajdyrg-keyutils-1.6.3-lib'
unreferenced input: '/nix/store/3v1iws5m35ni27r2qg01wnyinhp6vhpz-file-5.42'
unreferenced input: '/nix/store/3w52aqn5idzkhij99mlkhq2mwmlldybp-zlib-1.2.12-dev'
unreferenced input: '/nix/store/3z8np9qys8jnwc3w439banfibgbmja2i-ed-1.18'
unreferenced input: '/nix/store/48s4h862snj1m8dcw58rdj6mpj04188k-systemd-250.4'
unreferenced input: '/nix/store/4awjn9p1fjkhpayp4pjj5ijglqryc6fm-python3.10-click-8.1.3'
unreferenced input: '/nix/store/4ay9q1d8j82p918r49jlzsixw1bpdhm0-libX11-1.7.2'
unreferenced input: '/nix/store/4cg6k2d48ym4jqp4py9vdy3rqy5hw4s4-readline-6.3p08'
unreferenced input: '/nix/store/4sk7cq15l2khj098w3c56y5mfi0q3fka-python3.10-pyasn1-0.4.8'
unreferenced input: '/nix/store/4wy7sx2sz8b5f8c6qwx84s6qg2z53s1h-perl5.34.1-Test-RequiresInternet-0.05'
unreferenced input: '/nix/store/4y21x6ignhn1ljidx3ad8mmk48rp7s5y-gperftools-2.9.1'
unreferenced input: '/nix/store/523zlfzypzcr969p058i6lcgfmg889d5-stdenv-linux'
unreferenced input: '/nix/store/58b1m19nm9vya8fg710zzv8xg1i0r3ys-json-c-0.16'
unreferenced input: '/nix/store/59jmzisg8fkm9c125fw384dqq1np602l-move-docs.sh'
unreferenced input: '/nix/store/5mds8qkhqrz2gnhafzi6mpnjim7n3mk5-file-5.42'
unreferenced input: '/nix/store/5ndm1xyqbwld4msw092kf0mw6wmwxrq1-python3.10-brotli-1.0.9'
unreferenced input: '/nix/store/5qjm0s0k81cjl630rjv1d8jniyq2i3yl-python3.10-certifi-2022.06.15'
unreferenced input: '/nix/store/5x12vadncp7918ff8v6w3svz5q9wqgx0-bzip2-1.0.6.0.2'
unreferenced input: '/nix/store/5x8br1pwxd25znvbf04crhnzlns70y0c-python3.10-pyee-9.0.4'
unreferenced input: '/nix/store/5yapmicxdzki8zi4lapcl7nl2p3cy6xq-perl5.34.1-LWP-MediaTypes-6.04'
unreferenced input: '/nix/store/614dplarx3fjamz9bdb51kkg1ss1cn6p-python3.10-greenlet-1.1.2'
unreferenced input: '/nix/store/65hq6s4frm27a2npladvlg8q4sjnzbsa-iptables-1.8.8'
unreferenced input: '/nix/store/65rvy0ip8ck9cffwwn9qp40x9pa29h9f-python3.10-pyasn1-modules-0.2.8'
unreferenced input: '/nix/store/6lvkrygz8fbkkwncw8wgb5ads75qv5hi-python3.10-playwright-1.22.0'
unreferenced input: '/nix/store/6mx62f4mdv5y1awi7y2mp23a76gg0ba7-gcc-wrapper-11.3.0'
unreferenced input: '/nix/store/6pnb9dckvbbavj10yqxmb89pm2dy9fb3-xz-5.2.5-bin'
unreferenced input: '/nix/store/6y1pqgrcjq4h5c6n57hn55l04dfcf8qq-nettle-3.7.3'
unreferenced input: '/nix/store/6yv98gqrfpld8mjcdslvk0xclnhcfc05-libhwy-0.15.0'
unreferenced input: '/nix/store/74fx3vs6df20rxq3vbk2wr98543z06by-dejavu-fonts-minimal-2.37'
unreferenced input: '/nix/store/7g6ncm6gbhxnrlcvr0w7a5jd8lvlshj3-kbd-2.4.0'
unreferenced input: '/nix/store/7gb5f5jh6n7i7whppc7mk0i86vlli05x-libthai-0.1.29'
unreferenced input: '/nix/store/7mcrxfhl2qxx5m6cf991jv8sg9bzb7v0-freetype-2.12.1'
unreferenced input: '/nix/store/7qbfppn79gajwrf1s54y7spc3wmf25mz-libcbor-0.9.0'
unreferenced input: '/nix/store/7shmm2x89inl5c0v5lcxf7gm93cacs94-openssl-1.1.1q-dev'
unreferenced input: '/nix/store/7vshqnwks0y7vxrsj3vcyni02b37k89c-libgpg-error-1.42'
unreferenced input: '/nix/store/7xrnhzflapyl0vgj6n3vsjppwm7ls747-libXau-1.0.9'
unreferenced input: '/nix/store/83ixzgcv4q8mizh9vr786ymhzdywj8kw-libavif-0.10.0'
unreferenced input: '/nix/store/879rcb30szhqz0bgf9r3lsik8az5brnf-attr-2.5.1'
unreferenced input: '/nix/store/88prg8ry1spmfi40w35h541xvsi5ix9j-ilmbase-2.5.7'
unreferenced input: '/nix/store/890nx4dsf41xijgd8bdncxk56kv3lak4-libidn2-2.3.2'
unreferenced input: '/nix/store/8kh1hgcp3hr7cx98qjzkfsx3qhc9kmgf-python3.10-cryptography-37.0.2'
unreferenced input: '/nix/store/8lypp3rfxw5yfmk12yzx18n5dm0jcqn8-python3.10-service-identity-21.1.0'
unreferenced input: '/nix/store/8rga7z2kc9y0wyfr73qlzg39bi00d569-python3.10-automat-20.2.0'
unreferenced input: '/nix/store/8ri08j9vhgslirg2p966l830wv3qvwiy-giflib-5.2.1'
unreferenced input: '/nix/store/8zxndz5ag0p6s526c2xyllhk1nrn4c3i-audit-tmpdir.sh'
unreferenced input: '/nix/store/936yq9hfhvabwp9vml80411xmj5r7j9b-libuv-1.44.1'
unreferenced input: '/nix/store/95f6r7z3y3j05nfdd6kkz3gkfq5q6ciy-python3.10-olefile-0.46'
unreferenced input: '/nix/store/989fllpywzl6nmgmg975vbzaiq82dx0d-lcms2-2.13.1'
unreferenced input: '/nix/store/9ga3xp08k52wh8hfpmlfncdn9vkyvi47-db-4.8.30'
unreferenced input: '/nix/store/9in8lghv50kmdgxxiq2nz9hl867d5zgr-gawk-5.1.1'
unreferenced input: '/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh'
unreferenced input: '/nix/store/9lmjg05d0sx0q0l8ibxlzxxsv125bc00-perl5.34.1-HTTP-Daemon-6.01'
unreferenced input: '/nix/store/9zv4ira7zaj43l4qs8fmfwmpqcgzal5j-python3.10-requests-2.28.1'
unreferenced input: '/nix/store/a1njnp0prd91ajyxvyndx3c1anrxqakj-python3.10-zope.event-4.5.0'
unreferenced input: '/nix/store/adh4n2lv5a558114jc1bra7v4khdnjds-gnugrep-3.7'
unreferenced input: '/nix/store/asghygvp9zdhawzh4f7zgyzs90w8n1w9-zstd-1.5.2-bin'
unreferenced input: '/nix/store/asy1an4r7gxpjwzxhq447rqllf78r4sl-perl5.34.1-WWW-RobotRules-6.02'
unreferenced input: '/nix/store/b4jsr7rj0ndi3ccxyc6pqyd916k8dya1-libdatrie-2019-12-20-lib'
unreferenced input: '/nix/store/b6jnw51f7b78xpcv8c7xqvrw7h4insmd-libkrb5-1.20'
unreferenced input: '/nix/store/b9py87ml4psrp577hh836fnlwz8y6wga-util-linux-minimal-2.38-bin'
unreferenced input: '/nix/store/ba8511amd3kp64mqslxh52db6wxz126a-libssh2-1.10.0'
unreferenced input: '/nix/store/bj63p6sp48ykxwibhh5a110zprs0cwxw-perl5.34.1-HTTP-Cookies-6.09'
unreferenced input: '/nix/store/bjac8pa2vhp3y0l3yydazygm1wcdjjhw-libunwind-1.6.2'
unreferenced input: '/nix/store/bkxq1nfi6grmww5756ynr1aph7w04lkk-strip.sh'
unreferenced input: '/nix/store/blx67p59lwbafj4q0lgqjj2wxsvfba5z-kmod-29'
unreferenced input: '/nix/store/bm4ggb7s5in5blnpnia89jbvwqwndx8x-python3.10-txaio-22.2.1'
unreferenced input: '/nix/store/bmzkh67rmxk5rlk38av3apjjpay6hqbd-gdbm-1.23'
unreferenced input: '/nix/store/bnj8d7mvbkg3vdb07yz74yhl3g107qq5-patch-shebangs.sh'
unreferenced input: '/nix/store/br1n9746v7r3r8llc56y26w5s2f38xgw-graphite2-1.3.14'
unreferenced input: '/nix/store/br6fi5axxyzjfwlwfdf0i9c446j4lk3s-python3.10-pyopenssl-22.0.0'
unreferenced input: '/nix/store/bv6y6aa0dcxz5wz6zwfy7qkchfxinynj-tpm2-tss-3.2.0'
unreferenced input: '/nix/store/c09cax555gxp0c44xcp49j0zb5mfdksy-libimagequant-2.17.0'
unreferenced input: '/nix/store/c0mh96q3wq6x1jc1zlliz36zcvpl44al-libmng-2.0.3'
unreferenced input: '/nix/store/c1qwjv446kg0y1vwp817hxl6vd199h7g-python3.10-six-1.16.0'
unreferenced input: '/nix/store/c2ziyca2xckkh9r5yfk71x82fv5nxp3p-libcap-ng-0.8.3'
unreferenced input: '/nix/store/c8fc7saagp0vm5ll5mccpfnhg957pfya-openssl-1.1.1q'
unreferenced input: '/nix/store/c8n9kcdddp9np665xz6ri61b383nxvz8-move-systemd-user-units.sh'
unreferenced input: '/nix/store/ccig2cllc7aff61n32xqmki5v0f84phl-openssl-1.1.1q-bin'
unreferenced input: '/nix/store/cgfn48i9bi7a0if8jhqqa54ga1mr1j9z-patch-2.7.6'
unreferenced input: '/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh'
unreferenced input: '/nix/store/cimqddkrm6s3b90mcg1ssr7w419n1aag-python3.10-setuptools-61.2.0'
unreferenced input: '/nix/store/clzhl7jvngb12ii903yv0acgn7g5g7sw-nodejs-16.16.0'
unreferenced input: '/nix/store/crxzvlzgspckg2sl0b5vhrjp43ysy05q-acl-2.3.1'
unreferenced input: '/nix/store/d45x4s45xczb8nn1gpwgnrr7gkkzvjbl-python3.10-defusedxml-0.7.1'
unreferenced input: '/nix/store/dbjq8gridilyf3qr37iwnkvr4b2a4jb2-libXmu-1.1.3'
unreferenced input: '/nix/store/ddhcwc8k9ma093n5vlpa9l617p4q2cax-python3-3.10.5'
unreferenced input: '/nix/store/dlqlqcsil96lvv2d715zdshcjs55f7vs-dns-root-data-2019-01-11'
unreferenced input: '/nix/store/dva14w1pfq7ydb9qa4ahv060cdlx82c4-libXt-1.2.1'
unreferenced input: '/nix/store/dwiqy7ixa584rb60lxc8hd10bjryx2ww-libpng-apng-1.6.37'
unreferenced input: '/nix/store/dy7i1aqsf0rfm91bcif0z5m9zg6clmd7-libxcb-1.14'
unreferenced input: '/nix/store/fa23chqwynhzpcmrnsasr9d9cya4bmr1-perl5.34.1-HTTP-Date-6.05'
unreferenced input: '/nix/store/fa9193pyz6hr5vq5rv3l26a3mdh1yfda-util-linux-minimal-2.38-lib'
unreferenced input: '/nix/store/fcyqa5s7j42gam1qkpkb10453d85zf7q-sqlite-3.39.0'
unreferenced input: '/nix/store/ff98lqrrlndgcai7hjrw50pjgdfmnixr-libpcap-1.10.1'
unreferenced input: '/nix/store/ffjvj65in9nf0jnlnjw03wbqmcq59k1c-gmp-with-cxx-6.2.1'
unreferenced input: '/nix/store/fg1c5471cbqv6gq3pgjf9ymqd7br7sxi-perl5.34.1-Net-DBus-1.2.0'
unreferenced input: '/nix/store/fg5dcgqpsxln6zbhy74kn207lvx8grvi-unbound-1.16.0-lib'
unreferenced input: '/nix/store/fjpwgjvk630m6qi4jqc8vrigs909rj33-linux-pam-1.5.2'
unreferenced input: '/nix/store/fm64blh4f1ri5gl89zqis3c95j4krgg0-lcms-1.19'
unreferenced input: '/nix/store/fqj3xkrj0f1cjzj8l4p7fwy5zqv3vhpg-bzip2-1.0.6.0.2-bin'
unreferenced input: '/nix/store/fqj4zsbs3wygril5sw6i576m5qqr0slj-perl5.34.1-Net-HTTP-6.19'
unreferenced input: '/nix/store/fv8xn9b7zkpijqz1ymax0sj09f93xs0h-findutils-4.9.0'
unreferenced input: '/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh'
unreferenced input: '/nix/store/gcmz84z1xp11g2mas19kl93n6733n1c9-perl5.34.1-File-DesktopEntry-0.22'
unreferenced input: '/nix/store/ghdm44s2nw13xzbb5vx7sqv767b10fyi-zstd-1.5.2'
unreferenced input: '/nix/store/gpxja6hj78bb5y4dl6q8fhaaz06c6rrr-kmod-29-lib'
unreferenced input: '/nix/store/h04wgbl8fw3hszj7ipk987rmn7mmdra6-perl5.34.1-URI-5.05'
unreferenced input: '/nix/store/h1d9sja6ag3pnpx2dq88ldblj002qwn1-kexec-tools-2.0.23'
unreferenced input: '/nix/store/hcwwirm1nv8gfanhyb8dvknq5k6piw6j-python3.10-graphviz-0.20'
unreferenced input: '/nix/store/hyhslaj9pm3kn0yrz8kwl7mn2haqj3w4-gnupg-2.3.6'
unreferenced input: '/nix/store/icfas3x8sjncazscgjbw620h90xh805b-perl5.34.1-HTML-Tagset-3.20'
unreferenced input: '/nix/store/ilxq10rj4ipx71iajk5v8gw6rj7n5wd6-nghttp2-1.47.0-lib'
unreferenced input: '/nix/store/ir0ipi4lf9gp90by9m2is1fw137i5zyz-libunistring-1.0'
unreferenced input: '/nix/store/j68ggbjcfriw4l17arkmsdvpdql8xm5l-python3.10-urllib3-1.26.9'
unreferenced input: '/nix/store/j6mb5m658k2gfln6g98fix2b2my5r5z6-brotli-1.0.9-lib'
unreferenced input: '/nix/store/j93s80sh0nw3zi4c8xq059xf5dvsdhcc-python3.10-typing-extensions-4.1.1'
unreferenced input: '/nix/store/jfqvyzcfxfgbknz45ywxv890s7hchydp-binutils-wrapper-2.38'
unreferenced input: '/nix/store/jimgrbw1rjxynj0r73ml7547s0kk5rp0-gd-2.3.3'
unreferenced input: '/nix/store/jmbdyj03ix6qbj4a2nbnj9xyfjhd2xgk-libtasn1-4.18.0'
unreferenced input: '/nix/store/jms0qmvwzjvzxqqzcbqri5fdhvznnrll-npth-1.6'
unreferenced input: '/nix/store/jr37chm9bm4zybdl3bndwsvz2v2kiwwy-icu4c-71.1-dev'
unreferenced input: '/nix/store/jz7vap7g8m6x75nwsz69sbmj64nz9p7x-curl-7.84.0'
unreferenced input: '/nix/store/k3421p8w6f6pgpcmrminbw1sznrdrvkl-libSM-1.2.3'
unreferenced input: '/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh'
unreferenced input: '/nix/store/kh7q9yjw6pw6kwasxrbq46hrw5yq6xh0-glibc-2.34-210-dev'
unreferenced input: '/nix/store/ki6wkv8pv6ghxqg9iv802vs7j2187gbr-readline-8.1p2'
unreferenced input: '/nix/store/kiwdwd6zw4svi9jlr95yg1p5pgpjxn1v-gcc-11.3.0'
unreferenced input: '/nix/store/kkd5jf46dlyhi8zlrj5yii5c9zzm0bq1-libvmaf-2.3.1'
unreferenced input: '/nix/store/krg7h3zww6iqdxmlryn8cdn6z4nri08x-libseccomp-2.5.4-lib'
unreferenced input: '/nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh'
unreferenced input: '/nix/store/l5c1v0i2qyxn1fjc8zl33fs060wgmqpn-python3.10-pysocks-1.7.1'
unreferenced input: '/nix/store/l71ibskyc3c6f6zcwwyw6n29dqmixphi-perl5.34.1-IPC-System-Simple-1.30'
unreferenced input: '/nix/store/lfgy5pindxh2lkx7zcrdrgx150lwnkly-diffutils-3.8'
unreferenced input: '/nix/store/lhwd3rbafl90hvn6np8r7swmyvdd5abs-brotli-1.0.9'
unreferenced input: '/nix/store/lja4s1npmwhl3i4wd4dgsy586vsys8kx-fribidi-1.0.12'
unreferenced input: '/nix/store/ll1g13msjqimlp11f8nnmh9lpbm76nh5-python3.10-attrs-21.4.0'
unreferenced input: '/nix/store/lpni2hi6b9nw5v12w50hn0glaj93z46c-python3.10-objgraph-3.5.0'
unreferenced input: '/nix/store/lygl5rqcy1rd9iwsjw75a32rxnw3nhgd-python3.10-hyperlink-21.0.0'
unreferenced input: '/nix/store/m54bmrhj6fqz8nds5zcj97w9s9bckc9v-compress-man-pages.sh'
unreferenced input: '/nix/store/m65iplxbqwdw5n2naw8b1jpa6sn4fbqn-openjpeg-2.4.0'
unreferenced input: '/nix/store/mcr86r36qsjpfcl31zqnkmac8hqjz8zr-p11-kit-0.24.1'
unreferenced input: '/nix/store/mhhlymrg2m70r8h94cwhv2d7a0c8l7g6-glibc-2.34-210'
unreferenced input: '/nix/store/mm35ra4g4nfabs070ndkbfi8cmlcllbf-python3.10-pillow-9.2.0'
unreferenced input: '/nix/store/msxzxag8la314k92xyq9xjdjsr7rdssd-libXft-2.3.4'
unreferenced input: '/nix/store/n1mwvg1fh2hn041nrxgv7wgxfnri13cd-python3.10-cryptography-37.0.2-dev'
unreferenced input: '/nix/store/n2066pv59564r5q6pf6nv5i87wwkl3jc-python3.10-autobahn-22.5.1'
unreferenced input: '/nix/store/n5f67a15nyxdpcvhg784ip2fd6p5knkm-perl5.34.1-TimeDate-2.33'
unreferenced input: '/nix/store/n8i81m3cqahpgc3ka5kw5cfmb4l8q2h9-gzip-1.12'
unreferenced input: '/nix/store/nflkwjys9j901pd2rhiwka7b94nq3x1p-perl5.34.1-IO-HTML-1.004'
unreferenced input: '/nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh'
unreferenced input: '/nix/store/npcz8z6zl27lzpy0b22isd6kb4ya2llj-fontconfig-2.14.0-lib'
unreferenced input: '/nix/store/p0alff0gm94c0v1iac9vds8j5yz20jsm-python3.10-constantly-15.1.0'
unreferenced input: '/nix/store/p15id6iy68v5kdw2bc27jagq3xfkkc6m-audit-2.8.5'
unreferenced input: '/nix/store/p2mxc5x4h4578f4l0948h98xl3yqdjxj-libjpeg-turbo-2.1.3'
unreferenced input: '/nix/store/p2zvdzkk3iy4lmdxp4wpm7rpa20yk8j2-libXxf86misc-1.0.4'
unreferenced input: '/nix/store/p6p1znkixi1v9v1dp1yanxv506xpcxj2-cryptsetup-2.4.3'
unreferenced input: '/nix/store/pk6rx7z6x79j9bf2xjw2hj0hivk5bp7j-gmp-with-cxx-stage4-6.2.1'
unreferenced input: '/nix/store/pkv4ngqc7arfqpr1bsn1bappvms9xbfg-ncurses-6.3-p20220507'
unreferenced input: '/nix/store/plc0am3vk8g3qp92rzyc3h6f865fm3c8-perl5.34.1-File-Listing-6.14'
unreferenced input: '/nix/store/q04ndck29fxx52ywjck0nz651pg8f2da-libassuan-2.5.5'
unreferenced input: '/nix/store/q2bfdxjdp2pgn0zjwihx2kfn5pjmdrka-pixman-0.38.4'
unreferenced input: '/nix/store/qi72jcssdgv54lyi0i2sxl4clasgivvp-python3.10-pixelmatch-0.2.3'
referenced input: '/nix/store/qm2lv1gpbyn0rsfai40cbvj3h4gz69yc-bash-5.1-p16'
unreferenced input: '/nix/store/r1z5dmv57hz4r7n1wz47d513y1lwmwf5-libglvnd-1.4.0'
unreferenced input: '/nix/store/r3ffx22l0n6hqgnkgwpinxvld4wg0knd-python3.10-idna-3.3'
unreferenced input: '/nix/store/r5irs2c2gwdpqc41mqqa5p4y4rv50ri0-libapparmor-3.0.4'
unreferenced input: '/nix/store/r84h8x2yf2k49zw79szk2vq91l9hh4ls-python3.10-cffi-1.15.0'
unreferenced input: '/nix/store/ranxwhhmighjrci7wvdqa1aydjnxjn58-perl5.34.1-HTTP-Message-6.26'
unreferenced input: '/nix/store/rm0bjn38lch9is6vdxkca7gzczfcwm8p-libaom-3.4.0'
unreferenced input: '/nix/store/rndnackq5sfn55nrlrirdgadxhb604xv-shadow-4.11.1'
unreferenced input: '/nix/store/rywldam7wdjz9jq8ypsid0mrd9yfjchx-libwebp-1.2.2'
unreferenced input: '/nix/store/s308fv4yghaaszvq4b81hqwhly73a94w-libsodium-1.0.18'
unreferenced input: '/nix/store/s822yd3lxx8qqsycdjimsp3mkivs4ip0-bash-interactive-5.1-p16'
unreferenced input: '/nix/store/s9w4phpzigyn6gjgnjczavjrz1rs26rk-patchelf-0.14.5'
unreferenced input: '/nix/store/sim53649a214v6ylffd2m4mpfi0d92h2-libmnl-1.0.5'
unreferenced input: '/nix/store/slkw2qamzs6w441jgan1nj64xzwcgwmw-glibc-2.34-210-bin'
unreferenced input: '/nix/store/sn0w3f12547crckss4ybmnxmi29gpgq7-perl-5.34.1'
unreferenced input: '/nix/store/snka837wchx0273lgxj24rsbrfcsxjbh-libmicrohttpd-0.9.71'
unreferenced input: '/nix/store/sp6l7jxpvvcal90d97k4q279klipkyzk-python3.10-brotlicffi-1.0.9.2'
unreferenced input: '/nix/store/v3nqcmbakm5w35cmsjr7njnn2r0c0b6s-python3.10-pycparser-2.21'
unreferenced input: '/nix/store/vqc65iaklkrzik47fkrjh45bry59617n-perl5.34.1-File-BaseDir-0.08'
unreferenced input: '/nix/store/vqvb3nqvsd966dil9wxj12xaak1rk8s8-pcre2-10.40'
unreferenced input: '/nix/store/w013k52pn14hvbaa484clfyhjr71vz0m-perl5.34.1-HTML-Parser-3.75'
unreferenced input: '/nix/store/w25nadr7247krvg5nbxr9slnhq76dakc-zlib-1.2.12'
unreferenced input: '/nix/store/whzgd9sc1w1py2jlg1mjx41a9psczi8g-python3.10-zope.interface-5.4.0'
unreferenced input: '/nix/store/wi9s83h32bp710xk12hjjirs17qw0adn-lz4-1.9.3'
unreferenced input: '/nix/store/wk80kwic58ibbny6qd6aj09j5300g4j9-libnetfilter_conntrack-1.0.9'
unreferenced input: '/nix/store/wlwcf1nw2b21m4gghj70hbg1v7x53ld8-reproducible-builds.sh'
unreferenced input: '/nix/store/wmx6zyv93xh0mkkkzdl4iv2wqmk1pixb-libtiff-4.4.0'
unreferenced input: '/nix/store/wn8f0dkqslcjsdpslkdh59wk4y89k58p-perl5.34.1-libwww-perl-6.49'
unreferenced input: '/nix/store/ws0i7411sfkgalyhjdjagy7hh0978iqd-brotli-1.0.9-dev'
unreferenced input: '/nix/store/wv2wmjwlfg983rmyanq5xip5b3wk6gfi-libdevil-1.7.8'
unreferenced input: '/nix/store/x0cpggi73rhsm6cwfl9r8q0qvzx72ysl-libXext-1.3.4'
unreferenced input: '/nix/store/x1fnzd0x00i5k5snws34wfpb04h03mah-getent-glibc-2.34-210'
unreferenced input: '/nix/store/x245mr0plg22mv2iqav38fpc1q54gc96-python3.10-incremental-21.3.0'
unreferenced input: '/nix/store/x2iscnhs0jb0fzkz4jss3mmgqhq8vx9a-mailcap-2.1.53'
unreferenced input: '/nix/store/x5lhccdgfzqpw4r6pbyda6fn0r6hgwif-perl5.34.1-Test-Needs-0.002006'
unreferenced input: '/nix/store/x9cfrhcyxc4svwk8rj673a2vm1b1hjhp-libdeflate-1.8'
unreferenced input: '/nix/store/x9zh2nh0dqwisgmj7avnysk35xm45g2y-libICE-1.0.10'
unreferenced input: '/nix/store/xbj2a91nnkmsls4li1rfzwqhfbl9qr1j-perl5.34.1-File-MimeInfo-0.30'
unreferenced input: '/nix/store/xc4ci9nqrznz40cvxyjxsyjmv82fnrr2-playwright-driver'
unreferenced input: '/nix/store/xdiqmcqq3fj5jl96d82ql6jbmqhpssgh-fontconfig-2.14.0'
unreferenced input: '/nix/store/xgr8zb2sj6g30qfhk7p7mv0ygxck6z8i-cairo-1.16.0'
unreferenced input: '/nix/store/xh8rxq44ywv84sq949b3yvfbp2ss1qvl-gnutar-1.34'
unreferenced input: '/nix/store/xhr8ij9x25hbknimvy2wcgcx146xclzs-gts-0.7.6'
unreferenced input: '/nix/store/xjmm9xg5sq47q63cbf447qalz9fmwp0v-gcc-11.3.0-lib'
unreferenced input: '/nix/store/xkpywyg8g81vgpq57qflm33xhbhjxkdq-libevent-2.1.12'
unreferenced input: '/nix/store/xnf46w87vh4767drx2p6xf8v317h2rny-xset-1.2.4'
unreferenced input: '/nix/store/xpy48miz1rqzm7ziy0nrxr0vylvqrz98-coreutils-9.1'
unreferenced input: '/nix/store/xq6y6xgd4n53gz3jgggap4dk5w7zxvpz-libnftnl-1.2.2'
unreferenced input: '/nix/store/xymxq6nz3j103fqz5y67115dmw4k5hjb-perl5.34.1-Test-Fatal-0.016'
unreferenced input: '/nix/store/xz432xs7qjpkzl1nfanmqlnslclqx76w-xdg-utils-unstable-2020-10-21'
unreferenced input: '/nix/store/y10cmxp9jwiawg4pd0899wlwbpqc6fy3-perl5.34.1-Encode-Locale-1.05'
unreferenced input: '/nix/store/y4yj3wpfgaiggfl6smaw75pladshjhgg-perl5.34.1-XML-Twig-3.52'
unreferenced input: '/nix/store/y7lvvrqhb3bqslnd1zshk76cv99min71-systemd-minimal-250.4'
unreferenced input: '/nix/store/yhkn33x0ncx2zfk6a6dy8cdsjhs15hzg-dbus-1.14.0-lib'
unreferenced input: '/nix/store/yjjr1aq8x343lq9kiws0y331iw4vy76h-python3.10-cffi-1.15.0-dev'
unreferenced input: '/nix/store/ylkbxgb1p36if4vwvc074zciajzgwyxa-xz-5.2.5'
unreferenced input: '/nix/store/yrr5spsagdzib7hgnz22j3vfks0m0snk-libcap-2.63-lib'
unreferenced input: '/nix/store/yyq2prdvp50s11hwfza5mijrjfifn03r-graphviz-3.0.0'
unreferenced input: '/nix/store/z1cqqkm53br9cqfir8vnzwdzrik0i48q-python3.10-pynacl-1.5.0'
unreferenced input: '/nix/store/z3xnm5ij8qiqnwrx3ini5ifm5mvy5pqm-elfutils-0.187'
unreferenced input: '/nix/store/z60d8hp5x3npsa87wpf7c8i91md7psbd-expand-response-params'
unreferenced input: '/nix/store/z6alvcgz1d7n1n2498fvs2czj42ymkrd-libffi-3.4.2'
unreferenced input: '/nix/store/z7d05z5y6ggb9nvyn4nbjs6850r3r6ih-tzdata-2022a'
unreferenced input: '/nix/store/zav9ihd3507c8qm2iwjy1xj6c2ynd1n4-perl5.34.1-Try-Tiny-0.30'
unreferenced input: '/nix/store/zcxdmxmwq796bwy595pj7inkijfkbw3p-libfido2-1.10.0'
unreferenced input: '/nix/store/zpi127lx7rvm4brxklgzinndbnhd342y-perl5.34.1-X11-Protocol-0.56'
unreferenced input: '/nix/store/zpvq7njsx28yjzfg4n97l83sm0gdhk4c-pango-1.50.7'
lock released on '/nix/store/g2clr8qscq2ax8vl15f0di8d5arxsq0g-playwright-browsers.lock'
lock released on '/nix/store/mkssfmx9vy7izyxy6ylqys9lnblbymaq-playwright-browsers.lock'

Notice the package first gets built in the temporary location /nix/store/mkssfmx9vy7izyxy6ylqys9lnblbymaq-playwright-browsers and then gets moved to /nix/store/g2clr8qscq2ax8vl15f0di8d5arxsq0g-playwright-browsers. The latter is also the one I get when running nix build .#playwright-browsers. As far as I understand, this is because it’s a fixed-output derivation and this is to support self-referencing closures (please correct me if I’m wrong here). The problem is that the final output is still referring to the temporary path instead of the final output:

#!/nix/store/qm2lv1gpbyn0rsfai40cbvj3h4gz69yc-bash-5.1-p16/bin/bash
export PLAYWRIGHT_BROWSERS_PATH=/nix/store/mkssfmx9vy7izyxy6ylqys9lnblbymaq-playwright-browsers
exec /nix/store/x5j5mh1hbh8yf8nl5r6gqcdvp4qjckxh-myapp-0.0.1/bin/myapp "$@"

Judging by the further logs, it seems that Nix’s dependency tracking searches for g2clr8qscq2ax8vl15f0di8d5arxsq0g in the final closure, doesn’t find it and then concludes that myapp doesn’t depend on playwright-browsers.

I guess my question here is the following: why does ${playwright-browsers} evaluate to the temporary store path and not the final output path? And why does the behaviour differ under Linux and Darwin? Also, I don’t really understand why this happens (again, under Linux):

# nix path-info --derivation /nix/store/mkssfmx9vy7izyxy6ylqys9lnblbymaq-playwright-browsers
/nix/store/x1pp4hhlhy2js8wrhfj9q3a5q8snnv73-playwright-browsers.drv
# nix path-info --derivation /nix/store/g2clr8qscq2ax8vl15f0di8d5arxsq0g-playwright-browsers
error: '/nix/store/g2clr8qscq2ax8vl15f0di8d5arxsq0g-playwright-browsers' does not have a known deriver

Why doesn’t the final output have a deriver?

I’d greatly appretiate it if anyone had any insights on how to continue debugging this. Thanks!

Adding to the previous weirdness, when I remove these lines everything works as expected:

${lib.optionalString stdenv.isLinux ''
  autoPatchelf $out --ignore-missing="*"
''}

Playwright itself doesn’t work anymore since the browser binaries haven’t been patched, but the Nix closure for myapp does contain playwright-browsers as a dependency. nix why-depends is happy as well.

Remember fixed-output dependencies are like content-address derivation
so /nix/store paths are not allowed into it. If you patchelf source you
are injecting /nix/store paths.

So, you get source first, raw.

Then you patch it using a normal derivation.

Ah thanks, I’ll try that and post again.

Is there any documentation on not allowing Store references in fixed-output or content addressed derivations? The only thing I found was this RFC which doesn’t really state so.

No documentation AFAIK but two related issues:

https://github.com/NixOS/nix/issues/5509
https://github.com/NixOS/nix/issues/4859

Thanks again, I got it working by using the FOD as the src and then building the patched version using mkDerivation.

For anyone else coming here, check out this thread as well: FOD's `$out/bin/<binary>` is not available in `$PATH`. Is this expected?