1# package descriptions in hackage will look like:
2# { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs }:
3# { flags = { flag1 = false; flags2 = true; ... };
4# package = { specVersion = "X.Y"; identifier = { name = "..."; version = "a.b.c.d"; };
5# license = "..."; copyright = "..."; maintainer = "..."; author = "...";
6# homepage = "..."; url = "..."; synopsis = "..."; description = "...";
7# buildType = "Simple"; # or Custom, Autoconf, ...
10# "..." = { depends = [ (hsPkgs.base) ... ]; };
11# exes = { "..." = { depends = ... };
12# "..." = { depends = ... }; };
13# tests = { "..." = { depends = ... }; ... };
16{ parentConfig, mod_args, listOfFilteringNulls, componentOptions, packageOptions }:
17{ lib, config, pkgs, haskellLib, ... }:
22# Work around issue that can cause _lots_ of files to be copied into the store.
23# See https://github.com/NixOS/nixpkgs/pull/64691
25 path = types.path // { check = x: types.path.check (x.origSrc or x); };
27 componentType = submodule {
28 # add the shared componentOptions
29 options = (packageOptions config) // {
30 buildable = mkOption {
35 type = listOf (submodule {
40 moduleName = mkOption {
52 type = listOfFilteringNulls unspecified;
56 type = listOfFilteringNulls (either (nullOr package) (listOfFilteringNulls package));
59 frameworks = mkOption {
60 type = listOfFilteringNulls package;
63 pkgconfig = mkOption {
64 type = listOf (listOfFilteringNulls package);
67 build-tools = mkOption {
68 type = listOfFilteringNulls unspecified;
72 type = listOfFilteringNulls unspecified;
75 asmSources = mkOption {
76 type = listOfFilteringNulls unspecified;
79 cmmSources = mkOption {
80 type = listOfFilteringNulls unspecified;
84 type = listOfFilteringNulls unspecified;
87 cxxSources = mkOption {
88 type = listOfFilteringNulls unspecified;
91 jsSources = mkOption {
92 type = listOfFilteringNulls unspecified;
95 hsSourceDirs = mkOption {
96 type = listOfFilteringNulls unspecified;
99 includeDirs = mkOption {
100 type = listOfFilteringNulls unspecified;
103 includes = mkOption {
104 type = listOfFilteringNulls unspecified;
107 mainPath = mkOption {
108 type = listOfFilteringNulls unspecified;
111 extraSrcFiles = mkOption {
112 type = listOfFilteringNulls unspecified;
115 platforms = mkOption {
116 type = nullOr (listOfFilteringNulls unspecified);
123 # This is how the Nix expressions generated by *-to-nix receive
124 # their flags argument.
125 config._module.args = mod_args // { flags = config.flags; };
127 options = (packageOptions parentConfig) // {
128 # TODO: Add descriptions to everything.
133 specVersion = mkOption {
137 identifier.name = mkOption {
141 identifier.version = mkOption {
149 copyright = mkOption {
153 maintainer = mkOption {
161 homepage = mkOption {
169 synopsis = mkOption {
173 description = mkOption {
177 buildType = mkOption {
181 setup-depends = mkOption {
182 type = listOfFilteringNulls unspecified;
186 detailLevel = mkOption {
188 default = "MinimalDetails";
191 licenseFiles = mkOption {
192 type = listOfFilteringNulls unspecified;
201 dataFiles = mkOption {
202 type = listOfFilteringNulls unspecified;
206 extraSrcFiles = mkOption {
207 type = listOfFilteringNulls unspecified;
211 extraTmpFiles = mkOption {
212 type = listOfFilteringNulls unspecified;
216 extraDocFiles = mkOption {
217 type = listOfFilteringNulls unspecified;
221 cleanHpack = mkOption {
231 isProject = mkOption {
236 buildable = mkOption {
244 type = nullOr componentType;
249 doExactConfig = false;
250 # We have to set hsSourceDirs or cleanCabalComponent will
251 # include everything (and as a result all the components of
252 # the package will depend on everything in the package).
253 # TODO find a better way
254 hsSourceDirs = ["setup-src"];
261 extraSrcFiles = [ "Setup.hs" "Setup.lhs" ];
266 type = nullOr componentType;
270 type = attrsOf componentType;
273 foreignlibs = mkOption {
274 type = attrsOf componentType;
278 type = attrsOf componentType;
282 type = attrsOf componentType;
285 benchmarks = mkOption {
286 type = attrsOf componentType;
293 default = "${config.package.identifier.name}-${config.package.identifier.version}";
294 defaultText = "\${config.package.identifier.name}-\${config.package.identifier.version}";
301 type = either path package;
302 default = pkgs.fetchurl { url = "mirror://hackage/${config.name}.tar.gz"; inherit (config) sha256; };
303 defaultText = "pkgs.fetchurl { url = \"mirror://hackage/\${config.name}.tar.gz\"; inherit (config) sha256; };";
305 cabal-generator = mkOption {
309 revision = mkOption {
313 revisionSha256 = mkOption {
318 type = listOf (either unspecified path);
321 # This used to be `components.all` but it has been added back as `allComponent` to
322 # to avoid confusion. It is not mapped by `builder/hspkg-builder.nix` to anything
323 # you can build. Instead it is used internally when `configureAllComponents`
324 # is set or for tests whe on `cabal-doctest` is in the `setup-depends` of the package.
325 allComponent = mkOption {
326 type = componentType;
327 apply = all: all // {
328 # TODO: Should this check for the entire component
329 # definition to match, rather than just the identifier?
330 depends = builtins.filter (p: p.identifier != config.package.identifier) all.depends;
332 description = "The merged dependencies of all other components";
336 # This has one quirk. Manually setting options on the all component
337 # will be considered a conflict. This is almost always fine; most
338 # settings should be modified in either the package options, or an
339 # individual component's options. When this isn't sufficient,
340 # mkForce is a reasonable workaround.
342 # An alternative solution to mkForce for many of the options where
343 # this is relevant would be to switch from the bool type to
344 # something like an anyBool type, which would merge definitions by
345 # returning true if any is true.
346 config.allComponent =
347 let allComps = haskellLib.getAllComponents config;
350 # Exclude attributes that are likely to have conflicting definitions
351 # (a common use case for `all` is in `shellFor` and it only has an
353 builtins.removeAttrs c ["preCheck" "postCheck" "keepSource"]
356 # If any one of the components needs us to keep the source
357 # then keep it for the `all` component
358 keepSource = lib.foldl' (x: comp: x || comp.keepSource) false allComps;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list