-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
58 lines (48 loc) · 1.63 KB
/
flake.nix
File metadata and controls
58 lines (48 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
description = "Nix flake for the finite package";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs, flake-utils } :
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
ghcVersions = [ "ghc910" "ghc9121" ];
defaultGhcVersion = "ghc9121";
makeOverlay = compilerVersion:
let
overrideFile = ./. + "/nix/override-${compilerVersion}.nix";
overrides =
if builtins.pathExists overrideFile then
import overrideFile { inherit pkgs; }
else
f: p: { };
hsOverlay =
pkgs.haskell.packages.${compilerVersion}.override {
inherit overrides;
};
pkgSrcOverrides = pkgs.haskell.lib.compose.packageSourceOverrides {
finite = ./.;
};
in
hsOverlay.extend pkgSrcOverrides;
overlays = nixpkgs.lib.attrsets.genAttrs ghcVersions makeOverlay;
makeDevShell = compilerVersion:
with overlays.${compilerVersion};
shellFor {
name = compilerVersion;
packages = p: [
# project packages
p.finite
];
nativeBuildInputs = [
# Haskell dependencies
# cabal-install
];
};
shells = pkgs.lib.attrsets.genAttrs ghcVersions makeDevShell;
in {
devShells = shells // { default = shells.${defaultGhcVersion}; };
});
}