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

Add more languages

This commit is contained in:
rnhmjoj 2015-08-29 21:11:08 +00:00
parent d28f2a06ea
commit 14c4b916ba

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,27 @@ 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 = return $
Text.unwords (map ("pythonPackages." <>) pkgs)
r script = ("python" , [script])
i script = ("python" , ["-i", script])
javascript :: LangDef
javascript = LangDef "javascript" d r i where
d pkgs = return $
Text.unwords (map ("nodePackages." <>) pkgs)
r script = ("node" , [script])
i script = ("node" , [])
perl :: LangDef
perl = LangDef "perl" d r i where
d pkgs = return $
Text.unwords (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])