elmPackages: Refactor lib and builds of packages
This commit is contained in:
@@ -6,7 +6,7 @@ set -eu -o pipefail
|
||||
|
||||
rm -f node-env.nix
|
||||
$(nix-build $ROOT -A nodePackages.node2nix --no-out-link)/bin/node2nix \
|
||||
--nodejs-10 \
|
||||
--nodejs-12 \
|
||||
-i node-packages.json \
|
||||
-o node-packages.nix \
|
||||
-c node-composition.nix \
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
{ writeScriptBin, stdenv, lib, elm }:
|
||||
let
|
||||
patchBinwrap =
|
||||
let
|
||||
# Patching binwrap by NoOp script
|
||||
binwrap = writeScriptBin "binwrap" ''
|
||||
#! ${stdenv.shell}
|
||||
echo "binwrap called: Returning 0"
|
||||
return 0
|
||||
'';
|
||||
binwrap-install = writeScriptBin "binwrap-install" ''
|
||||
#! ${stdenv.shell}
|
||||
echo "binwrap-install called: Doing nothing"
|
||||
'';
|
||||
in targets: pkg:
|
||||
pkg.override (old: {
|
||||
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ binwrap binwrap-install ];
|
||||
|
||||
# Manually install targets
|
||||
# by symlinking binaries into `node_modules`
|
||||
postInstall = let
|
||||
binFile = module: lib.strings.removeSuffix ("-" + module.version) module.name;
|
||||
in (old.postInstall or "") + ''
|
||||
${lib.concatStrings (map (module: ''
|
||||
echo "linking ${binFile module}"
|
||||
ln -sf ${module}/bin/${binFile module} \
|
||||
node_modules/${binFile module}/bin/${binFile module}
|
||||
'') targets)}
|
||||
'';
|
||||
});
|
||||
|
||||
patchNpmElm = pkg:
|
||||
pkg.override (old: {
|
||||
preRebuild = (old.preRebuild or "") + ''
|
||||
rm node_modules/elm/install.js
|
||||
echo "console.log('Nixpkgs\' version of Elm will be used');" > node_modules/elm/install.js
|
||||
'';
|
||||
postInstall = (old.postInstall or "") + ''
|
||||
ln -sf ${elm}/bin/elm node_modules/elm/bin/elm
|
||||
'';
|
||||
});
|
||||
in
|
||||
{ inherit patchBinwrap patchNpmElm; }
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
{pkgs ? import <nixpkgs> {
|
||||
inherit system;
|
||||
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-10_x"}:
|
||||
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}:
|
||||
|
||||
let
|
||||
nodeEnv = import ../../../node-packages/node-env.nix {
|
||||
|
||||
+2372
-2686
File diff suppressed because it is too large
Load Diff
@@ -1,30 +0,0 @@
|
||||
{ writeScriptBin, stdenv, lib }:
|
||||
let
|
||||
# Patching binwrap by NoOp script
|
||||
binwrap = writeScriptBin "binwrap" ''
|
||||
#! ${stdenv.shell}
|
||||
echo "binwrap called: Returning 0"
|
||||
return 0
|
||||
'';
|
||||
binwrap-install = writeScriptBin "binwrap-install" ''
|
||||
#! ${stdenv.shell}
|
||||
echo "binwrap-install called: Doing nothing"
|
||||
'';
|
||||
in
|
||||
targets:
|
||||
pkg:
|
||||
pkg.override {
|
||||
nativeBuildInputs = pkg.nativeBuildInputs ++ [ binwrap binwrap-install ];
|
||||
|
||||
# Manually install targets
|
||||
# by symlinking binaries into `node_modules`
|
||||
postInstall = let
|
||||
binFile = module: lib.strings.removeSuffix ("-" + module.version) module.name;
|
||||
in ''
|
||||
${lib.concatStrings (map (module: ''
|
||||
echo "linking ${binFile module}"
|
||||
ln -sf ${module}/bin/${binFile module} \
|
||||
node_modules/${binFile module}/bin/${binFile module}
|
||||
'') targets)}
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user