-
Notifications
You must be signed in to change notification settings - Fork 14
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
Packaging a node package using js2nix #25
Comments
I ended up making a custom { lib, stdenv, buildPackages, nodejs, darwin }@_args:
{ name ? "${args.pname}-${args.version}", src ? null, srcs ? null
, sourceRoot ? null, nativeBuildInputs ? [ ], buildInputs ? [ ]
, npmBuildScript ? "build" # The script to run to build the project.
, nodejs ? _args.nodejs, npmDeps ? [ ] # Node.js dependencies derivation
, ... }@args:
let
npmHooks = buildPackages.npmHooks.override { inherit nodejs; };
inherit (npmHooks) npmBuildHook npmInstallHook;
in stdenv.mkDerivation (args // {
inherit npmDeps npmBuildScript;
nativeBuildInputs = nativeBuildInputs
++ [ nodejs npmBuildHook npmInstallHook nodejs.python ]
++ lib.optionals stdenv.isDarwin [ darwin.cctools ];
buildInputs = buildInputs ++ [ nodejs ];
postPatch = ''
export HOME="$TMPDIR"
cp -r ${npmDeps} node_modules
chmod -R 700 node_modules
patchShebangs node_modules
'';
strictDeps = true;
# Stripping takes way too long with the amount of files required by a typical Node.js project.
dontStrip = args.dontStrip or true;
# Pruning often fails
dontNpmPrune = args.dontNpmPrune or true;
meta = (args.meta or { }) // {
platforms = args.meta.platforms or nodejs.meta.platforms;
};
}) |
Hey @bromanko, apologies for deferred reply, I noticed your messages a moment ago. Regarding the initial question, I think About the packaging of your project. In not too sure what is happening in your code listing above. Can you explain what are you trying to do? I maybe can come up with some ideas on how to make it optimal. |
I've been building my node packages with
buildNpmPackage
. However, I'd like to switch to js2nix.buildNpmPackage
relies upon apackage-lock.json
so seems inappropriate. How are others building packages with js2nix dependencies?The text was updated successfully, but these errors were encountered: