forked from cachix/git-hooks.nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
58 lines (52 loc) · 1.73 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
{
description = "Seamless integration of https://pre-commit.com git hooks with Nix.";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
inputs.gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, gitignore, nixpkgs-stable, ... }:
let
lib = nixpkgs.lib;
defaultSystems = [
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
];
in
{
flakeModule = ./flake-module.nix;
templates.default = {
path = ./template;
description = ''
A template with flake-parts and nixpkgs-fmt.
'';
};
}
// flake-utils.lib.eachSystem defaultSystems (system:
let
exposed = import ./nix { inherit nixpkgs system; gitignore-nix-src = gitignore; isFlakes = true; };
exposed-stable = import ./nix { nixpkgs = nixpkgs-stable; inherit system; gitignore-nix-src = gitignore; isFlakes = true; };
in
{
packages = exposed.packages // {
default = exposed.packages.pre-commit;
};
devShells.default = nixpkgs.legacyPackages.${system}.mkShell {
inherit (exposed.checks.pre-commit-check) shellHook;
};
checks = lib.filterAttrs (k: v: v != null)
(exposed.checks
// (lib.mapAttrs' (name: value: lib.nameValuePair "stable-${name}" value)
exposed-stable.checks));
lib = { inherit (exposed) run; };
}
);
}