-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathflake.nix
107 lines (87 loc) · 3.06 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{ inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { nixpkgs, utils, ... }:
let
compiler = "ghc94";
overlay = final: prev: {
cabal2nix-unwrapped =
final.haskell.lib.justStaticExecutables
final.haskell.packages."${compiler}".cabal2nix;
haskell = prev.haskell // {
packages = prev.haskell.packages // {
"${compiler}" = prev.haskell.packages."${compiler}".override (old: {
overrides =
final.lib.fold final.lib.composeExtensions (old.overrides or (_: _: { })) [
(final.haskell.lib.packageSourceOverrides {
nix-serve-ng = ./.;
base16 = "1.0";
})
(haskellPackagesNew: haskellPackagesOld: {
nix-serve-ng =
final.haskell.lib.overrideCabal
haskellPackagesOld.nix-serve-ng
(old: {
executableSystemDepends = (old.executableSystemDepends or []) ++ [
final.boost.dev
final.nixVersions.nix_2_24
];
});
})
];
});
};
};
nix-serve-ng =
final.haskell.lib.justStaticExecutables
final.haskell.packages."${compiler}".nix-serve-ng;
};
in
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
config = { };
overlays = [ overlay ];
inherit system;
};
inherit (pkgs) nix-serve-ng;
in
rec {
packages.default = nix-serve-ng;
defaultPackage = packages.default;
apps.default = {
type = "app";
program = "${nix-serve-ng}/bin/nix-serve";
};
defaultApp = apps.default;
devShells.default =
(pkgs.haskell.lib.doBenchmark
pkgs.haskell.packages."${compiler}".nix-serve-ng
).env;
devShell = devShells.default;
}) // rec {
overlays = {
# The default overlay only adds the exports for
# `pkgs.haskell.packages."${compiler}".nix-serve-ng` and
# `pkgs.nix-serve-ng`
default = overlay;
# This overlay additionally overrides `pkgs.nix-serve` to refer to
# `pkgs.nix-serve-ng`
override = final: prev: {
nix-serve = final.nix-serve-ng;
};
};
# The NixOS module is a thin wrapper around the overlay to replace
# `nix-serve` with `nix-serve-ng`
#
# You can continue to use the old `services.nix-serve` NixOS options.
nixosModules.default = {
nixpkgs.overlays = [ overlays.default overlays.override ];
};
};
}