-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bin builds #11
Bin builds #11
Conversation
handle pre and postConfigure phases.
A small utility to install nodejs headers
Each node package is like a little snowflake. Fetching things left and right. This commit adds some examples for common bin dependencies. It's not the best experience but at least we have an example available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! I think I managed to build bin packages before (do electron apps count?) though can't quite remember how.
writeScript "nodejs-headers-installer" '' | ||
echo "* Installing nodejs headers in $HOME/.node-gyp/${nodejs.version} ..." | ||
mkdir -p $HOME/.node-gyp/${nodejs.version} | ||
echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the 9
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember. This code has been cargo-culted heavily :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -266,14 +266,25 @@ let | |||
echo " > repl" | |||
''; | |||
}; | |||
|
|||
nodejs-headers-installer = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a few lines here about how this is meant to be used? i.e. "make sure your $HOME
is set and call this executable".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I was thinking of adding a $HOME
check in the script itself instead.
@@ -266,14 +266,25 @@ let | |||
echo " > repl" | |||
''; | |||
}; | |||
|
|||
nodejs-headers-installer = | |||
with pkgs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just use pkgs.writeScript
, pkgs.nodejs
, etc
|
||
nodejs.passthru.python | ||
|
||
# These tend to be needed when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... when?
]; | ||
|
||
postConfigure = '' | ||
${nodejs-headers-installer} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember having to do something like this, and I think it worked without having to write anything to HOME
. Though maybe it was something different?
''
...
export CPATH="${pkgs.nodejs-10_x}/include/node:$CPATH"
npm install --nodedir=${pkgs.nodejs-10_x}/include/node
...
''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I managed to avoid failing to download the headers with npmCommands = ["npm install --nodedir=${pkgs.nodejs}/include/node --loglevel verbose"];
(Although it eventually failed because there was no /usr/bin/env in a sandboxed build)
|
||
ln -s ${pkgs.pngquant}/bin/pngquant node_modules/pngquant-bin/vendor/pngquant | ||
|
||
runPostinstall() ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we just inline this below?
thanks for the review, I will make another pass when I have the time/energy |
Closing as https://github.com/tweag/npmlock2nix is now serving the same purpose for me. |
Adds a few fixes and an example of bin dependencies.
Fixes #9 -ish