-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
151 lines (137 loc) · 4.59 KB
/
flake.nix
File metadata and controls
151 lines (137 loc) · 4.59 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
147
148
149
150
151
{
description = "suasuasuasuasua's nixvim config";
inputs = {
# use the latest stable branch
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
nixvim.url = "github:nix-community/nixvim/nixos-25.11";
flake-parts.url = "github:hercules-ci/flake-parts";
git-hooks-nix = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
nixvim,
flake-parts,
...
}@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.git-hooks-nix.flakeModule ];
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
flake = {
hydraJobs = {
inherit (self) packages;
};
meta = {
description = "My nixvim configuration";
homepage = "https://github.com/Losses/rune";
license = with nixpkgs.lib.licenses; [
mit
];
maintainers = [
{
name = "Justin Hoang";
email = "justinhoang@sua.sh";
github = "suasuasuasuasua";
githubId = 72476123;
}
];
};
};
# https://github.com/nix-community/nixvim/blob/1c5c991fda4519db56c30c9d75ba29ba7097af83/templates/simple/flake.nix
perSystem =
{
lib,
config,
system,
...
}:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfreePredicate =
pkg:
builtins.elem (lib.getName pkg) [
"obsidian"
];
};
nixvimLib = nixvim.lib.${system};
nixvim' = nixvim.legacyPackages.${system};
nixvimModule = {
inherit pkgs; # or alternatively, set `system`
module = import ./config; # import the module directly
# You can use `extraSpecialArgs` to pass additional arguments to your module files
extraSpecialArgs = {
# inherit (inputs) foo;
};
};
nvim = nixvim'.makeNixvimWithModule nixvimModule;
in
{
devShells.default = import ./shell.nix {
inherit pkgs config;
};
# enable treefmt as the formatter
pre-commit.settings.hooks = {
treefmt = {
enable = true;
# add the packages so the precommit-hook treefmt can find them
settings.formatters = with pkgs; [
nixfmt-rfc-style
nodePackages.prettier
];
};
deadnix.enable = true; # remove any unused variabes and imports
flake-checker.enable = false; # run `flake check`
statix.enable = true; # check "good practices" for nix
commitizen.enable = true;
ripsecrets.enable = true;
# General
check-added-large-files.enable = true; # warning about large files (lfs?)
check-merge-conflicts.enable = true; # don't commit merge conflicts
end-of-file-fixer.enable = true; # add a line at the end of the file
trim-trailing-whitespace.enable = true; # trim trailing whitespace
};
formatter = pkgs.treefmt;
checks = {
# Run `nix flake check .` to verify that your config is not broken
default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule;
};
# Lets you run `nix run .` to start nixvim
packages =
builtins.foldl'
(
acc: profile:
{
${profile} = import ./packages/${profile}.nix {
inherit nvim lib;
};
}
// acc
)
{ }
# in order of plugin and configuration complexity
[
# Disable EVERYTHING (kickstart and custom)
"plain"
# Disable all configurations (lsps, plugins, etc.)
"minimal"
# The default configuration has the kickstart configuration and
# a few essential custom plugins
"default"
# Enable all configurations (lsps, plugins, etc.)
# WARNING: some plugins require additional configuration, so make
# sure to `.extend` the derivation that you choose appropriately
# - `obsidian.nvim` needs workspaces for example
"full"
];
};
};
}