-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
125 lines (108 loc) · 3.66 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
122
123
124
125
{
description = "DoctorDalek1963's nixvim configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
flake-parts.url = "github:hercules-ci/flake-parts";
neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim/nixos-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
nixvim,
flake-parts,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
imports = [inputs.pre-commit-hooks.flakeModule];
perSystem = {
pkgs,
config,
system,
...
}: let
nixvim' = nixvim.legacyPackages.${system};
mkModuleArgs = configName: {
inherit pkgs;
module = (import ./defs.nix)."${configName}";
extraSpecialArgs = {inherit inputs;};
};
in rec {
packages = rec {
default = nvim-medium;
nvim-tiny = nixvim'.makeNixvimWithModule (mkModuleArgs "tiny");
nvim-small = nixvim'.makeNixvimWithModule (mkModuleArgs "small");
nvim-medium = nixvim'.makeNixvimWithModule (mkModuleArgs "medium");
nvim-full = nixvim'.makeNixvimWithModule (mkModuleArgs "full");
nvim-tiny-nightly = nvim-tiny.extend {setup.useNightly = true;};
nvim-small-nightly = nvim-small.extend {setup.useNightly = true;};
nvim-medium-nightly = nvim-medium.extend {setup.useNightly = true;};
nvim-full-nightly = nvim-full.extend {setup.useNightly = true;};
};
checks = let
check = name:
nixvim.lib.${system}.check.mkTestDerivationFromNvim {
inherit name;
nvim = packages."${name}";
};
in {
tiny = check "nvim-tiny";
small = check "nvim-small";
medium = check "nvim-medium";
full = check "nvim-full";
tiny-nightly = check "nvim-tiny-nightly";
small-nightly = check "nvim-small-nightly";
medium-nightly = check "nvim-medium-nightly";
full-nightly = check "nvim-full-nightly";
};
devShells.default = pkgs.mkShell {
shellHook = ''
${config.pre-commit.installationScript}
'';
};
# See https://flake.parts/options/pre-commit-hooks-nix and
# https://github.com/cachix/git-hooks.nix/blob/master/modules/hooks.nix
# for all the available hooks and options
pre-commit = {
# One of the hooks runs `nix flake check` on this flake, so we don't
# want to recurse infinitely
check.enable = false;
settings.hooks = {
check-added-large-files.enable = true;
check-merge-conflicts.enable = true;
check-toml.enable = true;
check-vcs-permalinks.enable = true;
check-yaml.enable = true;
end-of-file-fixer.enable = true;
trim-trailing-whitespace = {
enable = true;
excludes = [''.+\.patch$''];
};
alejandra.enable = true;
deadnix.enable = true;
statix.enable = true;
flake-check = {
enable = false;
entry = "nix flake check";
stages = ["pre-push"];
pass_filenames = false;
};
};
};
};
};
}