Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion doc/devshell.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ order: -8

haskell-flake uses the [`shellFor`][shellFor] function to provide a Haskell development shell. `shellFor` in turn uses the standard [`mkShell`][mkShell] function to create a Nix shell environment. The `mkShellArgs` option can be used to pass custom arguments to `mkShell`.

Development tools are built from `basePackages` by default. Use `devShell.packages` to choose a different Haskell package set for those tools:

```nix
{
haskellProjects.default.devShell.packages = pkgs.haskellPackages;
}
```

```nix
{
haskellProjects.default = {
Expand Down Expand Up @@ -45,4 +53,3 @@ This sort of composition is either impossible or very complex to do with the `mk

[shellFor]: https://nixos.org/manual/nixpkgs/unstable/#haskell-shellFor
[mkShell]: https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-mkShell

14 changes: 12 additions & 2 deletions nix/modules/project/devshell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ let
'';
default = true;
};
packages = mkOption {
type = types.lazyAttrsOf types.raw;
description = ''
Haskell package set used to build development tools.

By default, this is `basePackages`, before project package
overrides are applied.
'';
default = config.basePackages;
};
tools = mkOption {
type = functionTo (types.lazyAttrsOf (types.nullOr types.package));
description = ''
Expand Down Expand Up @@ -105,8 +115,8 @@ in
inherit (config.outputs) finalPackages;

nativeBuildInputs = lib.attrValues (
config.defaults.devShell.tools finalPackages //
config.devShell.tools finalPackages
config.defaults.devShell.tools config.devShell.packages //
config.devShell.tools config.devShell.packages
);
mkShellArgs = config.devShell.mkShellArgs // {
nativeBuildInputs = (config.devShell.mkShellArgs.nativeBuildInputs or [ ]) ++ nativeBuildInputs;
Expand Down