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

Merge pull request #2 from rnhmjoj/master

Add more languages
This commit is contained in:
Benno Fünfstück 2015-08-30 17:13:51 +02:00
commit 45be874115

View File

@ -25,14 +25,14 @@ import qualified Data.Text as Text
-- | Information about a languages
data LangDef = LangDef
{ name :: String -- ^ Name of this language
{ name :: String -- ^ Name of this language
, deps :: [Text] -> [Text] -- ^ Convert langunage-specific dependencies to nix packages
, run :: FilePath -> (String, [String]) -- ^ Command to run the given file as script
, repl :: FilePath -> (String, [String]) -- ^ Command to load the given file in an interpreter
}
languages :: [LangDef]
languages = [haskell, shell]
languages = [haskell, python, javascript, perl, shell]
haskell :: LangDef
haskell = LangDef "haskell" d r i where
@ -41,6 +41,24 @@ haskell = LangDef "haskell" d r i where
r script = ("runhaskell" , [script])
i script = ("ghci" , [script])
python :: LangDef
python = LangDef "python" d r i where
d pkgs = "python" : map ("pythonPackages." <>) pkgs
r script = ("python" , [script])
i script = ("python" , ["-i", script])
javascript :: LangDef
javascript = LangDef "javascript" d r i where
d pkgs = "node" : map ("nodePackages." <>) pkgs
r script = ("node" , [script])
i script = ("node" , [])
perl :: LangDef
perl = LangDef "perl" d r i where
d pkgs = "perl" : map ("perlPackages." <>) pkgs
r script = ("perl" , [script])
i script = ("perl" , ["-d", script])
shell :: LangDef
shell = LangDef "shell" (extraPackages ++) r i where
r script = ("bash", [script])