-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
124 lines (114 loc) · 3.42 KB
/
flake.nix
File metadata and controls
124 lines (114 loc) · 3.42 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
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
{
description = "A nixvim configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixvim = {
url = "github:nix-community/nixvim";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-parts.follows = "flake-parts";
};
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nixvim,
flake-parts,
...
}@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.treefmt-nix.flakeModule
inputs.pre-commit-hooks.flakeModule
];
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
perSystem =
{
pkgs,
config,
system,
...
}:
let
nixvim' = nixvim.legacyPackages.${system};
extraSpecialArgs = {
inherit system;
mylib = import ./lib {
inherit (pkgs) lib;
nixvimLib = nixvim.lib;
};
};
nixvimModule = {
# You can use `extraSpecialArgs` to pass additional arguments to your module files
inherit pkgs extraSpecialArgs;
module = import ./config; # import the module directly
};
nixvim-nvim = nixvim'.makeNixvimWithModule nixvimModule;
in
{
checks = {
# Run `nix flake check .` to verify that your config is not broken
default = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule nixvimModule;
};
# Lets you run `nix run .` to start nixvim
packages = {
default = nixvim-nvim;
neovim = nixvim-nvim;
};
# https://flake.parts/options/treefmt-nix.html
# Example: https://github.com/nix-community/buildbot-nix/blob/main/nix/treefmt/flake-module.nix
treefmt = {
projectRootFile = "flake.nix";
programs = {
autocorrect.enable = true;
deadnix.enable = true;
nixfmt.enable = true;
statix.enable = true;
stylua = {
enable = true;
settings = {
indent_type = "Spaces";
indent_width = 4;
};
};
zizmor.enable = true;
};
};
# https://flake.parts/options/git-hooks-nix.html
# Example: https://github.com/cachix/git-hooks.nix/blob/master/template/flake.nix
pre-commit.settings.configPath = ".pre-commit-config.flake.yaml";
pre-commit.settings.package = pkgs.prek;
pre-commit.settings.hooks = {
eclint.enable = true;
markdownlint.enable = true;
lua-ls.enable = true;
treefmt.enable = true;
};
devShells.default = pkgs.mkShell {
inputsFrom = [
config.treefmt.build.devShell
config.pre-commit.devShell
];
shellHook = ''
echo 1>&2 "Welcome to the development shell!"
'';
};
};
};
}