mirror of
https://github.com/srid/haskell-flake.git
synced 2024-09-11 05:55:25 +03:00
Fix settings.<name>.cabalFlags
implementation (#178)
* Fix cabalFlags implementation * Improve impl; add test * update changelog --------- Co-authored-by: Sridhar Ratnakumar <srid@srid.ca>
This commit is contained in:
parent
dfa5e263a9
commit
57cd506878
@ -9,7 +9,7 @@
|
||||
- `flake.haskellFlakeProjectModules`: Dropped all defaults, except the `output` module, which now exports `packages` and `settings`. Added a `defaults.projectModules.output` option that allows the user to override this module, or directly access the generated module.
|
||||
- Add `project.config.defaults.settings.default` defining sensible defaults for local packages.
|
||||
- Add `project.config.defaults.enable` to turn off all default settings en masse.
|
||||
- Regressions in this PR: #169
|
||||
- Regressions in this PR: #169, #178
|
||||
|
||||
## 0.3.0 (May 22, 2023)
|
||||
|
||||
|
@ -199,12 +199,11 @@ in
|
||||
'';
|
||||
impl = flags: drv:
|
||||
let
|
||||
enabled = lib.filterAttrs (_: v: v) flags;
|
||||
disabled = lib.filterAttrs (_: v: !v) flags;
|
||||
enableCabalFlags = fs: drv: builtins.foldl' enableCabalFlag drv fs;
|
||||
disableCabalFlags = fs: drv: builtins.foldl' disableCabalFlag drv fs;
|
||||
fns = lib.flip lib.mapAttrsToList flags (flag: enabled:
|
||||
(if enabled then enableCabalFlag else disableCabalFlag) flag
|
||||
);
|
||||
in
|
||||
lib.pipe drv [ enableCabalFlag disableCabalFlag ];
|
||||
lib.pipe drv fns;
|
||||
};
|
||||
patches = {
|
||||
type = types.listOf types.path;
|
||||
|
@ -52,6 +52,11 @@
|
||||
# the 'foo' package, we must override it here using `lib.mkForce`.
|
||||
foo.source = lib.mkForce (inputs.haskell-multi-nix + /foo);
|
||||
};
|
||||
settings = {
|
||||
foo = {
|
||||
cabalFlags.blah = true;
|
||||
};
|
||||
};
|
||||
devShell = {
|
||||
tools = hp: {
|
||||
# Adding a tool should make it available in devshell.
|
||||
|
Loading…
Reference in New Issue
Block a user