-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
73 lines (67 loc) · 1.85 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
{
description = "Template for nix projects";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.05";
pre-commit.url = "github:cachix/git-hooks.nix";
treefmt.url = "github:numtide/treefmt-nix";
systems.url = "github:nix-systems/x86_64-linux";
nix-checks = {
url = "github:huuff/nix-checks";
inputs.nixpkgs.follows = "nixpkgs";
};
utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
};
outputs =
{
self,
nixpkgs,
utils,
pre-commit,
nix-checks,
treefmt,
...
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
treefmt-build = (treefmt.lib.evalModule pkgs ./treefmt.nix).config.build;
pre-commit-check = pre-commit.lib.${system}.run {
src = ./.;
hooks = import ./pre-commit.nix {
inherit pkgs;
treefmt = treefmt-build.wrapper;
};
};
inherit (nix-checks.lib.${system}) checks;
in
{
checks = {
# just check formatting is ok without changing anything
formatting = treefmt-build.check self;
statix = checks.statix ./.;
deadnix = checks.deadnix ./.;
flake-checker = checks.flake-checker ./.;
};
# for `nix fmt`
formatter = treefmt-build.wrapper;
packages = {
leptosfmt = pkgs.callPackage ./leptosfmt.nix { };
cargo-upgrades = pkgs.callPackage ./cargo-upgrades.nix { };
};
devShells.default = pkgs.mkShell {
inherit (pre-commit-check) shellHook;
buildInputs =
with pkgs;
pre-commit-check.enabledPackages
++ [
nil
nixfmt-rfc-style
];
};
}
);
}