diff --git a/modules/dev/default.nix b/modules/dev/default.nix index 7d6d72a..a41e947 100644 --- a/modules/dev/default.nix +++ b/modules/dev/default.nix @@ -1 +1,3 @@ -{ ... }: { imports = [ ./nix.nix ./purescript.nix ./javascript.nix ]; } +{ ... }: { + imports = [ ./nix.nix ./purescript.nix ./javascript.nix ./haskell ]; +} diff --git a/modules/dev/haskell/default.nix b/modules/dev/haskell/default.nix new file mode 100644 index 0000000..0cd6b48 --- /dev/null +++ b/modules/dev/haskell/default.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +let hie = pkgs.all-hies.selection { selector = p: { inherit (p) ghc865; }; }; +in { + home-manager.users.adrielus.home = { + file.".ghci".source = ./ghci; + # file.".stack/config.yaml".source = ./stack.yaml; + + packages = with pkgs; + [ ghc ghcid hlint cabal-install snack stack hie ] + ++ (with haskellPackages; [ brittany hoogle hpack pointfree pointful ]); + }; +} diff --git a/modules/dev/haskell/ghci b/modules/dev/haskell/ghci new file mode 100644 index 0000000..efc3000 --- /dev/null +++ b/modules/dev/haskell/ghci @@ -0,0 +1,10 @@ +:def paste \_ -> do { paste <- System.Process.readProcess "pbpaste" [] ""; let cmd = if '\n' `elem` paste then ":{\ntype Ö = ()\n" ++ paste ++ "\n:}" else paste in putStrLn ("\SOH\ESC[33m\STX" ++ paste ++ "\SOH\ESC[0m\STX") >> return (":cmd return " ++ show cmd) } +:def paste-quiet \_ -> do { paste <- System.Process.readProcess "pbpaste" [] ""; let cmd = if '\n' `elem` paste then ":{\ntype Ö = ()\n" ++ paste ++ "\n:}" else paste in return (":cmd return " ++ show cmd) } + +:def hoogle \str -> return $ ":! hoogle search --color --count=10 " ++ show str +:def hoogle-all \str -> return $ ":! hoogle search --color " ++ show str +:def doc \str -> return $ ":! hoogle search --color --info " ++ show str + +:def pointfree \str -> return $ ":! pointfree " ++ show str +:def pf \str -> return $ ":! pointfree " ++ show str +:def pointful \str -> return $ ":! pointful " ++ show str \ No newline at end of file diff --git a/modules/dev/haskell/stack.yaml b/modules/dev/haskell/stack.yaml new file mode 100644 index 0000000..a4e4688 --- /dev/null +++ b/modules/dev/haskell/stack.yaml @@ -0,0 +1,5 @@ +templates: + params: + author-name: "Matei Adriel" + author-email: "rafaeladriel11@gmail.com" + github-username: "Mateiadrielrafael" diff --git a/modules/overlay.nix b/modules/overlay.nix index 27428e4..cfab1bf 100644 --- a/modules/overlay.nix +++ b/modules/overlay.nix @@ -9,13 +9,17 @@ in { inherit imports; inherit unstable; + inherit (import imports.niv { }) niv; + cached-nix-shell = callPackage imports.cached-nix-shell { }; easy-purescript-nix = callPackage imports.easy-purescript-nix { }; - brave = unstable.brave; + all-hies = import imports.all-hies { }; + snack = (import imports.snack).snack-exe; - inherit (import imports.niv { }) niv; - inherit (import imports.all-hies { }) all-hies; + # unstable stuff + brave = unstable.brave; + ghc = unstable.ghc; }) ]; diff --git a/nix/sources.json b/nix/sources.json index 5fd05a1..46accb4 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -106,5 +106,17 @@ "type": "tarball", "url": "https://github.com/nixos/nixpkgs-channels/archive/9b0d2f3fd153167b0c8ce84bb71e766a39ed4c9d.tar.gz", "url_template": "https://github.com///archive/.tar.gz" + }, + "snack": { + "branch": "master", + "description": "Nix-based incremental build tool for Haskell projects", + "homepage": "", + "owner": "nmattia", + "repo": "snack", + "rev": "b638463b9a7490867b44d0c33bb02e8f7ca82f29", + "sha256": "02h4f0nrjvhsm7hvmrnc4kfi5my48d7yvind0f1kq1lsrcch6iph", + "type": "tarball", + "url": "https://github.com/nmattia/snack/archive/b638463b9a7490867b44d0c33bb02e8f7ca82f29.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" } }