Skip to content

Commit 4dd46c5

Browse files
committed
Reformat
1 parent 56814a1 commit 4dd46c5

File tree

1 file changed

+186
-161
lines changed

1 file changed

+186
-161
lines changed

flake.nix

Lines changed: 186 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,17 @@
9999

100100
traceNames = prefix: builtins.mapAttrs (n: v:
101101
if builtins.isAttrs v
102-
then if v ? type && v.type == "derivation"
103-
then builtins.trace (prefix + n) v
104-
else traceNames (prefix + n + ".") v
105-
else v);
102+
then if v ? type && v.type == "derivation"
103+
then builtins.trace (prefix + n) v
104+
else traceNames (prefix + n + ".") v
105+
else v);
106106

107107
traceHydraJobs = x: x // { inherit (traceNames "" x) hydraJobs; };
108108

109109
# systems supported by haskell.nix
110110
systems = [
111111
"x86_64-linux"
112-
] ++ (if runningHydraEvalTest then [] else [
112+
] ++ (if runningHydraEvalTest then [ ] else [
113113
"x86_64-darwin"
114114
"aarch64-darwin"
115115
]);
@@ -128,190 +128,215 @@
128128
filterDerivations;
129129

130130
flake = {
131-
inherit config;
132-
overlay = self.overlays.combined;
133-
overlays = import ./overlays { sources = inputs; };
131+
inherit config;
132+
overlay = self.overlays.combined;
133+
overlays = import ./overlays { sources = inputs; };
134134

135-
internal = {
136-
nixpkgsArgs = {
137-
inherit config;
138-
overlays = [ self.overlay ];
139-
};
135+
internal = {
136+
nixpkgsArgs = {
137+
inherit config;
138+
overlays = [ self.overlay ];
139+
};
140140

141-
sources = inputs;
141+
sources = inputs;
142142

143-
overlaysOverrideable =
144-
lib.warn
145-
"Using this attribute is deprecated. Import ${./overlays} directly or use the flake overlays output with override-inut."
146-
(import ./overlays);
143+
overlaysOverrideable =
144+
lib.warn
145+
"Using this attribute is deprecated. Import ${./overlays} directly or use the flake overlays output with override-inut."
146+
(import ./overlays);
147147

148-
# Compatibility with old default.nix
149-
compat =
150-
lib.warn
151-
"Using this attribute is deprecated. You can pass the same arguments to ${./default.nix} instead"
152-
(import ./default.nix);
153-
};
148+
# Compatibility with old default.nix
149+
compat =
150+
lib.warn
151+
"Using this attribute is deprecated. You can pass the same arguments to ${./default.nix} instead"
152+
(import ./default.nix);
153+
};
154154

155-
legacyPackages = forEachSystem (system:
156-
import nixpkgs {
157-
inherit config;
158-
overlays = [ self.overlay ];
159-
localSystem = { inherit system; };
160-
});
155+
legacyPackages = forEachSystem (system:
156+
import nixpkgs {
157+
inherit config;
158+
overlays = [ self.overlay ];
159+
localSystem = { inherit system; };
160+
});
161161

162-
legacyPackagesUnstable = forEachSystem (system:
163-
import nixpkgs-unstable {
164-
inherit config;
165-
overlays = [ self.overlay ];
166-
localSystem = { inherit system; };
167-
});
162+
legacyPackagesUnstable = forEachSystem (system:
163+
import nixpkgs-unstable {
164+
inherit config;
165+
overlays = [ self.overlay ];
166+
localSystem = { inherit system; };
167+
});
168168

169-
# Exposed so CI can check that `allow-import-from-derivation=false` works
170-
# for core of haskell.nix E.g. this should always work:
171-
# nix build .#roots.x86_64-linux --accept-flake-config --option allow-import-from-derivation false
172-
roots = forEachSystem (system:
173-
self.legacyPackagesUnstable.${system}.haskell-nix.roots compiler);
169+
# Exposed so CI can check that `allow-import-from-derivation=false` works
170+
# for core of haskell.nix E.g. this should always work:
171+
# nix build .#roots.x86_64-linux --accept-flake-config --option allow-import-from-derivation false
172+
roots = forEachSystem (system:
173+
self.legacyPackagesUnstable.${system}.haskell-nix.roots compiler);
174174

175-
# Note: `nix flake check` evaluates outputs for all platforms, and haskell.nix
176-
# uses IFD heavily, you have to have the ability to build for all platforms
177-
# supported by haskell.nix, e.g. with remote builders, in order to check this flake.
178-
# If you want to run the tests for just your platform, run `./test/tests.sh` or
179-
# `nix-build -A checks.$PLATFORM`
180-
checks = forEachSystemPkgs (pkgs:
181-
builtins.listToAttrs (
182-
map
183-
(pkg: { name = pkg.name; value = pkg; })
184-
(lib.collect
185-
lib.isDerivation
186-
(import ./test {
187-
haskellNix.sources = inputs;
188-
haskellNix.nixpkgsArgs = nixpkgsArgs;
189-
compiler-nix-name = compiler;
190-
inherit pkgs;
191-
})
175+
# Note: `nix flake check` evaluates outputs for all platforms, and haskell.nix
176+
# uses IFD heavily, you have to have the ability to build for all platforms
177+
# supported by haskell.nix, e.g. with remote builders, in order to check this flake.
178+
# If you want to run the tests for just your platform, run `./test/tests.sh` or
179+
# `nix-build -A checks.$PLATFORM`
180+
checks = forEachSystemPkgs (pkgs:
181+
builtins.listToAttrs (
182+
map
183+
(pkg: { name = pkg.name; value = pkg; })
184+
(lib.collect
185+
lib.isDerivation
186+
(import ./test {
187+
haskellNix.sources = inputs;
188+
haskellNix.nixpkgsArgs = nixpkgsArgs;
189+
compiler-nix-name = compiler;
190+
inherit pkgs;
191+
})
192192
)
193-
)
193+
)
194194
);
195195

196-
# NOTE: these are the hix cli utilities, which is a separate thing from
197-
# the hix.nix overlays (which extends haskell.nix with hixProject).
198-
packages = forEachSystemPkgs (pkgs:
199-
(import ./hix/default.nix { inherit pkgs; }).apps
200-
);
201-
apps = forEachSystemPkgs (pkgs:
202-
builtins.mapAttrs (name: exe: {
203-
type = "app";
204-
program = exe + "/bin/${name}";
205-
}) pkgs.haskell-nix.nix-tools-unchecked.exes
206-
);
196+
# NOTE: these are the hix cli utilities, which is a separate thing from
197+
# the hix.nix overlays (which extends haskell.nix with hixProject).
198+
packages = forEachSystemPkgs (pkgs:
199+
(import ./hix/default.nix { inherit pkgs; }).apps
200+
);
201+
apps = forEachSystemPkgs (pkgs:
202+
builtins.mapAttrs
203+
(name: exe: {
204+
type = "app";
205+
program = exe + "/bin/${name}";
206+
})
207+
pkgs.haskell-nix.nix-tools-unchecked.exes
208+
);
207209

208-
allJobs = forEachSystem (system:
209-
stripAttrsForHydra (filterDerivations (
210-
# This is awkward.
211-
import ./ci.nix {
212-
inherit ifdLevel system;
213-
haskellNix = self;
214-
})));
210+
allJobs = forEachSystem (system:
211+
stripAttrsForHydra (filterDerivations (
212+
# This is awkward.
213+
import ./ci.nix {
214+
inherit ifdLevel system;
215+
haskellNix = self;
216+
}
217+
)));
215218

216-
requiredJobs = forEachSystem (system:
217-
let
218-
inherit (self.legacyPackages.${system}) releaseTools;
219-
in
220-
lib.concatMapAttrs (nixpkgsVer:
221-
lib.concatMapAttrs (compiler-nix-name:
222-
lib.concatMapAttrs (crossPlatform: ghcJobs:
223-
let
224-
name = "required-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}";
225-
value = releaseTools.aggregate {
219+
requiredJobs = forEachSystem (system:
220+
let
221+
inherit (self.legacyPackages.${system}) releaseTools;
222+
in
223+
lib.concatMapAttrs
224+
(nixpkgsVer:
225+
lib.concatMapAttrs (compiler-nix-name:
226+
lib.concatMapAttrs (crossPlatform: ghcJobs:
227+
let
228+
name = "required-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}";
229+
value = releaseTools.aggregate {
226230
name = "haskell.nix-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}";
227231
meta.description = "All ${nixpkgsVer} ${compiler-nix-name} ${crossPlatform} jobs";
228232
constituents = lib.collect lib.isDerivation ghcJobs;
229-
};
230-
in
231-
lib.optionalAttrs
232-
(crossPlatform != "recurseForDerivations" && crossPlatform != "meta")
233-
{ ${name} = value; })
233+
};
234+
in
235+
lib.optionalAttrs
236+
(crossPlatform != "recurseForDerivations" && crossPlatform != "meta")
237+
{ ${name} = value; })
234238
)
235239
)
236240
self.allJobs.${system}
237-
);
241+
);
238242

239-
hydraJobs = forEachSystem (system:
240-
let
241-
# Include hydraJobs from nix-tools subflake.
242-
# NOTE: These derivations do not depend on the haskell.nix in ./. but
243-
# on the version of haskell.nix locked in the subflake. They are
244-
# evaluated within their own flake and independently of anything
245-
# else. Here we only expose them in the main flake.
246-
nix-tools-hydraJobs =
247-
let cf = callFlake {
248-
inherit system;
249-
pkgs = self.legacyPackages.${system};
250-
src = ./nix-tools;
251-
};
252-
in cf.defaultNix.hydraJobs;
253-
in
254-
self.allJobs.${system}
243+
hydraJobs = forEachSystem (system:
244+
let
245+
# Include hydraJobs from nix-tools subflake.
246+
# NOTE: These derivations do not depend on the haskell.nix in ./. but
247+
# on the version of haskell.nix locked in the subflake. They are
248+
# evaluated within their own flake and independently of anything
249+
# else. Here we only expose them in the main flake.
250+
nix-tools-hydraJobs =
251+
let
252+
cf = callFlake {
253+
inherit system;
254+
pkgs = self.legacyPackages.${system};
255+
src = ./nix-tools;
256+
};
257+
in
258+
cf.defaultNix.hydraJobs;
259+
in
260+
self.allJobs.${system}
255261
// lib.optionalAttrs (ifdLevel > 2)
256-
{ nix-tools = nix-tools-hydraJobs.${system} or {}; }
257-
);
262+
{ nix-tools = nix-tools-hydraJobs.${system} or { }; }
263+
);
258264

259-
devShells = forEachSystemPkgs (pkgs:
260-
let inherit (pkgs) mkShell nixUnstable cabal-install haskell-nix;
261-
in {
262-
default =
263-
mkShell {
264-
buildInputs = [
265-
nixUnstable
266-
cabal-install
267-
haskell-nix.compiler.${compiler}
268-
];
269-
};
270-
}
271-
//
272-
builtins.mapAttrs
273-
(compiler-nix-name: compiler:
274-
mkShell {
275-
buildInputs = [
276-
compiler
277-
haskell-nix.cabal-install.${compiler-nix-name}
278-
];
279-
})
280-
( # Exclude old versions of GHC to speed up `nix flake check`
281-
builtins.removeAttrs haskell-nix.compiler
282-
[ "ghc844"
283-
"ghc861" "ghc862" "ghc863" "ghc864"
284-
"ghc881" "ghc882" "ghc883"
285-
"ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc810420210212"
286-
"ghc901"
287-
"ghc921" "ghc922" "ghc923"])
288-
);
289-
}; in with (import nixpkgs { system = "x86_64-linux"; });
290-
traceHydraJobs (lib.recursiveUpdate flake (lib.optionalAttrs (ifdLevel > 2) {
291-
hydraJobs.nix-tools = pkgs.releaseTools.aggregate {
292-
name = "nix-tools";
293-
constituents = (if runningHydraEvalTest then [] else [
294-
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static"
295-
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static"
296-
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
297-
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
298-
]) ++ [
299-
"x86_64-linux.nix-tools.static.zipped.nix-tools-static"
300-
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64"
301-
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-no-ifd"
302-
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd"
303-
(writeText "gitrev" (self.rev or "0000000000000000000000000000000000000000"))
304-
];
305-
};
306-
}));
265+
devShells = forEachSystemPkgs (pkgs:
266+
let inherit (pkgs) mkShell nixUnstable cabal-install haskell-nix;
267+
in {
268+
default =
269+
mkShell {
270+
buildInputs = [
271+
nixUnstable
272+
cabal-install
273+
haskell-nix.compiler.${compiler}
274+
];
275+
};
276+
}
277+
//
278+
builtins.mapAttrs
279+
(compiler-nix-name: compiler:
280+
mkShell {
281+
buildInputs = [
282+
compiler
283+
haskell-nix.cabal-install.${compiler-nix-name}
284+
];
285+
})
286+
(
287+
# Exclude old versions of GHC to speed up `nix flake check`
288+
builtins.removeAttrs haskell-nix.compiler
289+
[
290+
"ghc844"
291+
"ghc861"
292+
"ghc862"
293+
"ghc863"
294+
"ghc864"
295+
"ghc881"
296+
"ghc882"
297+
"ghc883"
298+
"ghc8101"
299+
"ghc8102"
300+
"ghc8103"
301+
"ghc8104"
302+
"ghc8105"
303+
"ghc8106"
304+
"ghc810420210212"
305+
"ghc901"
306+
"ghc921"
307+
"ghc922"
308+
"ghc923"
309+
]
310+
)
311+
);
312+
};
313+
in
314+
with (import nixpkgs { system = "x86_64-linux"; });
315+
traceHydraJobs (lib.recursiveUpdate flake (lib.optionalAttrs (ifdLevel > 2) {
316+
hydraJobs.nix-tools = pkgs.releaseTools.aggregate {
317+
name = "nix-tools";
318+
constituents = (if runningHydraEvalTest then [ ] else [
319+
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static"
320+
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static"
321+
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
322+
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
323+
]) ++ [
324+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static"
325+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64"
326+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-no-ifd"
327+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd"
328+
(writeText "gitrev" (self.rev or "0000000000000000000000000000000000000000"))
329+
];
330+
};
331+
}));
307332

308333
# --- Flake Local Nix Configuration ----------------------------
309334
nixConfig = {
310335
# This sets the flake to use the IOG nix cache.
311336
# Nix should ask for permission before using it,
312337
# but remove it here if you do not want it to.
313-
extra-substituters = ["https://cache.iog.io"];
314-
extra-trusted-public-keys = ["hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="];
338+
extra-substituters = [ "https://cache.iog.io" ];
339+
extra-trusted-public-keys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ];
315340
allow-import-from-derivation = "true";
316341
};
317342
}

0 commit comments

Comments
 (0)