{"action":"created","issue":{"url":"https://api.github.com/repos/svanderburg/node2nix/issues/84","repository_url":"https://api.github.com/repos/svanderburg/node2nix","labels_url":"https://api.github.com/repos/svanderburg/node2nix/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/svanderburg/node2nix/issues/84/comments","events_url":"https://api.github.com/repos/svanderburg/node2nix/issues/84/events","html_url":"https://github.com/svanderburg/node2nix/issues/84","id":318711064,"node_id":"MDU6SXNzdWUzMTg3MTEwNjQ=","number":84,"title":"How to override dependencies of package","user":{"login":"srghma","id":7573215,"node_id":"MDQ6VXNlcjc1NzMyMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/7573215?v=4","gravatar_id":"","url":"https://api.github.com/users/srghma","html_url":"https://github.com/srghma","followers_url":"https://api.github.com/users/srghma/followers","following_url":"https://api.github.com/users/srghma/following{/other_user}","gists_url":"https://api.github.com/users/srghma/gists{/gist_id}","starred_url":"https://api.github.com/users/srghma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srghma/subscriptions","organizations_url":"https://api.github.com/users/srghma/orgs","repos_url":"https://api.github.com/users/srghma/repos","events_url":"https://api.github.com/users/srghma/events{/privacy}","received_events_url":"https://api.github.com/users/srghma/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-29T11:53:36Z","updated_at":"2018-06-29T21:23:46Z","closed_at":null,"author_association":"NONE","body":"In documentation there is only info how to override dependencies for collection of packages https://github.com/svanderburg/node2nix#adding-unspecified-dependencies, but how to override dependency of one package?\r\n\r\nFor example, I want to fix this issue here https://github.com/srghma/my-create-react-app/tree/105064cbb5ac9a5a34f4b6da2d07385d5785e8a1 \r\n\r\n```sh\r\n$ nix-shell \r\n..........\r\nAdding metadata fields to: node_modules/y18n/package.json\r\nAdding metadata fields to: node_modules/yallist/package.json\r\nAdding metadata fields to: node_modules/yargs/package.json\r\nAdding metadata fields to: node_modules/yargs-parser/package.json\r\nAdding metadata fields to: node_modules/yauzl/package.json\r\nAdding metadata fields to: node_modules/zip-stream/package.json\r\n\r\n> mozjpeg@4.1.1 postinstall /nix/store/q5wfps9n8q5sybjnpnpwjgd48nnzjrc0-node-dependencies-extension-0.0.1/extension/node_modules/mozjpeg\r\n> node lib/install.js\r\n\r\n/nix/store/q5wfps9n8q5sybjnpnpwjgd48nnzjrc0-node-dependencies-extension-0.0.1/extension/node_modules/onetime/index.js:7\r\n                throw new TypeError('The second argument is now an options object');\r\n                ^\r\n\r\nTypeError: The second argument is now an options object\r\n    at module.exports (/nix/store/q5wfps9n8q5sybjnpnpwjgd48nnzjrc0-node-dependencies-extension-0.0.1/extension/node_modules/onetime/index.js:7:9)\r\n    at module.exports (/nix/store/q5wfps9n8q5sybjnpnpwjgd48nnzjrc0-node-dependencies-extension-0.0.1/extension/node_modules/each-async/index.js:44:37)\r\n    at Download.run (/nix/store/q5wfps9n8q5sybjnpnpwjgd48nnzjrc0-node-dependencies-extension-0.0.1/extension/node_modules/download/index.js:115:2)\r\n    at BinWrapper.download (/nix/store/q5wfps9n8q5sybjnpnpwjgd48nnzjrc0-node-dependencies-extension-0.0.1/extension/node_modules/bin-wrapper/index.js:217:4)\r\n    at BinWrapper.<anonymous> (/nix/store/q5wfps9n8q5sybjnpnpwjgd48nnzjrc0-node-dependencies-extension-0.0.1/extension/node_modules/bin-wrapper/index.js:178:9)\r\n    at FSReqWrap.oncomplete (fs.js:152:21)\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 1\r\nnpm ERR! mozjpeg@4.1.1 postinstall: `node lib/install.js`\r\nnpm ERR! Exit status 1\r\nnpm ERR!\r\nnpm ERR! Failed at the mozjpeg@4.1.1 postinstall script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR!     /nix/store/q5wfps9n8q5sybjnpnpwjgd48nnzjrc0-node-dependencies-extension-0.0.1/extension/.npm/_logs/2018-04-29T11_50_40_141Z-debug.log\r\nbuilder for '/nix/store/rh9dzz5xzf0ma775kkhn6gp6ql4l4f38-node-dependencies-extension-0.0.1.drv' failed with exit code 1\r\nerror: build of '/nix/store/rh9dzz5xzf0ma775kkhn6gp6ql4l4f38-node-dependencies-extension-0.0.1.drv' failed\r\n\r\n```\r\n\r\n```\r\ncat /nix/store/q5wfps9n8q5sybjnpnpwjgd48nnzjrc0-node-dependencies-extension-0.0.1/extension/.npm/_logs/2018-04-29T11_50_40_141Z-debug.log\r\n.....\r\nbin:/nix/store/364b5gkvgrm87bh1scxm5h8shp975n0r-findutils-4.6.0/bin:/nix/store/cg3yhpr5hfr00y0aah23pgxiijpzl6nz-diffutils-3.6/bin:/nix/store/navldm477k3ar6cy0zlw9rk43i459g69-gnused-4.4/bin:/nix/store/s63b2myh6rxfl4aqwi9yxd6rq66djk33-gnugrep-3.1/bin:/nix/store/j79xs2j519bmvq0gihz8ff4nw5aj3vlh-gawk-4.2.0/bin:/nix/store/2p00w952ljb1172nsf3jm7nsjgsw5qpw-gnutar-1.30/bin:/nix/store/d7895h1an2pgcd6a3vx3yb5fbg786lci-gzip-1.9/bin:/nix/store/qqv6r9vkpb44rw5d8wyfpx64rgqzlvdm-bzip2-1.0.6.0.1-bin/bin:/nix/store/lhp5rw0dagi5mgqwr9i3x41240ba4ypz-gnumake-4.2.1/bin:/nix/store/zqh3l3lyw32q1ayb15bnvg9f24j5v2p0-bash-4.4-p12/bin:/nix/store/gd1mp76qr4zpbw3lccivhvi30b025x51-patch-2.7.6/bin:/nix/store/aakgkcvw6j54zg38zrn1w00sgxx0zj8b-xz-5.2.3-bin/bin\r\n9678 verbose lifecycle mozjpeg@4.1.1~postinstall: CWD: /nix/store/q5wfps9n8q5sybjnpnpwjgd48nnzjrc0-node-dependencies-extension-0.0.1/extension/node_modules/mozjpeg\r\n9679 silly lifecycle mozjpeg@4.1.1~postinstall: Args: [ '-c', 'node lib/install.js' ]\r\n9680 silly lifecycle mozjpeg@4.1.1~postinstall: Returned: code: 1  signal: null\r\n9681 info lifecycle mozjpeg@4.1.1~postinstall: Failed to exec postinstall script\r\n9682 verbose stack Error: mozjpeg@4.1.1 postinstall: `node lib/install.js`\r\n9682 verbose stack Exit status 1\r\n9682 verbose stack     at EventEmitter.<anonymous> (/nix/store/y8w39r3bs40p56m4r9m3vl3iwrqraabi-nodejs-8.11.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)\r\n9682 verbose stack     at emitTwo (events.js:126:13)\r\n9682 verbose stack     at EventEmitter.emit (events.js:214:7)\r\n9682 verbose stack     at ChildProcess.<anonymous> (/nix/store/y8w39r3bs40p56m4r9m3vl3iwrqraabi-nodejs-8.11.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)\r\n9682 verbose stack     at emitTwo (events.js:126:13)\r\n9682 verbose stack     at ChildProcess.emit (events.js:214:7)\r\n9682 verbose stack     at maybeClose (internal/child_process.js:925:16)\r\n9682 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)\r\n9683 verbose pkgid mozjpeg@4.1.1\r\n9684 verbose cwd /nix/store/q5wfps9n8q5sybjnpnpwjgd48nnzjrc0-node-dependencies-extension-0.0.1/extension\r\n9685 verbose Linux 4.14.34\r\n9686 verbose argv \"/nix/store/y8w39r3bs40p56m4r9m3vl3iwrqraabi-nodejs-8.11.1/bin/node\" \"/nix/store/y8w39r3bs40p56m4r9m3vl3iwrqraabi-nodejs-8.11.1/bin/npm\" \"--offline\" \"--nodedir=/nix/store/z839b5pyapq5m54bvw6vlfq4i9jld5zn-node-sources\" \"rebuild\"\r\n9687 verbose node v8.11.1\r\n9688 verbose npm  v5.6.0\r\n9689 error code ELIFECYCLE\r\n9690 error errno 1\r\n9691 error mozjpeg@4.1.1 postinstall: `node lib/install.js`\r\n9691 error Exit status 1\r\n9692 error Failed at the mozjpeg@4.1.1 postinstall script.\r\n9692 error This is probably not a problem with npm. There is likely additional logging output above.\r\n9693 verbose exit [ 1, true ]\r\n```\r\n\r\nWhat I need is to substitute mozjpeg here https://github.com/srghma/my-create-react-app/blob/105064cbb5ac9a5a34f4b6da2d07385d5785e8a1/nix/node-output.nix#L7891 with my own derivation?\r\n\r\nderivation pseudocode (its for me future):\r\n```\r\ncp -R mozjpeg-from-npm $out\r\ncp ${mozjpeg}/bin/mozjpeg $out/vendor/cjpeg\r\n```"},"comment":{"url":"https://api.github.com/repos/svanderburg/node2nix/issues/comments/401477709","html_url":"https://github.com/svanderburg/node2nix/issues/84#issuecomment-401477709","issue_url":"https://api.github.com/repos/svanderburg/node2nix/issues/84","id":401477709,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTQ3NzcwOQ==","user":{"login":"svanderburg","id":1153271,"node_id":"MDQ6VXNlcjExNTMyNzE=","avatar_url":"https://avatars0.githubusercontent.com/u/1153271?v=4","gravatar_id":"","url":"https://api.github.com/users/svanderburg","html_url":"https://github.com/svanderburg","followers_url":"https://api.github.com/users/svanderburg/followers","following_url":"https://api.github.com/users/svanderburg/following{/other_user}","gists_url":"https://api.github.com/users/svanderburg/gists{/gist_id}","starred_url":"https://api.github.com/users/svanderburg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svanderburg/subscriptions","organizations_url":"https://api.github.com/users/svanderburg/orgs","repos_url":"https://api.github.com/users/svanderburg/repos","events_url":"https://api.github.com/users/svanderburg/events{/privacy}","received_events_url":"https://api.github.com/users/svanderburg/received_events","type":"User","site_admin":false},"created_at":"2018-06-29T21:23:46Z","updated_at":"2018-06-29T21:23:46Z","author_association":"OWNER","body":"It's not possible to \"override\" a dependency or transitive NPM dependency by providing parameters to a Nix expression.\r\n\r\nWhat you can do is using the `preRebuild` hook (see the README.md for more info) to modify the generated `node_modules/` folder and use that, for example, to replace a dependency or alter it.\r\n\r\nIt's not very elegant, but it offers enough freedom to make the changes that you need."}}
{"actor":{"display_login":"svanderburg"}}