on e94de40 help sign in
haskell.nix/flake.nix
34 lines 1.3 kB history raw
1{
2 description = "Alternative Haskell Infrastructure for Nixpkgs";
4 outputs = { self }: {
5 # Using the eval-on-build version here as the plan is that
6 # `builtins.currentSystem` will not be supported in flakes.
7 # https://github.com/NixOS/rfcs/pull/49/files#diff-a5a138ca225433534de8d260f225fe31R429
8 overlay = (self.overlays {sourcesOverride = self.sources;}).combined-eval-on-build;
9 overlays = import ./overlays;
10 config = import ./config.nix;
11 # We can't import ./nix/sources.nix directly, because that uses nixpkgs to fetch by default,
12 # and importing nixpkgs without specifying localSystem doesn't work on flakes.
13 sources = let
14 sourcesInfo =
15 builtins.fromJSON (builtins.readFile ./nix/sources.json);
16 fetch = sourceInfo:
17 builtins.fetchTarball { inherit (sourceInfo) url sha256; };
18 in builtins.mapAttrs (_: fetch) sourcesInfo;
20 nixpkgsArgs = {
21 inherit (self) config;
22 overlays = [ self.overlay ];
23 };
24 legacyPackages = let
25 genAttrs = lst: f:
26 builtins.listToAttrs (map (name: {
27 inherit name;
28 value = f name;
29 }) lst);
30 in genAttrs [ "x86_64-linux" "x86_64-darwin" ] (system:
31 import self.sources.nixpkgs
32 (self.nixpkgsArgs // { localSystem = { inherit system; }; }));
33 };