aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/default.nix
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2018-09-23 13:05:11 +0200
committerlassulus <lassulus@lassul.us>2018-09-23 13:11:50 +0200
commit79ab2c27f9d7903ff3ed9bcd8de493b1191bbc12 (patch)
tree0a6fa22ad13a1597bd0d796bc74a388f3da6d0c5 /pkgs/default.nix
parent3212b4fbfb6fff4a1f133b9e18b84f298c6da65d (diff)
pkgs: add writeJS{,Bin}v2.2.0lass/masterlass/ciderp2
Diffstat (limited to 'pkgs/default.nix')
-rw-r--r--pkgs/default.nix17
1 files changed, 17 insertions, 0 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix
index b7b0dde..10465a6 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -297,6 +297,23 @@ pkgs: oldpkgs: {
};
};
+ writeJS = name: { deps ? [] }: text:
+ let
+ node-env = pkgs.buildEnv {
+ name = "node";
+ paths = deps;
+ pathsToLink = [
+ "/lib/node_modules"
+ ];
+ };
+ in pkgs.writeDash name ''
+ export NODE_PATH=${node-env}/lib/node_modules
+ exec ${pkgs.nodejs}/bin/node ${pkgs.writeText "js" text}
+ '';
+
+ writeJSBin = name:
+ pkgs.writeJS "/bin/${name}";
+
writeJSON = name: value: pkgs.runCommand name {
json = toJSON value;
passAsFile = [ "json" ];