Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
96 lines (90 loc) · 2.67 KB
/
Copy pathflake.nix
File metadata and controls
96 lines (90 loc) · 2.67 KB
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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
flake-parts.url = "github:hercules-ci/flake-parts";
git-hooks.url = "github:cachix/git-hooks.nix";
git-hooks.inputs.nixpkgs.follows = "nixpkgs";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{ self, ... }@inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = inputs.nixpkgs.lib.systems.flakeExposed;
imports = [
inputs.git-hooks.flakeModule
inputs.treefmt-nix.flakeModule
inputs.flake-parts.flakeModules.easyOverlay
];
perSystem =
{ pkgs
, system
, config
, ...
}:
let
packages = rec {
nvimkata = pkgs.callPackage ./package.nix { };
default = nvimkata;
};
in
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
self.overlays.default
];
config = { };
};
overlayAttrs = packages;
# Nix code formatter -> 'nix fmt'
treefmt.config = {
projectRootFile = "flake.nix";
flakeFormatter = true;
flakeCheck = true;
programs = {
nixpkgs-fmt.enable = true;
deadnix.enable = true;
statix.enable = true;
rustfmt.enable = true;
taplo.enable = true;
};
};
# Pre-commit hooks
pre-commit.check.enable = false;
pre-commit.settings.hooks = {
treefmt = {
enable = true;
package = config.treefmt.build.wrapper;
};
pedantic-clippy = {
enable = true;
entry = "cargo clippy -- -D clippy::pedantic -D clippy::cognitive_complexity";
files = "\\.rs$";
pass_filenames = false;
};
cargo-test = {
enable = true;
entry = "cargo test --all-features";
files = "\\.rs$";
pass_filenames = false;
};
};
# Development shell -> 'nix develop' or 'direnv allow'
devShells.default = pkgs.mkShell {
packages = with pkgs; [
cargo
clippy
rustc
rustfmt
cargo-tarpaulin
pre-commit
pkg-config
];
shellHook = config.pre-commit.installationScript;
};
# Packages -> 'nix build' or 'nix run'
inherit packages;
};
};
}