nix: Parametrize 'project' so withHoogle is used in shell only

This commit is contained in:
Sridhar Ratnakumar 2022-05-17 14:53:13 -04:00
parent e4da4aef69
commit b366d729d2

View file

@ -37,12 +37,14 @@
pkgs.treefmt pkgs.treefmt
]; ];
project = returnShellEnv: project =
{ returnShellEnv ? false
, withHoogle ? false
}:
hp.developPackage { hp.developPackage {
inherit returnShellEnv; inherit returnShellEnv withHoogle;
name = "haskell-template"; name = "haskell-template";
root = ./.; root = ./.;
withHoogle = true;
overrides = self: super: with pkgs.haskell.lib; { overrides = self: super: with pkgs.haskell.lib; {
# Use callCabal2nix to override Haskell dependencies here # Use callCabal2nix to override Haskell dependencies here
# cf. https://tek.brick.do/K3VXJd8mEKO7 # cf. https://tek.brick.do/K3VXJd8mEKO7
@ -62,7 +64,7 @@
{ {
# Used by `nix build ...` # Used by `nix build ...`
packages = { packages = {
default = project false; default = project { };
}; };
# Used by `nix run ...` # Used by `nix run ...`
apps = { apps = {
@ -73,7 +75,7 @@
}; };
# Used by `nix develop ...` # Used by `nix develop ...`
devShells = { devShells = {
default = project true; default = project { returnShellEnv = true; withHoogle = true; };
}; };
# For compatability with older Nix (eg in CI) # For compatability with older Nix (eg in CI)
devShell = inputs.self.devShells.${system}.default; devShell = inputs.self.devShells.${system}.default;