-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
121 lines (115 loc) · 3.24 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
{
description = "Loïc Reynier's Nix packages";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
flake-utils,
nixpkgs,
git-hooks,
}:
{
overlays.default = nixpkgs.lib.composeManyExtensions [
(
final: prev:
{
pythonPackagesOverlays = (prev.pythonPackagesOverlays or [ ]) ++ [
(python-final: _: { } // import ./pkgs/python-packages { python = python-final; })
];
python3 =
let
self = prev.python3.override {
inherit self;
packageOverrides = prev.lib.composeManyExtensions final.pythonPackagesOverlays;
};
in
self;
python3Packages = final.python3.pkgs;
vimPlugins = prev.vimPlugins // import ./pkgs/vim-plugins { pkgs = final; };
}
// import ./pkgs { pkgs = final; }
)
];
}
// (flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config.allowUnfreePredicate =
pkg:
builtins.elem (nixpkgs.lib.getName pkg) [
"betterbib"
"fzf-obc"
"plm"
];
};
pythonEnv = pkgs.python3.withPackages (
ps: with ps; [
black
jinja2
]
);
in
{
packages =
{ }
// import ./pkgs { inherit pkgs; }
// import ./pkgs/python-packages { python = pkgs.python3Packages; }
// import ./pkgs/vim-plugins { inherit pkgs; };
checks = {
pre-commit-check = git-hooks.lib.${system}.run {
src = ./.;
hooks = {
make_readme = {
enable = true;
name = "make-readme";
entry = "${pythonEnv}/bin/python docs/make_readme.py";
files = ".*\\.(nix|py|md)";
language = "system";
pass_filenames = false;
};
commitizen.enable = true;
deadnix.enable = true;
editorconfig-checker = {
enable = true;
excludes = [
"flake.lock"
"deps.nix"
];
};
nixfmt-rfc-style.enable = true;
ruff.enable = true;
prettier = {
enable = true;
excludes = [ "flake.lock" ];
};
statix.enable = true;
typos = {
enable = true;
excludes = [ "deps.nix" ];
};
};
};
};
devShells.default = pkgs.mkShell {
propagatedBuildInputs = with pkgs; [
findutils # xargs
just
jq
nixfmt-rfc-style
pythonEnv
];
inherit (self.checks.${system}.pre-commit-check) shellHook;
};
}
));
}