This repository was archived by the owner on Feb 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
110 lines (98 loc) · 2.59 KB
/
flake.nix
File metadata and controls
110 lines (98 loc) · 2.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
{
description = "A nixvim configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixvim.url = "github:nix-community/nixvim";
flake-parts.url = "github:hercules-ci/flake-parts";
md-table-tidy = {
url = "github:timantipov/md-table-tidy.nvim";
flake = false;
};
lualine-so-fancy = {
url = "github:meuter/lualine-so-fancy.nvim";
flake = false;
};
toggler = {
url = "github:nguyenvukhang/nvim-toggler";
flake = false;
};
c-formatter-42 = {
url = "github:Diogo-ss/42-C-Formatter.nvim";
flake = false;
};
header-42-nvim = {
url = "github:Diogo-ss/42-header.nvim";
flake = false;
};
};
outputs = inputs @ {
flake-parts,
nixpkgs,
nixvim,
...
}: let
mkNixvim = {system, ...} @ settings: let
pkgs = import nixpkgs {inherit system;};
pkgs' = pkgs.extend (_: prev: import ./pkgs prev inputs);
nixvim' = nixvim.legacyPackages.${system};
nixvimModule = {
extraSpecialArgs = import ./lib;
pkgs = pkgs';
module =
import ./config
// {
settings =
removeAttrs settings ["inputs" "system" "config"]
// {
flake =
if builtins.hasAttr "inputs" settings
then settings.inputs.self
else null;
};
}
// (
if builtins.hasAttr "config" settings
then settings.config
else {}
);
};
in {
module = nixvimModule;
nvim = nixvim'.makeNixvimWithModule nixvimModule;
};
in
flake-parts.lib.mkFlake {inherit inputs;} {
flake = {
lib.mkNvim = attrs: (mkNixvim attrs).nvim;
};
systems = ["x86_64-linux" "aarch64-linux"];
perSystem = {
system,
pkgs,
...
}: {
packages = let
nvim' = mkNixvim {
inherit system;
maximal = true;
};
in {
default = nvim'.nvim;
# Recipes
format = pkgs.writeShellScriptBin "format" ''
alejandra check -e pkgs/ && nixpkgs-fmt pkgs/
'';
};
legacyPackages = import ./pkgs pkgs inputs;
checks = let
nvim' = mkNixvim {
inherit system;
maximal = true;
};
in {
# Run `nix flake check .` to verify that your config is not broken
default = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule nvim'.module;
};
};
};
}