Skip to content

Commit a6a964c

Browse files
committed
Other small improvements in flake.nix
- rename compiler to defaultCompiler - avoid using `with` above traceHydraJobs
1 parent aa06315 commit a6a964c

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

flake.nix

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585

8686
ifdLevel = 3;
8787
runningHydraEvalTest = false;
88-
compiler = "ghc928";
88+
defaultCompiler = "ghc928";
8989
config = import ./config.nix;
9090

9191
inherit (nixpkgs) lib;
@@ -163,7 +163,7 @@
163163
# for core of haskell.nix E.g. this should always work:
164164
# nix build .#roots.x86_64-linux --accept-flake-config --option allow-import-from-derivation false
165165
roots = forEachSystem (system:
166-
self.legacyPackagesUnstable.${system}.haskell-nix.roots compiler);
166+
self.legacyPackagesUnstable.${system}.haskell-nix.roots defaultCompiler);
167167

168168
# Note: `nix flake check` evaluates outputs for all platforms, and haskell.nix
169169
# uses IFD heavily, you have to have the ability to build for all platforms
@@ -179,7 +179,7 @@
179179
(import ./test {
180180
haskellNix.sources = inputs;
181181
haskellNix.nixpkgsArgs = nixpkgsArgs;
182-
compiler-nix-name = compiler;
182+
compiler-nix-name = defaultCompiler;
183183
inherit pkgs;
184184
})
185185
)
@@ -191,6 +191,7 @@
191191
packages = forEachSystemPkgs (pkgs:
192192
(import ./hix/default.nix { inherit pkgs; }).apps
193193
);
194+
194195
apps = forEachSystemPkgs (pkgs:
195196
builtins.mapAttrs
196197
(name: exe: {
@@ -277,28 +278,31 @@
277278
))
278279
mkHaskellNixShell;
279280
in
280-
shells // { default = shells.${compiler}; });
281+
shells // { default = shells.${defaultCompiler}; });
281282
};
282283

283284
in
284-
with (import nixpkgs { system = "x86_64-linux"; });
285-
traceHydraJobs (lib.recursiveUpdate flake (lib.optionalAttrs (ifdLevel > 2) {
286-
hydraJobs.nix-tools = pkgs.releaseTools.aggregate {
287-
name = "nix-tools";
288-
constituents = (if runningHydraEvalTest then [ ] else [
289-
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static"
290-
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static"
291-
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
292-
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
293-
]) ++ [
294-
"x86_64-linux.nix-tools.static.zipped.nix-tools-static"
295-
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64"
296-
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-no-ifd"
297-
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd"
298-
(writeText "gitrev" (self.rev or "0000000000000000000000000000000000000000"))
299-
];
300-
};
301-
}));
285+
traceHydraJobs (lib.recursiveUpdate flake (lib.optionalAttrs (ifdLevel > 2)
286+
(
287+
let pkgs = nixpkgs.legacyPackages."x86_64-linux"; in
288+
{
289+
hydraJobs.nix-tools = pkgs.releaseTools.aggregate {
290+
name = "nix-tools";
291+
constituents = (if runningHydraEvalTest then [ ] else [
292+
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static"
293+
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static"
294+
"aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
295+
"x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd"
296+
]) ++ [
297+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static"
298+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64"
299+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-no-ifd"
300+
"x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd"
301+
(pkgs.writeText "gitrev" (self.rev or "0000000000000000000000000000000000000000"))
302+
];
303+
};
304+
}
305+
)));
302306

303307
# --- Flake Local Nix Configuration ----------------------------
304308
nixConfig = {

0 commit comments

Comments
 (0)