mirror of
https://github.com/srid/haskell-flake.git
synced 2024-09-11 05:55:25 +03:00
Add haskellFlakeProjectModules
option (#79)
This commit is contained in:
parent
4585d422cd
commit
5d1f6d9a76
@ -11,6 +11,7 @@
|
|||||||
- #64: Remove hlintCheck (use [treefmt-nix](https://github.com/numtide/treefmt-nix#flake-parts) instead)
|
- #64: Remove hlintCheck (use [treefmt-nix](https://github.com/numtide/treefmt-nix#flake-parts) instead)
|
||||||
- #52: Expose the final package set as `finalPackages`. Rename `haskellPackages`, accordingly, to `basePackages`. Overlays are applied on top of `basePackage` -- using `source-overrides`, `overrides`, `packages` in that order -- to produce `finalPackages`.
|
- #52: Expose the final package set as `finalPackages`. Rename `haskellPackages`, accordingly, to `basePackages`. Overlays are applied on top of `basePackage` -- using `source-overrides`, `overrides`, `packages` in that order -- to produce `finalPackages`.
|
||||||
- #68: You can now use `imports` inside of `haskellProjects.<name>` to modularize your Haskell project configuration.
|
- #68: You can now use `imports` inside of `haskellProjects.<name>` to modularize your Haskell project configuration.
|
||||||
|
- #79: `flake.haskellFlakeProjectModules.<name>` option can be used to set and expose your Haskell project modules to other flakes.
|
||||||
- #67: `overrides` will be combined using `composeManyExtensions`, however their order is arbitrary. This is an experimental feature, and a warning will be logged.
|
- #67: `overrides` will be combined using `composeManyExtensions`, however their order is arbitrary. This is an experimental feature, and a warning will be logged.
|
||||||
|
|
||||||
## 0.1.0
|
## 0.1.0
|
||||||
|
@ -239,9 +239,20 @@ in
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.haskellProjects = mkOption {
|
options = {
|
||||||
description = "Haskell projects";
|
haskellProjects = mkOption {
|
||||||
type = types.attrsOf projectSubmodule;
|
description = "Haskell projects";
|
||||||
|
type = types.attrsOf projectSubmodule;
|
||||||
|
};
|
||||||
|
|
||||||
|
haskellFlakeProjectModules = mkOption {
|
||||||
|
type = types.lazyAttrsOf types.deferredModule;
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
An attrset of `haskellProjects.<name>` modules that can be imported in
|
||||||
|
other flakes.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config =
|
||||||
|
@ -22,29 +22,26 @@
|
|||||||
inputs.haskell-flake.flakeModule
|
inputs.haskell-flake.flakeModule
|
||||||
inputs.check-flake.flakeModule
|
inputs.check-flake.flakeModule
|
||||||
];
|
];
|
||||||
|
flake.haskellFlakeProjectModules.default = { pkgs, ... }: {
|
||||||
|
overrides = self: super: {
|
||||||
|
# This is purposefully incorrect (pointing to ./.) because we
|
||||||
|
# expect it to be overriden in perSystem below.
|
||||||
|
foo = self.callCabal2nix "foo" ./. { };
|
||||||
|
};
|
||||||
|
devShell = {
|
||||||
|
tools = hp: {
|
||||||
|
# Setting to null should remove this tool from defaults.
|
||||||
|
ghcid = null;
|
||||||
|
};
|
||||||
|
hlsCheck.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
perSystem = { self', pkgs, ... }: {
|
perSystem = { self', pkgs, ... }: {
|
||||||
haskellProjects.default = {
|
haskellProjects.default = {
|
||||||
# Multiple modules should be merged correctly.
|
# Multiple modules should be merged correctly.
|
||||||
imports =
|
imports = [ self.haskellFlakeProjectModules.default ];
|
||||||
let
|
|
||||||
defaults = {
|
|
||||||
overrides = self: super: {
|
|
||||||
# This is purposefully incorrect (pointing to ./.) because we
|
|
||||||
# expect it to be overriden below.
|
|
||||||
foo = self.callCabal2nix "foo" ./. { };
|
|
||||||
};
|
|
||||||
devShell = {
|
|
||||||
tools = hp: {
|
|
||||||
# Setting to null should remove this tool from defaults.
|
|
||||||
ghcid = null;
|
|
||||||
};
|
|
||||||
hlsCheck.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
[ defaults ];
|
|
||||||
overrides = self: super: {
|
overrides = self: super: {
|
||||||
# This overrides the overlay above (in `defaults`), because the
|
# This overrides the overlay above (in `flake.*`), because the
|
||||||
# module system merges them in such order. cf. the WARNING in option
|
# module system merges them in such order. cf. the WARNING in option
|
||||||
# docs.
|
# docs.
|
||||||
foo = self.callCabal2nix "foo" (inputs.haskell-multi-nix + /foo) { };
|
foo = self.callCabal2nix "foo" (inputs.haskell-multi-nix + /foo) { };
|
||||||
|
Loading…
Reference in New Issue
Block a user