diff options
Diffstat (limited to 'pkgs/default.nix')
-rw-r--r-- | pkgs/default.nix | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix index a5582f3..ea3421b 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -303,6 +303,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" ]; @@ -319,6 +336,23 @@ pkgs: oldpkgs: { ${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out ''); + writePerl = name: { deps ? [] }: + let + perl-env = pkgs.buildEnv { + name = "perl-environment"; + paths = deps; + pathsToLink = [ + "/lib/perl5/site_perl" + ]; + }; + in + pkgs.makeScriptWriter { + interpreter = "${pkgs.perl}/bin/perl -I ${perl-env}/lib/perl5/site_perl"; + } name; + + writePerlBin = name: + pkgs.writePerl "/bin/${name}"; + writePython2 = name: { deps ? [], flakeIgnore ? [] }: let py = pkgs.python2.withPackages (ps: deps); |