-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
79 lines (65 loc) · 1.93 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
{
description = "Conway's Game of Life TUI";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
bundlers.url = "github:NixOS/bundlers";
};
outputs = {self, nixpkgs, systems, bundlers, ...}: let
forEachSystem = func:
builtins.foldl'
nixpkgs.lib.recursiveUpdate { }
(map func (import systems));
in forEachSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend overlay;
pkgsStatic = pkgs.pkgsStatic;
inherit (bundlers.bundlers.${system}) toRPM toDEB;
overlay = self: super: {
haskell = super.haskell // {
packageOverrides = self: super: {
gol-tui =
let pkg = self.callCabal2nix "gol-tui" src { };
in pkgs.haskell.lib.overrideCabal pkg (old: {
executableSystemDepends = with pkgs; [ cmake numcpp boost.dev ];
});
};
};
};
inherit (pkgs) lib;
regexes = [
"^src.*"
"^cmake.*"
".*.cabal$"
"configure"
".*.in"
"LICENSE"
"Setup.hs"
];
src = builtins.path {
path = ./.;
name = "gol-tui-src";
filter = path: type:
let relPath = lib.removePrefix (toString ./. + "/") (toString path);
in lib.any (re: builtins.match re relPath != null) regexes;
};
in {
packages.${system} = rec {
default = gol-tui;
gol-tui = pkgs.haskellPackages.gol-tui;
gol-tui-static = pkgsStatic.haskellPackages.gol-tui;
gol-tui-rpm = toRPM gol-tui;
gol-tui-deb = toDEB gol-tui;
gol-tui-shell = default.env.overrideAttrs (oldAttrs: {
name = "gol-tui";
buildInputs = oldAttrs.buildInputs ++ (with pkgs; [
cabal-install
haskell-language-server
hlint
nil
]);
});
};
devShells.${system}.default = self.packages.${system}.gol-tui-shell;
});
}