Skip to content

Commit 0db76f7

Browse files
committed
Remove flake-utils
1 parent c5456ad commit 0db76f7

File tree

4 files changed

+93
-90
lines changed

4 files changed

+93
-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: 91 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;
@@ -104,27 +106,28 @@
104106
sources = inputs;
105107

106108
overlaysOverrideable = import ./overlays;
109+
107110
# Compatibility with old default.nix
108-
compat = { checkMaterialization ?
109-
false # Allows us to easily switch on materialization checking
110-
, system, sourcesOverride ? { }, ... }@args: rec {
111+
compat =
112+
{ checkMaterialization ? false # Allows us to easily switch on materialization checking
113+
, system
114+
, sourcesOverride ? { }
115+
, ...
116+
}@args:
117+
rec {
111118
sources = inputs // sourcesOverride;
112119
allOverlays = import ./overlays (args // { inherit sources; });
113120
inherit config;
114121
# We are overriding 'overlays' and 'nixpkgsArgs' from the
115122
# flake outputs so that we can incorporate the args passed
116123
# to the compat layer (e.g. sourcesOverride).
117124
overlays = [ allOverlays.combined ]
118-
++ (if checkMaterialization then
119-
[
125+
++ lib.optional checkMaterialization
120126
(final: prev: {
121127
haskell-nix = prev.haskell-nix // {
122128
checkMaterialization = true;
123129
};
124-
})
125-
]
126-
else
127-
[ ]);
130+
});
128131
nixpkgsArgs = {
129132
inherit config overlays;
130133
};
@@ -146,74 +149,90 @@
146149
};
147150
};
148151

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

216-
devShells = with self.legacyPackages.${system}; {
233+
devShells = forEachSystem (system:
234+
let inherit (self.legacyPackages.${system}) mkShell nixUnstable cabal-install haskell-nix;
235+
in {
217236
default =
218237
mkShell {
219238
buildInputs = [
@@ -222,7 +241,7 @@
222241
haskell-nix.compiler.${compiler}
223242
];
224243
};
225-
} // __mapAttrs (compiler-nix-name: compiler:
244+
} // builtins.mapAttrs (compiler-nix-name: compiler:
226245
mkShell {
227246
buildInputs = [
228247
compiler
@@ -237,8 +256,9 @@
237256
"ghc881" "ghc882" "ghc883"
238257
"ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc810420210212"
239258
"ghc901"
240-
"ghc921" "ghc922" "ghc923"]);
241-
}));
259+
"ghc921" "ghc922" "ghc923"])
260+
);
261+
});
242262

243263
# --- Flake Local Nix Configuration ----------------------------
244264
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)