Skip to content

Commit 756676f

Browse files
committed
Merge branch 'master' of github.com:input-output-hk/haskell.nix into circuithub
2 parents da97b1c + 1aade3d commit 756676f

File tree

5 files changed

+54
-12
lines changed

5 files changed

+54
-12
lines changed

builder/comp-builder.nix

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ let self =
5555
, doHoogle ? component.doHoogle # Also build a hoogle index
5656
, hyperlinkSource ? component.doHyperlinkSource # Link documentation to the source code
5757
, quickjump ? component.doQuickjump # Generate an index for interactive documentation navigation
58+
59+
# Keep the configFiles as a derivation output (otherwise they are in a temp directory)
60+
# We need this for `cabal-doctest` to work, but it is also likely
61+
, keepConfigFiles ? component.keepConfigFiles || configureAllComponents
62+
63+
# Keep the ghc wrapper as a `ghc` derivation output (otherwise it is in a temp directory)
64+
# This is used for the `ghc-paths` package in `modules/configuration.nix`
65+
, keepGhc ? component.keepGhc
66+
5867
, keepSource ? component.keepSource || configureAllComponents # Build from `source` output in the store then delete `dist`
5968
, setupHaddockFlags ? component.setupHaddockFlags
6069

@@ -397,7 +406,9 @@ let
397406
[ghc buildPackages.removeReferencesTo]
398407
++ executableToolDepends;
399408

400-
outputs = ["out" "configFiles" "ghc"]
409+
outputs = ["out"]
410+
++ (lib.optional keepConfigFiles "configFiles")
411+
++ (lib.optional keepGhc "ghc")
401412
++ (lib.optional enableSeparateDataOutput "data")
402413
++ (lib.optional keepSource "source")
403414
++ (lib.optional writeHieFiles "hie");
@@ -416,9 +427,22 @@ let
416427
chmod -R +w .
417428
'') + commonAttrs.prePatch;
418429

419-
configurePhase = ''
420-
mkdir -p $configFiles
421-
mkdir -p $ghc
430+
configurePhase =
431+
(
432+
if keepConfigFiles then ''
433+
mkdir -p $configFiles
434+
''
435+
else ''
436+
configFiles=$(mktemp -d)
437+
''
438+
) + (
439+
if keepGhc then ''
440+
mkdir -p $ghc
441+
''
442+
else ''
443+
ghc=$(mktemp -d)
444+
''
445+
) + ''
422446
wrappedGhc=$ghc
423447
${configFiles.script}
424448
${shellWrappers.script}

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/configuration-nix.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,8 @@ in {
157157
packages.bitvec.patches = [
158158
(fromUntil "1.1.3.0" "1.1.3.0.1" ../patches/bitvec-gmp-fix.patch)
159159
];
160+
161+
# ghc-paths stores the path of the GHC compiler used to build the component.
162+
# we need to keep it in the store so that it will remain valid.
163+
packages.ghc-paths.components.library.keepGhc = true;
160164
}

modules/package.nix

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,13 @@ in {
355355
# Exclude attributes that are likely to have conflicting definitions
356356
# (a common use case for `all` is in `shellFor` and it only has an
357357
# install phase).
358-
builtins.removeAttrs c ["preCheck" "postCheck" "keepSource"]
358+
builtins.removeAttrs c ["preCheck" "postCheck" "keepConfigFiles" "keepGhc" "keepSource"]
359359
) (lib.filter (c: c.buildable && c.planned) allComps)
360360
) // {
361-
# If any one of the components needs us to keep the source
361+
# If any one of the components needs us to keep one of these
362362
# then keep it for the `all` component
363+
keepConfigFiles = lib.foldl' (x: comp: x || comp.keepConfigFiles) false allComps;
364+
keepGhc = lib.foldl' (x: comp: x || comp.keepGhc) false allComps;
363365
keepSource = lib.foldl' (x: comp: x || comp.keepSource) false allComps;
364366
};
365367
}

modules/plan.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ let
168168
default = (def.profilingDetail or "default");
169169
};
170170

171+
keepConfigFiles = mkOption {
172+
type = bool;
173+
default = (def.keepConfigFiles or false);
174+
description = "Keep component configFiles in the store in a `configFiles` output";
175+
};
176+
177+
keepGhc = mkOption {
178+
type = bool;
179+
default = (def.keepGhc or false);
180+
description = "Keep component wrapped ghc in the store in a `ghc` output";
181+
};
182+
171183
keepSource = mkOption {
172184
type = bool;
173185
default = (def.keepSource or false);

0 commit comments

Comments
 (0)