Dealing with NixOS missing dependency ~ libpng-dev












1














Moving away from an OS like Arch where packages are mostly available, how does one deal with a missing dev dependency like libpng-dev?



I have an issue with a Node package dependency - pngquant-bin. It's relying on libpng-dev package to build pngquant-bin. libpng & pngquant are both available in Nixpkgs, but it's trying to find libpng-dev.



What is the best solution in this case? e.g. setting up an overlay, creating the package from source...



Research:



Using libpng-config --cflag shows where the development headers are. I'd assume I can somehow direct the NPM package to these headers to build the pngquant-bin binary.



I have logged an issue on GitHub that provides more detail: https://github.com/svanderburg/node2nix/issues/123



Disclaimer: I'm new to NixOS - coming from Arch. I appreciate any advice, loving NixOS!










share|improve this question
























  • Try to love nixos forum, too: discourse.nixos.org
    – Ipor Sircer
    Dec 11 at 10:36










  • It's ideal to use pkg-config or <foo>-config, if possible.
    – Vladimír Čunát
    Dec 11 at 16:30
















1














Moving away from an OS like Arch where packages are mostly available, how does one deal with a missing dev dependency like libpng-dev?



I have an issue with a Node package dependency - pngquant-bin. It's relying on libpng-dev package to build pngquant-bin. libpng & pngquant are both available in Nixpkgs, but it's trying to find libpng-dev.



What is the best solution in this case? e.g. setting up an overlay, creating the package from source...



Research:



Using libpng-config --cflag shows where the development headers are. I'd assume I can somehow direct the NPM package to these headers to build the pngquant-bin binary.



I have logged an issue on GitHub that provides more detail: https://github.com/svanderburg/node2nix/issues/123



Disclaimer: I'm new to NixOS - coming from Arch. I appreciate any advice, loving NixOS!










share|improve this question
























  • Try to love nixos forum, too: discourse.nixos.org
    – Ipor Sircer
    Dec 11 at 10:36










  • It's ideal to use pkg-config or <foo>-config, if possible.
    – Vladimír Čunát
    Dec 11 at 16:30














1












1








1







Moving away from an OS like Arch where packages are mostly available, how does one deal with a missing dev dependency like libpng-dev?



I have an issue with a Node package dependency - pngquant-bin. It's relying on libpng-dev package to build pngquant-bin. libpng & pngquant are both available in Nixpkgs, but it's trying to find libpng-dev.



What is the best solution in this case? e.g. setting up an overlay, creating the package from source...



Research:



Using libpng-config --cflag shows where the development headers are. I'd assume I can somehow direct the NPM package to these headers to build the pngquant-bin binary.



I have logged an issue on GitHub that provides more detail: https://github.com/svanderburg/node2nix/issues/123



Disclaimer: I'm new to NixOS - coming from Arch. I appreciate any advice, loving NixOS!










share|improve this question















Moving away from an OS like Arch where packages are mostly available, how does one deal with a missing dev dependency like libpng-dev?



I have an issue with a Node package dependency - pngquant-bin. It's relying on libpng-dev package to build pngquant-bin. libpng & pngquant are both available in Nixpkgs, but it's trying to find libpng-dev.



What is the best solution in this case? e.g. setting up an overlay, creating the package from source...



Research:



Using libpng-config --cflag shows where the development headers are. I'd assume I can somehow direct the NPM package to these headers to build the pngquant-bin binary.



I have logged an issue on GitHub that provides more detail: https://github.com/svanderburg/node2nix/issues/123



Disclaimer: I'm new to NixOS - coming from Arch. I appreciate any advice, loving NixOS!







software-installation dependencies nixos nix






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 16 at 13:32









Jeff Schaller

38.7k1053125




38.7k1053125










asked Dec 11 at 10:10









YodaScholtz

1384




1384












  • Try to love nixos forum, too: discourse.nixos.org
    – Ipor Sircer
    Dec 11 at 10:36










  • It's ideal to use pkg-config or <foo>-config, if possible.
    – Vladimír Čunát
    Dec 11 at 16:30


















  • Try to love nixos forum, too: discourse.nixos.org
    – Ipor Sircer
    Dec 11 at 10:36










  • It's ideal to use pkg-config or <foo>-config, if possible.
    – Vladimír Čunát
    Dec 11 at 16:30
















Try to love nixos forum, too: discourse.nixos.org
– Ipor Sircer
Dec 11 at 10:36




Try to love nixos forum, too: discourse.nixos.org
– Ipor Sircer
Dec 11 at 10:36












It's ideal to use pkg-config or <foo>-config, if possible.
– Vladimír Čunát
Dec 11 at 16:30




It's ideal to use pkg-config or <foo>-config, if possible.
– Vladimír Čunát
Dec 11 at 16:30










1 Answer
1






active

oldest

votes


















4














It appears that the libpng package has multiple outputs, one of which is the dev build. On my macOS machine:



brocking@station1:~/dev > nix-env -qasA nixpkgs.libpng.dev
-PS libpng-apng-1.6.34


There's a chapter in the manual for the nixpkgs collection that covers this. IIRC the nixpkgs collection has included multiple outputs for the last few major releases and I believe that many packages are built in this manner now.



PS there's also a section in the nixpkgs manual that covers node.js packages which is probably worth taking a look at also.





I've had a quick look at the GitHub issue that you've opened and you definitely seem to be on the right track, but unfortunately I am not familiar enough with either node.js or node2nix to be able to see exactly what the problem is.



However, one general point I can make though is that whenever you are trying to package something with Nix and you get an error such as you've experienced below then it almost always means that either or both 1. you need to tell nix how it can get hold of a dependency (libpng-dev in this case) and 2. you need to make sure that the nix expression that you are trying to build somehow includes a reference to 1. (often that is via a buildInputs nix attribute, although that depends very much what build system you are using), in your case I am guessing that it might be as an argument to the pngquant expression in the default.nix file generated by node2nix, although as I said it is quite unfamiliar for me so I may be quite wrong about that.



ℹ compiling from source
✔ pngquant pre-build test passed successfully
✖ RequestError: pngquant failed to build, make sure that libpng-dev is installed



You may find some more and faster help in the chat on the #nixos IRC channel, people on there are very helpful and I have found a lot of knowledge on there previously.



One last remark, the great strength of Nix is its purity - you have to tell it exactly where to find everything, and that can be a little daunting at first. However once you get your head around that then the purity is something you can really appreciate.






share|improve this answer























  • I'm going to mark your answer as correct, because It's probably send my on the right path, but the issue still persists - here's the GitHub issue I submitted: github.com/svanderburg/node2nix/issues/123
    – YodaScholtz
    Dec 13 at 12:13






  • 1




    I've added a few extra comments in my answer about the GitHub issue you've raised. I'm afraid I'm not familiar enough to be able to see exactly what the problem is but I hope they are of some help at least.
    – brocking
    Dec 13 at 17:58











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487300%2fdealing-with-nixos-missing-dependency-libpng-dev%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














It appears that the libpng package has multiple outputs, one of which is the dev build. On my macOS machine:



brocking@station1:~/dev > nix-env -qasA nixpkgs.libpng.dev
-PS libpng-apng-1.6.34


There's a chapter in the manual for the nixpkgs collection that covers this. IIRC the nixpkgs collection has included multiple outputs for the last few major releases and I believe that many packages are built in this manner now.



PS there's also a section in the nixpkgs manual that covers node.js packages which is probably worth taking a look at also.





I've had a quick look at the GitHub issue that you've opened and you definitely seem to be on the right track, but unfortunately I am not familiar enough with either node.js or node2nix to be able to see exactly what the problem is.



However, one general point I can make though is that whenever you are trying to package something with Nix and you get an error such as you've experienced below then it almost always means that either or both 1. you need to tell nix how it can get hold of a dependency (libpng-dev in this case) and 2. you need to make sure that the nix expression that you are trying to build somehow includes a reference to 1. (often that is via a buildInputs nix attribute, although that depends very much what build system you are using), in your case I am guessing that it might be as an argument to the pngquant expression in the default.nix file generated by node2nix, although as I said it is quite unfamiliar for me so I may be quite wrong about that.



ℹ compiling from source
✔ pngquant pre-build test passed successfully
✖ RequestError: pngquant failed to build, make sure that libpng-dev is installed



You may find some more and faster help in the chat on the #nixos IRC channel, people on there are very helpful and I have found a lot of knowledge on there previously.



One last remark, the great strength of Nix is its purity - you have to tell it exactly where to find everything, and that can be a little daunting at first. However once you get your head around that then the purity is something you can really appreciate.






share|improve this answer























  • I'm going to mark your answer as correct, because It's probably send my on the right path, but the issue still persists - here's the GitHub issue I submitted: github.com/svanderburg/node2nix/issues/123
    – YodaScholtz
    Dec 13 at 12:13






  • 1




    I've added a few extra comments in my answer about the GitHub issue you've raised. I'm afraid I'm not familiar enough to be able to see exactly what the problem is but I hope they are of some help at least.
    – brocking
    Dec 13 at 17:58
















4














It appears that the libpng package has multiple outputs, one of which is the dev build. On my macOS machine:



brocking@station1:~/dev > nix-env -qasA nixpkgs.libpng.dev
-PS libpng-apng-1.6.34


There's a chapter in the manual for the nixpkgs collection that covers this. IIRC the nixpkgs collection has included multiple outputs for the last few major releases and I believe that many packages are built in this manner now.



PS there's also a section in the nixpkgs manual that covers node.js packages which is probably worth taking a look at also.





I've had a quick look at the GitHub issue that you've opened and you definitely seem to be on the right track, but unfortunately I am not familiar enough with either node.js or node2nix to be able to see exactly what the problem is.



However, one general point I can make though is that whenever you are trying to package something with Nix and you get an error such as you've experienced below then it almost always means that either or both 1. you need to tell nix how it can get hold of a dependency (libpng-dev in this case) and 2. you need to make sure that the nix expression that you are trying to build somehow includes a reference to 1. (often that is via a buildInputs nix attribute, although that depends very much what build system you are using), in your case I am guessing that it might be as an argument to the pngquant expression in the default.nix file generated by node2nix, although as I said it is quite unfamiliar for me so I may be quite wrong about that.



ℹ compiling from source
✔ pngquant pre-build test passed successfully
✖ RequestError: pngquant failed to build, make sure that libpng-dev is installed



You may find some more and faster help in the chat on the #nixos IRC channel, people on there are very helpful and I have found a lot of knowledge on there previously.



One last remark, the great strength of Nix is its purity - you have to tell it exactly where to find everything, and that can be a little daunting at first. However once you get your head around that then the purity is something you can really appreciate.






share|improve this answer























  • I'm going to mark your answer as correct, because It's probably send my on the right path, but the issue still persists - here's the GitHub issue I submitted: github.com/svanderburg/node2nix/issues/123
    – YodaScholtz
    Dec 13 at 12:13






  • 1




    I've added a few extra comments in my answer about the GitHub issue you've raised. I'm afraid I'm not familiar enough to be able to see exactly what the problem is but I hope they are of some help at least.
    – brocking
    Dec 13 at 17:58














4












4








4






It appears that the libpng package has multiple outputs, one of which is the dev build. On my macOS machine:



brocking@station1:~/dev > nix-env -qasA nixpkgs.libpng.dev
-PS libpng-apng-1.6.34


There's a chapter in the manual for the nixpkgs collection that covers this. IIRC the nixpkgs collection has included multiple outputs for the last few major releases and I believe that many packages are built in this manner now.



PS there's also a section in the nixpkgs manual that covers node.js packages which is probably worth taking a look at also.





I've had a quick look at the GitHub issue that you've opened and you definitely seem to be on the right track, but unfortunately I am not familiar enough with either node.js or node2nix to be able to see exactly what the problem is.



However, one general point I can make though is that whenever you are trying to package something with Nix and you get an error such as you've experienced below then it almost always means that either or both 1. you need to tell nix how it can get hold of a dependency (libpng-dev in this case) and 2. you need to make sure that the nix expression that you are trying to build somehow includes a reference to 1. (often that is via a buildInputs nix attribute, although that depends very much what build system you are using), in your case I am guessing that it might be as an argument to the pngquant expression in the default.nix file generated by node2nix, although as I said it is quite unfamiliar for me so I may be quite wrong about that.



ℹ compiling from source
✔ pngquant pre-build test passed successfully
✖ RequestError: pngquant failed to build, make sure that libpng-dev is installed



You may find some more and faster help in the chat on the #nixos IRC channel, people on there are very helpful and I have found a lot of knowledge on there previously.



One last remark, the great strength of Nix is its purity - you have to tell it exactly where to find everything, and that can be a little daunting at first. However once you get your head around that then the purity is something you can really appreciate.






share|improve this answer














It appears that the libpng package has multiple outputs, one of which is the dev build. On my macOS machine:



brocking@station1:~/dev > nix-env -qasA nixpkgs.libpng.dev
-PS libpng-apng-1.6.34


There's a chapter in the manual for the nixpkgs collection that covers this. IIRC the nixpkgs collection has included multiple outputs for the last few major releases and I believe that many packages are built in this manner now.



PS there's also a section in the nixpkgs manual that covers node.js packages which is probably worth taking a look at also.





I've had a quick look at the GitHub issue that you've opened and you definitely seem to be on the right track, but unfortunately I am not familiar enough with either node.js or node2nix to be able to see exactly what the problem is.



However, one general point I can make though is that whenever you are trying to package something with Nix and you get an error such as you've experienced below then it almost always means that either or both 1. you need to tell nix how it can get hold of a dependency (libpng-dev in this case) and 2. you need to make sure that the nix expression that you are trying to build somehow includes a reference to 1. (often that is via a buildInputs nix attribute, although that depends very much what build system you are using), in your case I am guessing that it might be as an argument to the pngquant expression in the default.nix file generated by node2nix, although as I said it is quite unfamiliar for me so I may be quite wrong about that.



ℹ compiling from source
✔ pngquant pre-build test passed successfully
✖ RequestError: pngquant failed to build, make sure that libpng-dev is installed



You may find some more and faster help in the chat on the #nixos IRC channel, people on there are very helpful and I have found a lot of knowledge on there previously.



One last remark, the great strength of Nix is its purity - you have to tell it exactly where to find everything, and that can be a little daunting at first. However once you get your head around that then the purity is something you can really appreciate.







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 13 at 17:55

























answered Dec 11 at 16:28









brocking

20314




20314












  • I'm going to mark your answer as correct, because It's probably send my on the right path, but the issue still persists - here's the GitHub issue I submitted: github.com/svanderburg/node2nix/issues/123
    – YodaScholtz
    Dec 13 at 12:13






  • 1




    I've added a few extra comments in my answer about the GitHub issue you've raised. I'm afraid I'm not familiar enough to be able to see exactly what the problem is but I hope they are of some help at least.
    – brocking
    Dec 13 at 17:58


















  • I'm going to mark your answer as correct, because It's probably send my on the right path, but the issue still persists - here's the GitHub issue I submitted: github.com/svanderburg/node2nix/issues/123
    – YodaScholtz
    Dec 13 at 12:13






  • 1




    I've added a few extra comments in my answer about the GitHub issue you've raised. I'm afraid I'm not familiar enough to be able to see exactly what the problem is but I hope they are of some help at least.
    – brocking
    Dec 13 at 17:58
















I'm going to mark your answer as correct, because It's probably send my on the right path, but the issue still persists - here's the GitHub issue I submitted: github.com/svanderburg/node2nix/issues/123
– YodaScholtz
Dec 13 at 12:13




I'm going to mark your answer as correct, because It's probably send my on the right path, but the issue still persists - here's the GitHub issue I submitted: github.com/svanderburg/node2nix/issues/123
– YodaScholtz
Dec 13 at 12:13




1




1




I've added a few extra comments in my answer about the GitHub issue you've raised. I'm afraid I'm not familiar enough to be able to see exactly what the problem is but I hope they are of some help at least.
– brocking
Dec 13 at 17:58




I've added a few extra comments in my answer about the GitHub issue you've raised. I'm afraid I'm not familiar enough to be able to see exactly what the problem is but I hope they are of some help at least.
– brocking
Dec 13 at 17:58


















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487300%2fdealing-with-nixos-missing-dependency-libpng-dev%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Morgemoulin

Scott Moir

Souastre