Skip to content

Commit 9e17ffd

Browse files
committed
doc: dedicate page for settings
1 parent ef7ac92 commit 9e17ffd

File tree

5 files changed

+58
-42
lines changed

5 files changed

+58
-42
lines changed

doc/dependency.md

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -71,48 +71,11 @@ haskellProjects.default = {
7171

7272
## Overriding a Haskell package settings {#settings}
7373

74-
```nix
75-
haskellProjects.default = {
76-
settings = {
77-
ema = { # This module can take `{self, super, ...}` args, optionally.
78-
# Disable running tests
79-
check = false;
80-
81-
# Disable building haddock (documentation)
82-
haddock = false;
83-
84-
# Ignore Cabal version constraints
85-
jailbreak = true;
74+
See [[settings]]
8675

87-
# Extra non-Haskell dependencies
88-
extraBuildDepends = [ pkgs.stork ];
89-
90-
# Source patches
91-
patches = [ ./patches/ema-bug-fix.patch ];
92-
93-
# Enable/disable Cabal flags
94-
cabalFlags.with-generics = true;
95-
96-
# Allow building a package marked as "broken"
97-
broken = false;
98-
};
99-
};
100-
};
101-
```
102-
103-
>[!info] Note
104-
> ### [nixpkgs] functions
105-
>
106-
> - The `pkgs.haskell.lib` module provides various utility functions that you can use to override Haskell packages. The canonical place to find documentation on these is [the source](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib/compose.nix). haskell-flake provides a `settings` submodule for convienience. For eg., the `dontCheck` function translates to `settings.<name>.check`; the full list of options can be seen [here](https://github.com/srid/haskell-flake/blob/master/nix/modules/project/settings/all.nix).
107-
108-
## Sharing settings {#settings-share}
76+
## Sharing dependency overrides {#share}
10977

11078
[[modules]] export both `packages` and `settings` options for reuse in downstream Haskell projects.
11179

112-
## Examples
113-
114-
- [Emanote overrides](https://github.com/srid/emanote/commit/5b24bd04f94e03afe66ee01da723e4a05d854953): also demonstrates how to add a *new* setting option (`removeReferencesTo`).
115-
116-
11780

118-
[nixpkgs]: https://zero-to-nix.com/concepts/nixpkgs
81+
[nixpkgs]: https://nixos.asia/en/nixpkgs

doc/devshell.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
order: -9
2+
order: -8
33
---
44

55
# DevShell

doc/guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ order: -9
55
# Guide
66

77
- [[dependency]]#
8+
- [[settings]]#
89
- [[devshell]]#
910
- [[package-set]]#
1011
- [[modules]]#

doc/modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ By default, haskell-flake will generate the following modules for the "default"
5656
| -- | -- |
5757
| `haskellFlakeProjectModules.output` | Local packages & dependency overrides |
5858

59-
The idea here being that you can "connect" two Haskell projects such that they depend on one another while reusing the overrides (`packages` and `settings`) from one place. For example, if you have a project "foo" that depends on "bar" and if "foo"'s flake.nix has "bar" as its input, then in "foo"'s `haskellProject.default` entry you can import "bar" as follows:
59+
The idea here being that you can "connect" two Haskell projects such that they depend on one another while reusing the overrides -- `packages` (see [[dependency]]) and `settings` (see [[settings]]) -- from one place. For example, if you have a project "foo" that depends on "bar" and if "foo"'s flake.nix has "bar" as its input, then in "foo"'s `haskellProject.default` entry you can import "bar" as follows:
6060

6161
```nix
6262
# foo's flake.nix's perSystem

doc/settings.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
order: -9
3+
---
4+
5+
# Package Settings
6+
7+
Settings for individual Haskell packages can be specified in the `settings` attribute of a `haskellProjects` module.
8+
9+
```nix
10+
haskellProjects.default = {
11+
settings = {
12+
ema = { # This module can take `{self, super, ...}` args, optionally.
13+
# Disable running tests
14+
check = false;
15+
16+
# Disable building haddock (documentation)
17+
haddock = false;
18+
19+
# Ignore Cabal version constraints
20+
jailbreak = true;
21+
22+
# Extra non-Haskell dependencies
23+
extraBuildDepends = [ pkgs.stork ];
24+
25+
# Source patches
26+
patches = [ ./patches/ema-bug-fix.patch ];
27+
28+
# Enable/disable Cabal flags
29+
cabalFlags.with-generics = true;
30+
31+
# Allow building a package marked as "broken"
32+
broken = false;
33+
};
34+
};
35+
};
36+
```
37+
38+
>[!info] Note
39+
> ### [nixpkgs] functions
40+
>
41+
> - The `pkgs.haskell.lib` module provides various utility functions that you can use to override Haskell packages. The canonical place to find documentation on these is [the source](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib/compose.nix). haskell-flake provides a `settings` submodule for convenience. For eg., the `dontCheck` function translates to `settings.<name>.check`; the full list of options can be seen [here](https://github.com/srid/haskell-flake/blob/master/nix/modules/project/settings/all.nix).
42+
43+
## Sharing package settings {#share}
44+
45+
[[modules]] export both `packages` and `settings` options for reuse in downstream Haskell projects.
46+
47+
## Custom settings {#custom}
48+
49+
- [Emanote overrides](https://github.com/srid/emanote/commit/5b24bd04f94e03afe66ee01da723e4a05d854953): demonstrates how to add a *new* setting option (`removeReferencesTo`).
50+
51+
52+
[nixpkgs]: https://nixos.asia/en/nixpkgs

0 commit comments

Comments
 (0)