48 lines
1.3 KiB
Nix
48 lines
1.3 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.sydnix.haskell;
|
|
in {
|
|
options.sydnix.haskell.enable =
|
|
lib.mkEnableOption "Haskell";
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# Convenient shorthand for quickly opening Haskell REPLs.
|
|
programs.bash.profileExtra =
|
|
builtins.readFile ./haskell/ghc-with-packages.sh;
|
|
|
|
home.file.".ghc/ghci.conf".text = ''
|
|
:{
|
|
ghci_set_prompt :: IO String
|
|
ghci_set_prompt = do
|
|
term <- System.Environment.Blank.getEnvDefault "TERM" ""
|
|
let (prompt,promptCont) =
|
|
if Data.List.isPrefixOf "xterm-" term
|
|
then ("\x1b[38;5;5mλ>\x1b[0m ", "\x1b[38;5;5m|>\x1b[0m ")
|
|
else ("λ> ", "|> ")
|
|
pure . unlines $
|
|
[ ":set prompt " ++ show prompt
|
|
, ":set prompt-cont " ++ show promptCont
|
|
]
|
|
:}
|
|
:cmd ghci_set_prompt
|
|
:set -interactive-print=Text.Pretty.Simple.pPrint
|
|
:m + Text.Show.Functions
|
|
:unset +r
|
|
:set +m
|
|
'';
|
|
|
|
sydnix.impermanence.cache.directories =
|
|
let xdg-cache-dir =
|
|
config.home.cacheHome
|
|
or "${config.home.homeDirectory}/.cache";
|
|
in [
|
|
# We don't want to rebuild Hackage simply due to a reboot, do we? }:)
|
|
(lib.removePrefix "${config.home.homeDirectory}/"
|
|
"${xdg-cache-dir}/cabal")
|
|
".stack"
|
|
];
|
|
};
|
|
}
|
|
|