mirror of
https://github.com/srid/haskell-flake.git
synced 2024-09-11 05:55:25 +03:00
Enable specifying the default devShell.tools
This commit is contained in:
parent
fb1a3c32a8
commit
98dfcc619b
@ -9,6 +9,7 @@
|
|||||||
- #151: Use `lib.getBin` to get the bin output
|
- #151: Use `lib.getBin` to get the bin output
|
||||||
- #148: Remove automatic hpack->cabal generation. Use `pre-commit-hooks.nix` instead.
|
- #148: Remove automatic hpack->cabal generation. Use `pre-commit-hooks.nix` instead.
|
||||||
- #149: Fix unnecessary re-runs of cabal2nix evaluation. Add a `debug` option to have haskell-flake produce diagnostic messages.
|
- #149: Fix unnecessary re-runs of cabal2nix evaluation. Add a `debug` option to have haskell-flake produce diagnostic messages.
|
||||||
|
- #153: Add `config.defaults` submodule to allow overriding the default devShell tools added by haskell-flake
|
||||||
|
|
||||||
## 0.2.0 (Mar 13, 2023)
|
## 0.2.0 (Mar 13, 2023)
|
||||||
|
|
||||||
|
@ -84,6 +84,7 @@ in
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./project/devshell.nix
|
./project/devshell.nix
|
||||||
|
./project/defaults.nix
|
||||||
];
|
];
|
||||||
options = {
|
options = {
|
||||||
projectRoot = mkOption {
|
projectRoot = mkOption {
|
||||||
|
24
nix/modules/project/defaults.nix
Normal file
24
nix/modules/project/defaults.nix
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# A module representing the default values used internally by haskell-flake.
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkOption
|
||||||
|
types;
|
||||||
|
inherit (types)
|
||||||
|
functionTo;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.defaults = {
|
||||||
|
devShell.tools = mkOption {
|
||||||
|
type = functionTo (types.attrsOf (types.nullOr types.package));
|
||||||
|
description = ''Build tools always included in devShell'';
|
||||||
|
default = hp: with hp; {
|
||||||
|
inherit
|
||||||
|
cabal-install
|
||||||
|
haskell-language-server
|
||||||
|
ghcid
|
||||||
|
hlint;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -20,11 +20,12 @@ let
|
|||||||
type = functionTo (types.attrsOf (types.nullOr types.package));
|
type = functionTo (types.attrsOf (types.nullOr types.package));
|
||||||
description = ''
|
description = ''
|
||||||
Build tools for developing the Haskell project.
|
Build tools for developing the Haskell project.
|
||||||
|
|
||||||
|
These tools are merged with the haskell-flake defaults defined in the
|
||||||
|
`defaults.devShell.tools` option. Set the value to `null` to remove
|
||||||
|
that default tool.
|
||||||
'';
|
'';
|
||||||
default = hp: { };
|
default = hp: { };
|
||||||
defaultText = ''
|
|
||||||
Build tools useful for Haskell development are included by default.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
extraLibraries = mkOption {
|
extraLibraries = mkOption {
|
||||||
type = functionTo (types.attrsOf (types.nullOr types.package));
|
type = functionTo (types.attrsOf (types.nullOr types.package));
|
||||||
@ -83,14 +84,10 @@ in
|
|||||||
let
|
let
|
||||||
inherit (config.outputs) finalPackages;
|
inherit (config.outputs) finalPackages;
|
||||||
|
|
||||||
defaultBuildTools = hp: with hp; {
|
nativeBuildInputs = lib.attrValues (
|
||||||
inherit
|
config.defaults.devShell.tools finalPackages //
|
||||||
cabal-install
|
config.devShell.tools finalPackages
|
||||||
haskell-language-server
|
);
|
||||||
ghcid
|
|
||||||
hlint;
|
|
||||||
};
|
|
||||||
nativeBuildInputs = lib.attrValues (defaultBuildTools finalPackages // config.devShell.tools finalPackages);
|
|
||||||
mkShellArgs = config.devShell.mkShellArgs // {
|
mkShellArgs = config.devShell.mkShellArgs // {
|
||||||
nativeBuildInputs = (config.devShell.mkShellArgs.nativeBuildInputs or [ ]) ++ nativeBuildInputs;
|
nativeBuildInputs = (config.devShell.mkShellArgs.nativeBuildInputs or [ ]) ++ nativeBuildInputs;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user