1
0
mirror of https://github.com/bennofs/nix-script synced 2025-01-10 12:54:20 +01:00

Support both python 2 and 3

This commit is contained in:
Michele Guerini Rocco 2019-09-19 17:31:17 +02:00
parent 83064dc557
commit 15c9d337ae
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450

View File

@ -43,7 +43,7 @@ baseEnv = ["LOCALE_ARCHIVE", "SSL_CERT_FILE" ,"LANG", "TERMINFO", "TERM"]
-- | List of supported language definitions -- | List of supported language definitions
languages :: [Language] languages :: [Language]
languages = [haskell, python, javascript, perl, shell] languages = [haskell, python 2, python 3, javascript, perl, shell]
where where
haskell = Language "haskell" d r i where haskell = Language "haskell" d r i where
d pkgs = pure ("haskellPackages.ghcWithPackages (hs: with hs; [" ++ d pkgs = pure ("haskellPackages.ghcWithPackages (hs: with hs; [" ++
@ -51,10 +51,12 @@ languages = [haskell, python, javascript, perl, shell]
r script = ("runghc" , [script]) r script = ("runghc" , [script])
i script = ("ghci" , [script]) i script = ("ghci" , [script])
python = Language "python" d r i where python v = Language ("python" ++ show v) d r i where
d pkgs = "python" : map ("pythonPackages." ++) pkgs d pkgs = pure ("python" ++ (show v) ++
r script = ("python" , [script]) ".withPackages (py: with py; [" ++
i script = ("python" , ["-i", script]) unwords pkgs ++ "])")
r script = ("python" ++ show v, [script])
i script = ("python" ++ show v, ["-i", script])
javascript = Language "javascript" d r i where javascript = Language "javascript" d r i where
d pkgs = "node" : map ("nodePackages." ++) pkgs d pkgs = "node" : map ("nodePackages." ++) pkgs