diff --git a/doc/devshell.md b/doc/devshell.md index 4939fd3c..221d08ea 100644 --- a/doc/devshell.md +++ b/doc/devshell.md @@ -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 = { @@ -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 - diff --git a/nix/modules/project/devshell.nix b/nix/modules/project/devshell.nix index cc4b1b86..3785cac6 100644 --- a/nix/modules/project/devshell.nix +++ b/nix/modules/project/devshell.nix @@ -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 = '' @@ -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;