-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
130 lines (123 loc) · 3.62 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{
description = "CLI tool to list your repositories";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
weeder-nix.url = "github:NorfairKing/weeder-nix";
weeder-nix.inputs = {
nixpkgs.follows = "nixpkgs";
pre-commit-hooks.follows = "pre-commit-hooks";
};
};
outputs =
{ self
, nixpkgs
, flake-utils
, nix-filter
, pre-commit-hooks
, ...
} @ inputs:
let
pkgsFor = system: import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in
{
overlays.default = final: prev:
let
filteredSrc =
nix-filter.lib {
root = ./.;
include = [
"src/"
"test/"
"package.yaml"
"LICENSE"
];
};
in
rec {
github-ls = final.haskell.lib.justStaticExecutables haskellPackages.github-ls;
haskellPackages = prev.haskellPackages.override
(old: {
overrides = final.lib.composeExtensions
(old.overrides or (_: _: { }))
(self: super: {
github-ls = self.generateOptparseApplicativeCompletions
[ "github-ls" ]
((self.callCabal2nix "github-ls" filteredSrc { }).overrideAttrs
(oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs
++ [ final.makeWrapper ];
postInstall = (oldAttrs.postInstall or "") + ''
wrapProgram $out/bin/github-ls \
--suffix PATH : ${final.lib.makeBinPath [final.github-cli] }
'';
}
)
);
}
);
});
}
;
} //
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = pkgsFor system;
precommitCheck = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
actionlint.enable = true;
hlint.enable = true;
hpack.enable = true;
markdownlint.enable = true;
nil.enable = true;
nixpkgs-fmt.enable = true;
ormolu.enable = true;
};
};
in
rec {
packages = {
inherit (pkgs) github-ls;
default = packages.github-ls;
};
apps = {
github-ls = flake-utils.lib.mkApp { drv = packages.github-ls; };
default = apps.github-ls;
};
checks = {
pre-commit-check = precommitCheck;
weeder-check = inputs.weeder-nix.lib.${system}.makeWeederCheck {
haskellPackages = pkgs.haskellPackages;
packages = [ "github-ls" ];
reportOnly = true;
};
};
devShells.default = pkgs.haskellPackages.shellFor {
packages = p: [ packages.github-ls ];
buildInputs = with pkgs; with pkgs.haskellPackages; [
actionlint
cabal-install
ghcid
haskell-language-server
hlint
nil
nixpkgs-fmt
ormolu
statix
];
inherit (precommitCheck) shellHook;
};
}
);
nixConfig = {
extra-substituters = "https://opensource.cachix.org";
extra-trusted-public-keys = "opensource.cachix.org-1:6t9YnrHI+t4lUilDKP2sNvmFA9LCKdShfrtwPqj2vKc=";
};
}