pkgs: add writePerl{,Bin}
This commit is contained in:
@@ -18,6 +18,9 @@ in {
|
||||
main = do
|
||||
putStrLn "hello world"
|
||||
'';
|
||||
perl = pkgs.writePerl "hello-world" {} ''
|
||||
print "hello world\n";
|
||||
'';
|
||||
python2 = pkgs.writePython2 "hello-world" {} ''
|
||||
print "hello world"
|
||||
'';
|
||||
|
||||
@@ -14,6 +14,10 @@ in {
|
||||
main :: IO ()
|
||||
main = print Rolf
|
||||
'';
|
||||
perl = pkgs.writePerl "simple.pl" { deps = [ pkgs.perlPackages.boolean ]; } ''
|
||||
use boolean;
|
||||
print "Howdy!\n" if true;
|
||||
'';
|
||||
python2 = pkgs.writePython2 "hello-world" { deps = [ pkgs.python2Packages.pyyaml ]; } ''
|
||||
import yaml
|
||||
|
||||
|
||||
@@ -313,6 +313,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);
|
||||
|
||||
Reference in New Issue
Block a user