aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-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" ];