Skip to content
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

Closed
wants to merge 4 commits into from
Closed

Bin builds #11

wants to merge 4 commits into from

Conversation

zimbatm
Copy link
Member

@zimbatm zimbatm commented Jan 7, 2020

Adds a few fixes and an example of bin dependencies.

Fixes #9 -ish

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.
Copy link
Collaborator

@nmattia nmattia left a 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the 9?

Copy link
Member Author

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 :)

Copy link
Contributor

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 =
Copy link
Collaborator

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".

Copy link
Member Author

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;
Copy link
Collaborator

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
Copy link
Collaborator

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}
Copy link
Collaborator

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
...
''

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() (
Copy link
Collaborator

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?

@zimbatm
Copy link
Member Author

zimbatm commented Jan 8, 2020

thanks for the review, I will make another pass when I have the time/energy

@zimbatm
Copy link
Member Author

zimbatm commented Apr 29, 2021

Closing as https://github.com/tweag/npmlock2nix is now serving the same purpose for me.

@zimbatm zimbatm closed this Apr 29, 2021
@zimbatm zimbatm deleted the bin-builds branch April 29, 2021 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Building -bin packages
4 participants