-
Notifications
You must be signed in to change notification settings - Fork 5
/
flake.nix
76 lines (66 loc) · 1.87 KB
/
flake.nix
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
description = "Generate swift and kotlin types from haskell types";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = {
self,
nixpkgs,
}: let
systems = ["aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
haskells = ["ghc90" "ghc92" "ghc94" "ghc96"];
eachSystem = nixpkgs.lib.genAttrs systems;
eachHaskell = nixpkgs.lib.genAttrs haskells;
latestHaskell = nixpkgs.lib.last haskells;
pkgsBySystem = eachSystem (system: nixpkgs.legacyPackages.${system});
haskellPackages = eachSystem (
system:
eachHaskell (
haskell:
pkgsBySystem.${system}.haskell.packages.${haskell}
)
);
in {
packages = eachSystem (
system: let
moats =
nixpkgs.lib.mapAttrs'
(n: v: {
name = "moat-${n}";
value = v;
})
(eachHaskell (
haskell:
haskellPackages.${system}.${haskell}.callPackage ./moat.nix {}
));
in
moats // {default = moats."moat-${latestHaskell}";}
);
devShells = eachSystem (
system: let
pkgs = pkgsBySystem.${system};
shells = eachHaskell (
haskell: let
hsPkgs = haskellPackages.${system}.${haskell};
in
pkgs.mkShell {
name = "moat-${haskell}-shell";
inputsFrom = [self.packages.${system}."moat-${haskell}"];
nativeBuildInputs = [
hsPkgs.cabal2nix
hsPkgs.cabal-install
hsPkgs.ghc
hsPkgs.ghcid
hsPkgs.haskell-language-server
hsPkgs.hlint
hsPkgs.hpack
hsPkgs.fourmolu
pkgs.alejandra
];
}
);
in
shells // {default = shells.${latestHaskell};}
);
};
}