{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/36903","repository_url":"https://api.github.com/repos/NixOS/nixpkgs","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/36903/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/36903/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/36903/events","html_url":"https://github.com/NixOS/nixpkgs/issues/36903","id":304710713,"number":36903,"title":"qt*: Failing builds with nix-build, success in nix-shell","user":{"login":"YorikSar","id":428074,"avatar_url":"https://avatars2.githubusercontent.com/u/428074?v=4","gravatar_id":"","url":"https://api.github.com/users/YorikSar","html_url":"https://github.com/YorikSar","followers_url":"https://api.github.com/users/YorikSar/followers","following_url":"https://api.github.com/users/YorikSar/following{/other_user}","gists_url":"https://api.github.com/users/YorikSar/gists{/gist_id}","starred_url":"https://api.github.com/users/YorikSar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YorikSar/subscriptions","organizations_url":"https://api.github.com/users/YorikSar/orgs","repos_url":"https://api.github.com/users/YorikSar/repos","events_url":"https://api.github.com/users/YorikSar/events{/privacy}","received_events_url":"https://api.github.com/users/YorikSar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2018-03-13T10:40:15Z","updated_at":"2018-03-13T20:02:25Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"## Issue description\r\n\r\nWhen I try to rebuild qt packages (e.g. qtlocation, qtmultimedia), they fail if I build them using `nix-build`:\r\n\r\n```\r\n% nix-build -A qt5.qtlocation ~/src/github.com/NixOS/nixpkgs --check -K\r\nchecking outputs of '/nix/store/8x4y45gfvbq9z250srx2sx47p1w99dg6-qtlocation-5.10.1.drv'...\r\nunpacking sources\r\nunpacking source archive /nix/store/97xjqh1vlrgws0xz5qapz13k4w9fms73-qtlocation-everywhere-src-5.10.1.tar.xz\r\n....\r\nqgeoshape.cpp:451:10: fatal error: moc_qgeoshape.cpp: No such file or directory\r\n #include \"moc_qgeoshape.cpp\"\r\n          ^~~~~~~~~~~~~~~~~~~\r\ncompilation terminated.\r\nmake[2]: *** [Makefile:881: .obj/qgeoshape.o] Error 1\r\nmake[2]: Leaving directory '/build/qtlocation-everywhere-src-5.10.1/src/positioning'\r\nmake[1]: *** [Makefile:127: sub-positioning-make_first] Error 2\r\nmake[1]: Leaving directory '/build/qtlocation-everywhere-src-5.10.1/src'\r\nmake: *** [Makefile:47: sub-src-make_first] Error 2\r\nnote: keeping build directory '/tmp/nix-build-qtlocation-5.10.1.drv-3'\r\nbuilder for '/nix/store/8x4y45gfvbq9z250srx2sx47p1w99dg6-qtlocation-5.10.1.drv' failed with exit code 2\r\n```\r\n\r\nBut if I run `genericBuild` in corresponding `nix-shell`, it builds just fine:\r\n\r\n```\r\n % nix-shell -A qt5.qtlocation ~/src/github.com/NixOS/nixpkgs --pure\r\n\r\n[nix-shell:~/tmp/qtlocation]$ genericBuild\r\nunpacking sources\r\nunpacking source archive /nix/store/97xjqh1vlrgws0xz5qapz13k4w9fms73-qtlocation-everywhere-src-5.10.1.tar.xz\r\n...\r\npostPatchMkspecs\r\npostPatchMkspecs\r\npostPatchMkspecs\r\n\r\n[nix-shell:~/tmp/qtlocation/qtlocation-everywhere-src-5.10.1]$\r\n```\r\n\r\n## Technical details\r\n\r\nWhen I build these packages with `nix-build`, they fail with errors like this:\r\n\r\n```\r\nqgeoshape.cpp:451:10: fatal error: moc_qgeoshape.cpp: No such file or directory\r\n #include \"moc_qgeoshape.cpp\"\r\n          ^~~~~~~~~~~~~~~~~~~\r\ncompilation terminated.\r\n```\r\n\r\nAbove this I see command that should've produced this file:\r\n\r\n```\r\nDQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_POSITIONING_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB --include .moc/moc_predefs.h -I/nix/store/w68c6s4vmhamcpj5bnm7gs8w6imn9igl-qtbase-5.10.1-dev/mkspecs/linux-g++ -I/build/qtlocation-everywhere-src-5.10.1/src/positioning -I/build/qtlocation-everywhere-src-5.10.1/src/3rdparty/clipper -I/build/qtlocation-everywhere-src-5.10.1/src/3rdparty/clip2tri -I/build/qtlocation-everywhere-src-5.10.1/include -I/build/qtlocation-everywhere-src-5.10.1/include/QtPositioning -I/build/qtlocation-everywhere-src-5.10.1/include/QtPositioning/5.10.1 -I/build/qtlocation-everywhere-src-5.10.1/include/QtPositioning/5.10.1/QtPositioning -I/nix/store/w68c6s4vmhamcpj5bnm7gs8w6imn9igl-qtbase-5.10.1-dev/include/QtCore/5.10.1 -I/nix/store/w68c6s4vmhamcpj5bnm7gs8w6imn9igl-qtbase-5.10.1-dev/include/QtCore/5.10.1/QtCore -I/nix/store/w68c6s4vmhamcpj5bnm7gs8w6imn9igl-qtbase-5.10.1-dev/include/QtCore -I/nix/store/w68c6s4vmhamcpj5bnm7gs8w6imn9igl-qtbase-5.10.1-dev/include -I/nix/store/srsdzgb5sha89xas7afprawvsrdgbsm2-libxml2-2.9.7-dev/include -I/nix/store/8bsyix63bn598h4vr6zkx9r5yhv8f13r-zlib-1.2.11-dev/include -I/nix/store/vgjgzgxiygc0spkvkp0rlx14d41yqal4-libxslt-1.1.32-dev/include -I/nix/store/0wga3v5h2r8vc05z3vpshijqz5m715sv-openssl-1.0.2n-dev/include -I/nix/store/gzcly4bpvm78alliyl8vbzjdxm3bsgfv-sqlite-3.21.0-dev/include -I/nix/store/dimi5balffxkzzzkz0vk1n8rq41mzmrz-harfbuzz-icu-1.7.1-dev/include -I/nix/store/wxmnqfysl15fbvzk3zlq37g1cf8anmc7-graphite2-1.3.6/include -I/nix/store/kwdbw37kpgym0a1bnd5yczcsxl84vya4-icu4c-59.1-dev/include -I/nix/store/dk3k1mc5imm7hvgj3w5wrk4pdl57y7im-harfbuzz-1.7.1-dev/include -I/nix/store/g5wlw7fshg23288pbqyc505vm6ilhqxm-libjpeg-turbo-1.5.3-dev/include -I/nix/store/k9fjbxm37cq6pv0m4j9hp74lg64p038z-libpng-apng-1.6.34-dev/include -I/nix/store/vaqvlcgav3ly3hdx5yvk6gssnh5b9wkb-libtiff-4.0.9-dev/include -I/nix/store/ww996cjyv9gdsfvg5v6467adp5x00fjp-xz-5.2.3-dev/include -I/nix/store/4r245j70hjdhs5n43bi00v3s4yxivwhi-pcre2-10.23-dev/include -I/nix/store/0pc7ca08jlc72qrphj8dix7q3vxwrnib-dbus-1.10.24-dev/include -I/nix/store/8ncpzbdgbwg3h8889w67fmb0ay06dpm1-expat-2.2.5-dev/include -I/nix/store/mrwb1hl55dar8f894m1yjyg6gb8c0sjv-glib-2.54.3-dev/include -I/nix/store/yb9axzdqhnamqssl2i9l8kl30x22pcb9-libffi-3.2.1-dev/include -I/nix/store/zxr2dbnrjfxlajc5r85y4rkfyzlpa779-glibc-iconv-2.26-131/include -I/nix/store/sdl8llfdw3spnl11grqxwzsls0wnshw5-systemd-237-dev/include -I/nix/store/mjd14vm0kmbya4zxniim8f2xby4ymxsc-fontconfig-2.12.1-dev/include -I/nix/store/9yksdd65yard03m7ads6mysrxgnnmdss-freetype-2.7.1-dev/include -I/nix/store/yhzxhwikm403q7m01g63rr0rzvrsg825-bzip2-1.0.6.0.1-dev/include -I/nix/store/0gc554j89skias9cbl4vssjj5wwppg17-libX11-1.6.5-dev/include -I/nix/store/z1zcy1jj3qhhsb1qfdwajf7rfilhnsyn-libxcb-1.12-dev/include -I/nix/store/sl5cjzdpd2vk1lam52sxh4nyqa6s72zl-xproto-7.0.31/include -I/nix/store/8rw2fvr5xrmc8ri0i7l2v1fvabkp18r8-kbproto-1.0.7/include -I/nix/store/gzjha6bwkcsicyi87ghwhhzfwmxx24qy-libXcomposite-0.4.4-dev/include -I/nix/store/j7gnlw6q9pml9kszm3cawwf91pm1mi66-libXfixes-5.0.2-dev/include -I/nix/store/jwbfi28vwyzjijr50zbkb98q7xa3zvij-fixesproto-5.0/include -I/nix/store/j38nc3a31ship4vznz5q33hizngifgbv-xextproto-7.3.0/include -I/nix/store/xrdpdcidbngwwwia41ads3rlhxnv3xnv-compositeproto-0.4.2/include -I/nix/store/2as4dsl4rb8yq96y15rrad2fx6ijcdm5-libXext-1.3.3-dev/include -I/nix/store/pfldr84r68dg1rybrrfl7l03jhws4ph1-libXau-1.0.8-dev/include -I/nix/store/bqqw2i0phvf0pkrfmkh0lk9qa8hblx31-libXi-1.7.9-dev/include -I/nix/store/fss7sk3lrr4v19qp3h5narp4xlyrzps6-inputproto-2.3.2/include -I/nix/store/x9fc2wqjhqmb9cmn1y4219a72j77zkcp-libXrender-0.9.10-dev/include -I/nix/store/k4wb4vyja1dcjqxpfgvzznwhg30nvhkp-renderproto-0.11.1/include -I/nix/store/wvrg44x4f393s4g689q1yv58473nvmfj-libxkbcommon-0.7.2-dev/include -I/nix/store/0yl66ci0msriryd1a21j033wwm7blijp-xcb-util-0.4.0-dev/include -I/nix/store/49wshbv121ldr8fdndx8zqrih1ypww41-xcb-util-image-0.4.0-dev/include -I/nix/store/y28c7j0jpshhh2xkswnr97ww7dgj6m1k-xcb-util-keysyms-0.4.0-dev/include -I/nix/store/97w0l14k3blvwnj25xsdk16r3r5rk6m7-xcb-util-renderutil-0.3.9-dev/include -I/nix/store/5d8iwz4fnq745c7jmgnj88r9yx7k5vj0-xcb-util-wm-0.4.1-dev/include -I/nix/store/y42ar31cdxac3665kqshps55fnj3d3wh-mesa-noglu-17.3.3-dev/include -I/nix/store/gk6zg2b4f6f02mg3ny32vb9gqbsfa4bx-libXdamage-1.1.4-dev/include -I/nix/store/2ym5x49h8fjyghjbzg3b0krcz0kqiswa-damageproto-1.2.1/include -I/nix/store/vabl04b4q87cm0m6psnp1xj17yg4j3lv-libXxf86vm-1.1.4-dev/include -I/nix/store/gsdakxyxgzb2j0fch1hgb9zq8cppasxa-xf86vidmodeproto-2.3.1/include -I/nix/store/10zl5galwmlvm4pjamd0w3z65ia2lg70-libdrm-2.4.89-dev/include -I/nix/store/7m2gm0bch4fz44ynhsrg698q6sjjjvzh-qtmultimedia-5.10.1-dev/include -I/nix/store/sy30fj21glx4pqdnz49w0ax6w7j0fwlr-qtdeclarative-5.10.1-dev/include -I/nix/store/3mg2j43822970xdha06p9wzh2pwgli56-qtsvg-5.10.1-dev/include -I/nix/store/kchqlw0pwihmh75cjji5gi32xy48phwk-qtxmlpatterns-5.10.1-dev/include -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/include/c++/7.3.0 -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/include/c++/7.3.0/x86_64-unknown-linux-gnu -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/include/c++/7.3.0/backward -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/include -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/include -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/include-fixed -I/nix/store/p85kjy91dfvs4in358zyfxlksvibw0zn-glibc-2.26-131-dev/include qgeoshape.h -o .moc/moc_qgeoshape.cpp\r\n/nix/store/zqh3l3lyw32q1ayb15bnvg9f24j5v2p0-bash-4.4-p12/bin/bash: DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT: command not found\r\nmake[2]: [Makefile:656: .moc/moc_qgeoshape.cpp] Error 127 (ignored)\r\n```\r\n\r\nSo it should've called `moc`, but instead just called its args without `moc` in front. Looking at corresponding Makefile I see this clause:\r\n\r\n```makefile\r\n.moc/moc_qgeoshape.cpp: ../../include/QtPositioning/QGeoCoordinate \\\r\n                ../../include/QtPositioning/qgeocoordinate.h \\\r\n                qgeocoordinate.h \\\r\n                ../../include/QtPositioning/qpositioningglobal.h \\\r\n                qpositioningglobal.h \\\r\n                qgeoshape.h \\\r\n                .moc/moc_predefs.h\r\n        $(DEFINES) --include .moc/moc_predefs.h -I/nix/store/w68c6s4vmhamcpj5bnm7gs8w6imn9igl-qtbase-5.10.1-dev/mkspecs/linux-g++ -I/build/qtlocation-everywhere-src-5.10.1/src/positioning -I/build/qtlocation-everywhere-src-5.10.1/src/3rdparty/clipper -I/build/qtlocation-everywhere-src-5.10.1/src/3rdparty/clip2tri -I/build/qtlocation-everywhere-src-5.10.1/include -I/build/qtlocation-everywhere-src-5.10.1/include/QtPositioning -I/build/qtlocation-everywhere-src-5.10.1/include/QtPositioning/5.10.1 -I/build/qtlocation-everywhere-src-5.10.1/include/QtPositioning/5.10.1/QtPositioning -I/nix/store/w68c6s4vmhamcpj5bnm7gs8w6imn9igl-qtbase-5.10.1-dev/include/QtCore/5.10.1 -I/nix/store/w68c6s4vmhamcpj5bnm7gs8w6imn9igl-qtbase-5.10.1-dev/include/QtCore/5.10.1/QtCore -I/nix/store/w68c6s4vmhamcpj5bnm7gs8w6imn9igl-qtbase-5.10.1-dev/include/QtCore -I/nix/store/w68c6s4vmhamcpj5bnm7gs8w6imn9igl-qtbase-5.10.1-dev/include -I/nix/store/srsdzgb5sha89xas7afprawvsrdgbsm2-libxml2-2.9.7-dev/include -I/nix/store/8bsyix63bn598h4vr6zkx9r5yhv8f13r-zlib-1.2.11-dev/include -I/nix/store/vgjgzgxiygc0spkvkp0rlx14d41yqal4-libxslt-1.1.32-dev/include -I/nix/store/0wga3v5h2r8vc05z3vpshijqz5m715sv-openssl-1.0.2n-dev/include -I/nix/store/gzcly4bpvm78alliyl8vbzjdxm3bsgfv-sqlite-3.21.0-dev/include -I/nix/store/dimi5balffxkzzzkz0vk1n8rq41mzmrz-harfbuzz-icu-1.7.1-dev/include -I/nix/store/wxmnqfysl15fbvzk3zlq37g1cf8anmc7-graphite2-1.3.6/include -I/nix/store/kwdbw37kpgym0a1bnd5yczcsxl84vya4-icu4c-59.1-dev/include -I/nix/store/dk3k1mc5imm7hvgj3w5wrk4pdl57y7im-harfbuzz-1.7.1-dev/include -I/nix/store/g5wlw7fshg23288pbqyc505vm6ilhqxm-libjpeg-turbo-1.5.3-dev/include -I/nix/store/k9fjbxm37cq6pv0m4j9hp74lg64p038z-libpng-apng-1.6.34-dev/include -I/nix/store/vaqvlcgav3ly3hdx5yvk6gssnh5b9wkb-libtiff-4.0.9-dev/include -I/nix/store/ww996cjyv9gdsfvg5v6467adp5x00fjp-xz-5.2.3-dev/include -I/nix/store/4r245j70hjdhs5n43bi00v3s4yxivwhi-pcre2-10.23-dev/include -I/nix/store/0pc7ca08jlc72qrphj8dix7q3vxwrnib-dbus-1.10.24-dev/include -I/nix/store/8ncpzbdgbwg3h8889w67fmb0ay06dpm1-expat-2.2.5-dev/include -I/nix/store/mrwb1hl55dar8f894m1yjyg6gb8c0sjv-glib-2.54.3-dev/include -I/nix/store/yb9axzdqhnamqssl2i9l8kl30x22pcb9-libffi-3.2.1-dev/include\r\n-I/nix/store/zxr2dbnrjfxlajc5r85y4rkfyzlpa779-glibc-iconv-2.26-131/include -I/nix/store/sdl8llfdw3spnl11grqxwzsls0wnshw5-systemd-237-dev/include -I/nix/store/mjd14vm0kmbya4zxniim8f2xby4ymxsc-fontconfig-2.12.1-dev/include\r\n-I/nix/store/9yksdd65yard03m7ads6mysrxgnnmdss-freetype-2.7.1-dev/include -I/nix/store/yhzxhwikm403q7m01g63rr0rzvrsg825-bzip2-1.0.6.0.1-dev/include -I/nix/store/0gc554j89skias9cbl4vssjj5wwppg17-libX11-1.6.5-dev/include -I/nix/store/z1zcy1jj3qhhsb1qfdwajf7rfilhnsyn-libxcb-1.12-dev/include -I/nix/store/sl5cjzdpd2vk1lam52sxh4nyqa6s72zl-xproto-7.0.31/include -I/nix/store/8rw2fvr5xrmc8ri0i7l2v1fvabkp18r8-kbproto-1.0.7/include -I/nix/store/gzjha6bwkcsicyi87ghwhhzfwmxx24qy-libXcomposite-0.4.4-dev/include -I/nix/store/j7gnlw6q9pml9kszm3cawwf91pm1mi66-libXfixes-5.0.2-dev/include -I/nix/store/jwbfi28vwyzjijr50zbkb98q7xa3zvij-fixesproto-5.0/include -I/nix/store/j38nc3a31ship4vznz5q33hizngifgbv-xextproto-7.3.0/include -I/nix/store/xrdpdcidbngwwwia41ads3rlhxnv3xnv-compositeproto-0.4.2/include -I/nix/store/2as4dsl4rb8yq96y15rrad2fx6ijcdm5-libXext-1.3.3-dev/include -I/nix/store/pfldr84r68dg1rybrrfl7l03jhws4ph1-libXau-1.0.8-dev/include -I/nix/store/bqqw2i0phvf0pkrfmkh0lk9qa8hblx31-libXi-1.7.9-dev/include -I/nix/store/fss7sk3lrr4v19qp3h5narp4xlyrzps6-inputproto-2.3.2/include -I/nix/store/x9fc2wqjhqmb9cmn1y4219a72j77zkcp-libXrender-0.9.10-dev/include -I/nix/store/k4wb4vyja1dcjqxpfgvzznwhg30nvhkp-renderproto-0.11.1/include -I/nix/store/wvrg44x4f393s4g689q1yv58473nvmfj-libxkbcommon-0.7.2-dev/include -I/nix/store/0yl66ci0msriryd1a21j033wwm7blijp-xcb-util-0.4.0-dev/include -I/nix/store/49wshbv121ldr8fdndx8zqrih1ypww41-xcb-util-image-0.4.0-dev/include -I/nix/store/y28c7j0jpshhh2xkswnr97ww7dgj6m1k-xcb-util-keysyms-0.4.0-dev/include -I/nix/store/97w0l14k3blvwnj25xsdk16r3r5rk6m7-xcb-util-renderutil-0.3.9-dev/include -I/nix/store/5d8iwz4fnq745c7jmgnj88r9yx7k5vj0-xcb-util-wm-0.4.1-dev/include -I/nix/store/y42ar31cdxac3665kqshps55fnj3d3wh-mesa-noglu-17.3.3-dev/include -I/nix/store/gk6zg2b4f6f02mg3ny32vb9gqbsfa4bx-libXdamage-1.1.4-dev/include -I/nix/store/2ym5x49h8fjyghjbzg3b0krcz0kqiswa-damageproto-1.2.1/include -I/nix/store/vabl04b4q87cm0m6psnp1xj17yg4j3lv-libXxf86vm-1.1.4-dev/include -I/nix/store/gsdakxyxgzb2j0fch1hgb9zq8cppasxa-xf86vidmodeproto-2.3.1/include -I/nix/store/10zl5galwmlvm4pjamd0w3z65ia2lg70-libdrm-2.4.89-dev/include -I/nix/store/7m2gm0bch4fz44ynhsrg698q6sjjjvzh-qtmultimedia-5.10.1-dev/include -I/nix/store/sy30fj21glx4pqdnz49w0ax6w7j0fwlr-qtdeclarative-5.10.1-dev/include -I/nix/store/3mg2j43822970xdha06p9wzh2pwgli56-qtsvg-5.10.1-dev/include -I/nix/store/kchqlw0pwihmh75cjji5gi32xy48phwk-qtxmlpatterns-5.10.1-dev/include -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/include/c++/7.3.0 -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/include/c++/7.3.0/x86_64-unknown-linux-gnu -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/include/c++/7.3.0/backward -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/include -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/include -I/nix/store/bm7pb1s7rx1ad80706b5xqrznq7fgpgx-gcc-7.3.0/lib/gcc/x86_64-unknown-linux-gnu/7.3.0/include-fixed -I/nix/store/p85kjy91dfvs4in358zyfxlksvibw0zn-glibc-2.26-131-dev/include qgeoshape.h -o .moc/moc_qgeoshape.cpp\r\n```\r\n\r\nSo it seems it didn't substitute `moc` call properly, so command line started with `-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT` and so `make` dropped leading `-` and ignored resulting failure.\r\n\r\nDigging deeper, I added `qmakeFlags = [ \"-d\" ];` to `pkgs/development/libraries/qt-5/modules/qtlocation.nix` and from resulting logs I can see that when I build with `nix-build`, `qmake` fails to find `moc` binary because shell that is being run doesn't have `command` builtin:\r\n\r\n```\r\nDEBUG 1: /nix/store/gfnlb4vixsnlzh0s429c7nk247zf3xni-qtbase-5.10.1-dev/mkspecs/features/qt_functions.prf:72: calling built-in $$system(\"command -v moc\")\r\nsh: command: not found\r\nDEBUG 1: /nix/store/gfnlb4vixsnlzh0s429c7nk247zf3xni-qtbase-5.10.1-dev/mkspecs/features/qt_functions.prf:72: cmd :=\r\n```\r\n\r\nwhile in nix-shell it works fine:\r\n\r\n```\r\nDEBUG 1: /nix/store/gfnlb4vixsnlzh0s429c7nk247zf3xni-qtbase-5.10.1-dev/mkspecs/features/qt_functions.prf:72: calling built-in $$system(\"command -v moc\")\r\nDEBUG 1: /nix/store/gfnlb4vixsnlzh0s429c7nk247zf3xni-qtbase-5.10.1-dev/mkspecs/features/qt_functions.prf:72: cmd := /nix/store/gfnlb4vixsnlzh0s429c7nk247zf3xni-qtbase-5.10.1-dev/bin/moc\r\n```\r\n\r\nSo it seems there's some difference between shell in `nix-shell` and `nix-build`.\r\n\r\nI've tried to compare `env-vars` from both builds, found that only these vars are new or different in `nix-shell`:\r\n\r\n```sh\r\ndeclare -x DISPLAY=\":0.0\"\r\ndeclare -x HOME=\"/home/yorik\"\r\ndeclare -x IN_NIX_SHELL=\"pure\"\r\ndeclare -x LOGNAME=\"yorik\"\r\ndeclare -x NIX_BUILD_TOP=\"/run/user/1000\"\r\ndeclare -x OLDPWD\r\ndeclare -x PAGER=\"less\"\r\ndeclare -x SHLVL=\"3\"\r\ndeclare -x SOURCE_DATE_EPOCH=\"1\"\r\n#declare -x SSL_CERT_FILE=\"/no-cert-file.crt\" - missing in nix-shell, present in nix-build\r\ndeclare -x TEMP=\"/run/user/1000\"\r\ndeclare -x TEMPDIR=\"/run/user/1000\"\r\ndeclare -x TERM=\"tmux-256color\"\r\ndeclare -x TMP=\"/run/user/1000\"\r\ndeclare -x TMPDIR=\"/run/user/1000\"\r\ndeclare -x USER=\"yorik\"\r\ndeclare -x __ETC_PROFILE_SOURCED=\"1\"\r\n```\r\n\r\nWhen I changed all these vars in nix-shell appropriately, nothing changed.\r\n\r\n### System information\r\n\r\n - system: `\"x86_64-linux\"`\r\n - host os: `Linux 4.15.7, NixOS, 17.09.3149.ae0b65aacc6 (Hummingbird)`\r\n - multi-user?: `yes`\r\n - sandbox: `yes` (tried without, same result)\r\n - version: `nix-env (Nix) 2.0`\r\n - channels(root): `\"nixos-17.09.3149.ae0b65aacc6\"`\r\n - channels(yorik): `\"\"`\r\n - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`\r\n"},"comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments/372799475","html_url":"https://github.com/NixOS/nixpkgs/issues/36903#issuecomment-372799475","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/36903","id":372799475,"user":{"login":"YorikSar","id":428074,"avatar_url":"https://avatars2.githubusercontent.com/u/428074?v=4","gravatar_id":"","url":"https://api.github.com/users/YorikSar","html_url":"https://github.com/YorikSar","followers_url":"https://api.github.com/users/YorikSar/followers","following_url":"https://api.github.com/users/YorikSar/following{/other_user}","gists_url":"https://api.github.com/users/YorikSar/gists{/gist_id}","starred_url":"https://api.github.com/users/YorikSar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YorikSar/subscriptions","organizations_url":"https://api.github.com/users/YorikSar/orgs","repos_url":"https://api.github.com/users/YorikSar/repos","events_url":"https://api.github.com/users/YorikSar/events{/privacy}","received_events_url":"https://api.github.com/users/YorikSar/received_events","type":"User","site_admin":false},"created_at":"2018-03-13T20:02:25Z","updated_at":"2018-03-13T20:02:25Z","author_association":"CONTRIBUTOR","body":"@dtzWill I'm currently using 17.09 channel with `nix.package = pkgs.nixStable2`, and sandboxed `/bin/sh` doesn't support `command`."}}
{"actor":{"display_login":"YorikSar"}}