generated from MatrixAI/TypeScript-Demo-Lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
30 lines (29 loc) · 1.15 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ runCommandNoCC
, callPackage
}:
let
utils = callPackage ./utils.nix {};
drv = runCommandNoCC
"${utils.basename}-${utils.node2nixDev.version}"
{
version = utils.node2nixDev.version;
packageName = utils.node2nixDev.packageName;
}
''
mkdir -p $out/lib/node_modules/${utils.node2nixDev.packageName}
# copy the package.json
cp ${utils.node2nixDev}/lib/node_modules/${utils.node2nixDev.packageName}/package.json $out/lib/node_modules/${utils.node2nixDev.packageName}/
# copy the dist
cp -r ${utils.node2nixDev}/lib/node_modules/${utils.node2nixDev.packageName}/dist $out/lib/node_modules/${utils.node2nixDev.packageName}/
# copy over the production dependencies
if [ -d "${utils.node2nixProd}/lib/node_modules" ]; then
cp -r ${utils.node2nixProd}/lib/node_modules $out/lib/node_modules/${utils.node2nixDev.packageName}/
fi
# create symlink to the deployed executable folder, if applicable
if [ -d "${utils.node2nixDev}/lib/node_modules/.bin" ]; then
cp -r ${utils.node2nixDev}/lib/node_modules/.bin $out/lib/node_modules/
ln -s $out/lib/node_modules/.bin $out/bin
fi
'';
in
drv