Skip to content

Commit d8842a3

Browse files
committed
Remove flake-utils
1 parent c5456ad commit d8842a3

File tree

4 files changed

+91
-90
lines changed

4 files changed

+91
-90
lines changed

flake.lock

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

flake.nix

Lines changed: 89 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
nixpkgs-2305 = { url = "github:NixOS/nixpkgs/nixpkgs-23.05-darwin"; };
1212
nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
1313
flake-compat = { url = "github:input-output-hk/flake-compat/hkm/gitlab-fix"; flake = false; };
14-
flake-utils = { url = "github:hamishmack/flake-utils/hkm/nested-hydraJobs"; };
1514
"hls-1.10" = { url = "github:haskell/haskell-language-server/1.10.0.0"; flake = false; };
1615
"hls-2.0" = { url = "github:haskell/haskell-language-server/2.0.0.1"; flake = false; };
1716
hydra.url = "hydra";
@@ -66,13 +65,15 @@
6665
};
6766
};
6867

69-
outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-2105, nixpkgs-2111, nixpkgs-2205, nixpkgs-2211, nixpkgs-2305, flake-compat, flake-utils, ... }@inputs:
68+
outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-2105, nixpkgs-2111, nixpkgs-2205, nixpkgs-2211, nixpkgs-2305, flake-compat, ... }@inputs:
7069
let
7170
callFlake = import flake-compat;
7271

7372
compiler = "ghc928";
7473
config = import ./config.nix;
7574

75+
inherit (nixpkgs) lib;
76+
7677
traceNames = prefix: builtins.mapAttrs (n: v:
7778
if builtins.isAttrs v
7879
then if v ? type && v.type == "derivation"
@@ -91,6 +92,7 @@
9192
"aarch64-darwin"
9293
];
9394

95+
forEachSystem = lib.genAttrs systems;
9496
in traceHydraJobs ({
9597
inherit config;
9698
overlay = self.overlays.combined;
@@ -105,26 +107,25 @@
105107

106108
overlaysOverrideable = import ./overlays;
107109
# Compatibility with old default.nix
108-
compat = { checkMaterialization ?
109-
false # Allows us to easily switch on materialization checking
110-
, system, sourcesOverride ? { }, ... }@args: rec {
110+
compat =
111+
{ checkMaterialization ? false # Allows us to easily switch on materialization checking
112+
, system
113+
, sourcesOverride ? { }
114+
, ... }@args:
115+
rec {
111116
sources = inputs // sourcesOverride;
112117
allOverlays = import ./overlays (args // { inherit sources; });
113118
inherit config;
114119
# We are overriding 'overlays' and 'nixpkgsArgs' from the
115120
# flake outputs so that we can incorporate the args passed
116121
# to the compat layer (e.g. sourcesOverride).
117122
overlays = [ allOverlays.combined ]
118-
++ (if checkMaterialization then
119-
[
123+
++ lib.optional checkMaterialization
120124
(final: prev: {
121125
haskell-nix = prev.haskell-nix // {
122126
checkMaterialization = true;
123127
};
124-
})
125-
]
126-
else
127-
[ ]);
128+
});
128129
nixpkgsArgs = {
129130
inherit config overlays;
130131
};
@@ -146,74 +147,90 @@
146147
};
147148
};
148149

150+
legacyPackages = forEachSystem (system:
151+
(self.internal.compat { inherit system; }).pkgs);
152+
153+
legacyPackagesUnstable = forEachSystem (system:
154+
(self.internal.compat { inherit system; }).pkgs-unstable);
155+
156+
# Exposed so that buildkite can check that `allow-import-from-derivation=false` works for core of haskell.nix
157+
roots = forEachSystem (system:
158+
self.legacyPackagesUnstable.${system}.haskell-nix.roots compiler);
159+
149160
# Note: `nix flake check` evaluates outputs for all platforms, and haskell.nix
150161
# uses IFD heavily, you have to have the ability to build for all platforms
151162
# supported by haskell.nix, e.g. with remote builders, in order to check this flake.
152163
# If you want to run the tests for just your platform, run `./test/tests.sh` or
153164
# `nix-build -A checks.$PLATFORM`
154-
} // flake-utils.lib.eachSystem systems (system:
155-
let
156-
legacyPackages = (self.internal.compat { inherit system; }).pkgs;
157-
nix-tools-hydraJobs =
158-
let cf = callFlake { pkgs = legacyPackages; inherit system; src = ./nix-tools; };
159-
in cf.defaultNix.hydraJobs;
160-
in rec {
161-
inherit legacyPackages;
162-
legacyPackagesUnstable = (self.internal.compat { inherit system; }).pkgs-unstable;
163-
164-
# FIXME: Currently `nix flake check` requires `--impure` because coverage-golden
165-
# (and maybe other tests) import projects that use builtins.currentSystem
166-
checks = builtins.listToAttrs (map (pkg: {
167-
name = pkg.name;
168-
value = pkg;
169-
}) (nixpkgs.lib.collect nixpkgs.lib.isDerivation (import ./test rec {
170-
haskellNix = self.internal.compat { inherit system; };
171-
compiler-nix-name = compiler;
172-
pkgs = haskellNix.pkgs;
173-
})));
174-
# Exposed so that buildkite can check that `allow-import-from-derivation=false` works for core of haskell.nix
175-
roots = legacyPackagesUnstable.haskell-nix.roots compiler;
176-
177-
packages = (self.internal.compat { inherit system; }).hix.apps;
178-
179-
allJobs =
180-
let
181-
inherit (import ./ci-lib.nix { pkgs = legacyPackagesUnstable; }) stripAttrsForHydra filterDerivations;
182-
ci = import ./ci.nix { inherit (self.internal) compat; inherit system; };
183-
in stripAttrsForHydra (filterDerivations ci);
184-
185-
requiredJobs =
186-
let
187-
inherit (legacyPackages) lib;
188-
names = x: lib.filter (n: n != "recurseForDerivations" && n != "meta")
189-
(builtins.attrNames x);
190-
in
191-
builtins.listToAttrs (
192-
lib.concatMap (nixpkgsVer:
193-
let nixpkgsJobs = allJobs.${nixpkgsVer};
194-
in lib.concatMap (compiler-nix-name:
195-
let ghcJobs = nixpkgsJobs.${compiler-nix-name};
196-
in builtins.map (crossPlatform: {
197-
name = "required-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}";
198-
value = legacyPackages.releaseTools.aggregate {
199-
name = "haskell.nix-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}";
200-
meta.description = "All ${nixpkgsVer} ${compiler-nix-name} ${crossPlatform} jobs";
201-
constituents = lib.collect lib.isDerivation ghcJobs.${crossPlatform};
202-
};
203-
}) (names ghcJobs)
204-
) (names nixpkgsJobs)
205-
) (names allJobs));
206-
207-
hydraJobs =
208-
allJobs
165+
# FIXME: Currently `nix flake check` requires `--impure` because coverage-golden
166+
# (and maybe other tests) import projects that use builtins.currentSystem
167+
checks = forEachSystem (system:
168+
builtins.listToAttrs (
169+
map
170+
(pkg: { name = pkg.name; value = pkg; })
171+
(lib.collect
172+
lib.isDerivation
173+
(import ./test
174+
rec {
175+
haskellNix = self.internal.compat { inherit system; };
176+
compiler-nix-name = compiler;
177+
pkgs = haskellNix.pkgs;
178+
})
179+
)
180+
)
181+
);
182+
183+
packages = forEachSystem (system:
184+
(self.internal.compat { inherit system; }).hix.apps
185+
);
186+
187+
allJobs = forEachSystem (system:
188+
let
189+
inherit (import ./ci-lib.nix { pkgs = self.legacyPackagesUnstable.${system}; }) stripAttrsForHydra filterDerivations;
190+
ci = import ./ci.nix { inherit (self.internal) compat; inherit system; };
191+
in stripAttrsForHydra (filterDerivations ci));
192+
193+
requiredJobs = forEachSystem (system:
194+
let
195+
inherit (self.legacyPackages.${system}) lib;
196+
names = x: lib.filter (n: n != "recurseForDerivations" && n != "meta")
197+
(builtins.attrNames x);
198+
in
199+
builtins.listToAttrs (
200+
lib.concatMap (nixpkgsVer:
201+
let nixpkgsJobs = self.allJobs.${system}.${nixpkgsVer};
202+
in lib.concatMap (compiler-nix-name:
203+
let ghcJobs = nixpkgsJobs.${compiler-nix-name};
204+
in builtins.map (crossPlatform: {
205+
name = "required-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}";
206+
value = self.legacyPackages.${system}.releaseTools.aggregate {
207+
name = "haskell.nix-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}";
208+
meta.description = "All ${nixpkgsVer} ${compiler-nix-name} ${crossPlatform} jobs";
209+
constituents = lib.collect lib.isDerivation ghcJobs.${crossPlatform};
210+
};
211+
}) (names ghcJobs)
212+
) (names nixpkgsJobs)
213+
) (names self.allJobs.${system})));
214+
215+
hydraJobs = forEachSystem (system:
216+
self.allJobs.${system}
217+
//
218+
{
209219
# Include hydraJobs from nix-tools subflake.
210220
# NOTE: These derivations do not depend on the haskell.nix in ./. but
211221
# on the version of haskell.nix locked in the subflake. They are
212222
# evaluated within their own flake and independently of anything
213223
# else. Here we only expose them in the main flake.
214-
// { nix-tools = nix-tools-hydraJobs.${system} or {}; };
224+
nix-tools = (callFlake {
225+
inherit system;
226+
pkgs = self.legacyPackages.${system};
227+
src = ./nix-tools;
228+
}).defaultNix.hydraJobs or {};
229+
});
215230

216-
devShells = with self.legacyPackages.${system}; {
231+
devShells = forEachSystem (system:
232+
let inherit (self.legacyPackages.${system}) mkShell nixUnstable cabal-install haskell-nix;
233+
in {
217234
default =
218235
mkShell {
219236
buildInputs = [
@@ -222,7 +239,7 @@
222239
haskell-nix.compiler.${compiler}
223240
];
224241
};
225-
} // __mapAttrs (compiler-nix-name: compiler:
242+
} // builtins.mapAttrs (compiler-nix-name: compiler:
226243
mkShell {
227244
buildInputs = [
228245
compiler
@@ -237,8 +254,9 @@
237254
"ghc881" "ghc882" "ghc883"
238255
"ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc810420210212"
239256
"ghc901"
240-
"ghc921" "ghc922" "ghc923"]);
241-
}));
257+
"ghc921" "ghc922" "ghc923"])
258+
);
259+
});
242260

243261
# --- Flake Local Nix Configuration ----------------------------
244262
nixConfig = {

hix/init/flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This is a template created by `hix init`
33
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
44
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
5-
inputs.flake-utils.follows = "haskellNix/flake-utils";
5+
inputs.flake-utils.url = "github:hamishmack/flake-utils/hkm/nested-hydraJobs";
66
outputs = { self, nixpkgs, flake-utils, haskellNix }:
77
let
88
supportedSystems = [

hix/project/flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
description = "Default hix flake";
55
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
66
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
7-
inputs.flake-utils.follows = "haskellNix/flake-utils";
7+
inputs.flake-utils.url = "github:hamishmack/flake-utils/hkm/nested-hydraJobs";
88
inputs.src.flake = false;
99
outputs = { self, src, nixpkgs, flake-utils, haskellNix }:
1010
flake-utils.lib.eachSystem [ "EVAL_SYSTEM" ] (system:

0 commit comments

Comments
 (0)