Skip to content

Commit 7f79219

Browse files
committed
Add change log entry
1 parent 5109ce5 commit 7f79219

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

changelog.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,81 @@
11
This file contains a summary of changes to Haskell.nix and `nix-tools`
22
that will impact users.
33

4+
## Sep 16, 2024
5+
6+
Haskell.nix now uses the more granular Unit IDs from the plan.json
7+
to identify packages. This allows for different versions of a
8+
package to be used when building `built-tool-depend` and setup
9+
dependencies.
10+
11+
Overrides in the `modules` argument apply to all versions of
12+
the package. However to make this work we needed to make
13+
each `packages.somepackage` an option (instead of using the
14+
`attrsOf` option try).
15+
16+
It is now an error to override a package that is not in the
17+
plan. This can be a problem if you use the same overrides
18+
for multiple plans (different GHC versions, target platforms,
19+
or cabal flag settings). If the package does not exist in
20+
some of the variants you use `package-keys` to tell include
21+
the option anyway:
22+
23+
```
24+
modules = [{
25+
# Tell haskell.nix that `somepackage` may exist.
26+
package-keys = ["somepackage"];
27+
packages.somepackage.flags.someflag = true;
28+
}];
29+
```
30+
31+
There is a helper function you can use to add `package-keys`
32+
for all of the `builtins.attrNames` of `packages`:
33+
34+
```
35+
modules = [(pkgs.haskell-nix.haskellLib.addPackageKeys {
36+
packages.somepackage.flags.someflag = true;
37+
})];
38+
```
39+
40+
Do not use the modules `pkgs` arg to look `addPackageKeys` up
41+
though or it will result an `infinite recursion` error.
42+
43+
Code that uses `options.packages` will also need to be update.
44+
For instance the following code that uses `options.packages`
45+
to set `--Werror` for local packages:
46+
47+
```
48+
({ lib, ... }: {
49+
options.packages = lib.mkOption {
50+
type = lib.types.attrsOf (lib.types.submodule (
51+
{ config, lib, ... }:
52+
lib.mkIf config.package.isLocal
53+
{
54+
configureFlags = [ "--ghc-option=-Werror"];
55+
}
56+
));
57+
};
58+
})
59+
```
60+
61+
Now needs to do it for each of the entry in `config.package-keys`
62+
instead of using `attrsOf`:
63+
64+
```
65+
({ config, lib, ... }: {
66+
options.packages = lib.genAttrs config.package-keys (_:
67+
lib.mkOption {
68+
type = lib.types.submodule (
69+
{ config, lib, ... }:
70+
lib.mkIf config.package.isLocal
71+
{
72+
configureFlags = [ "--ghc-option=-Werror"];
73+
}
74+
);
75+
});
76+
})
77+
```
78+
479
## Jun 5, 2024
580

681
Haskell.nix now respects the `pre-existing` packages selected

0 commit comments

Comments
 (0)