-
-
Notifications
You must be signed in to change notification settings - Fork 211
Expand file tree
/
Copy pathflake.nix
More file actions
146 lines (129 loc) · 4.44 KB
/
flake.nix
File metadata and controls
146 lines (129 loc) · 4.44 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{
description = "A neovim flake with a modular configuration";
outputs = {
flake-parts,
self,
...
} @ inputs: let
# Call the extended library with `inputs`.
# inputs is used to get the original standard library, and to pass inputs
# to the plugin autodiscovery function
lib = import ./lib/stdlib-extended.nix {inherit inputs self;};
in
flake-parts.lib.mkFlake {
inherit inputs;
specialArgs = {inherit lib;};
} {
# Allow users to bring their own systems.
# «https://github.com/nix-systems/nix-systems»
systems = import inputs.systems;
imports = [
./flake/templates
./flake/apps.nix
./flake/packages.nix
./flake/develop.nix
];
flake = {
lib = {
inherit (lib) nvim;
inherit (lib.nvim) neovimConfiguration;
};
inherit (lib.importJSON ./npins/sources.json) pins;
homeManagerModules = {
nvf = import ./flake/modules/home-manager.nix {inherit lib inputs;};
default = self.homeManagerModules.nvf;
neovim-flake =
lib.warn ''
'homeManagerModules.neovim-flake' has been deprecated, and will be removed
in a future release. Please use 'homeManagerModules.nvf' instead.
''
self.homeManagerModules.nvf;
};
nixosModules = {
nvf = import ./flake/modules/nixos.nix {inherit lib inputs;};
default = self.nixosModules.nvf;
neovim-flake =
lib.warn ''
'nixosModules.neovim-flake' has been deprecated, and will be removed
in a future release. Please use 'nixosModules.nvf' instead.
''
self.nixosModules.nvf;
};
darwinModules = {
nvf = import ./flake/modules/nixos.nix {inherit lib inputs;};
default = self.darwinModules.nvf;
};
};
perSystem = {pkgs, ...}: {
# Provides the default formatter for 'nix fmt', which will format the
# entire Nix source with Alejandra. The wrapper script is necessary due to
# changes to the behaviour of Nix, which now encourages wrappers for
# tree-wide formatting.
formatter = pkgs.writeShellApplication {
name = "nix3-fmt-wrapper";
runtimeInputs = [
pkgs.alejandra
pkgs.fd
pkgs.deno
];
text = ''
# Find Nix files in the tree and format them with Alejandra
echo "Formatting Nix files"
fd "$@" -t f -e nix -x alejandra -q '{}'
# Same for Markdown files, but with deno
echo "Formatting Markdown files"
fd "$@" -t f -e md -x deno fmt -q '{}'
'';
};
# Provides checks to be built an ran on 'nix flake check'. They can also
# be built individually with 'nix build' as described below.
checks = {
# Check if codebase is properly formatted.
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
# or with `nix flake check`
nix-fmt =
pkgs.runCommand "nix-fmt-check"
{
src = self;
nativeBuildInputs = [pkgs.alejandra pkgs.fd];
} ''
cd "$src"
fd -t f -e nix -x alejandra --check '{}'
touch $out
'';
# Check if Markdown sources are properly formatted
# This can be initiated with `nix build .#checks.<system>.md-fmt`
# or with `nix flake check`
md-fmt =
pkgs.runCommand "md-fmt-check" {
src = self;
nativeBuildInputs = [pkgs.deno pkgs.fd];
} ''
cd "$src"
fd -t f -e md -x deno fmt --check '{}'
touch $out
'';
};
};
};
inputs = {
systems.url = "github:nix-systems/default";
## Basic Inputs
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
flake-compat = {
url = "git+https://git.lix.systems/lix-project/flake-compat.git";
flake = false;
};
# Alternate neovim-wrapper
mnw.url = "github:Gerg-L/mnw";
# Alternative documentation generator
ndg = {
url = "github:feel-co/ndg?ref=refs/tags/v2.6.0";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}