-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
159 lines (150 loc) · 4.82 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
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
152
153
154
155
156
157
158
159
{
inputs = {
devenv = {
url = "github:cachix/devenv";
inputs.pre-commit-hooks.follows = "git-hooks";
};
git-hooks.url = "github:cachix/git-hooks.nix";
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-nix = {
url = "github:willruggiano/neovim.nix";
inputs.example.follows = "";
inputs.flake-parts.follows = "flake-parts";
# inputs.git-hooks.follows = ""; FIXME: SO :(
};
neovim = {
url = "github:nix-community/neovim-nightly-overlay";
inputs = {
git-hooks.follows = "";
hercules-ci-effects.follows = "";
nixpkgs.follows = "nixpkgs";
# neovim-src.follows = "neovim-src";
};
};
# neovim-src = {
# url = "github:neovim/neovim";
# flake = false;
# };
nil.url = "github:oxalica/nil";
nix-colors.url = "github:misterio77/nix-colors";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
sg-nvim.url = "github:sourcegraph/sg.nvim";
vscode-js-debug.url = "github:willruggiano/vscode-js-debug.nix";
zls.url = "github:zigtools/zls";
};
nixConfig = {
extra-substituters = [
"https://devenv.cachix.org"
"https://nix-community.cachix.org"
"https://willruggiano.cachix.org"
];
extra-trusted-public-keys = [
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"willruggiano.cachix.org-1:rz00ME8/uQfWe+tN3njwK5vc7P8GLWu9qbAjjJbLoSw="
];
};
outputs = {flake-parts, ...} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
inputs.devenv.flakeModule
inputs.neovim-nix.flakeModule
./modules
];
systems = ["aarch64-darwin" "x86_64-linux"];
perSystem = {
config,
lib,
inputs',
system,
...
}: let
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.rust-overlay.overlays.default
];
};
in {
_module.args = {
inherit pkgs;
nix-colors =
inputs.nix-colors.lib
// {
contrib = inputs.nix-colors.lib-contrib {inherit pkgs;};
schemes = inputs.nix-colors.colorSchemes;
};
};
apps = {
push.program = pkgs.writeShellApplication {
name = "push.sh";
runtimeInputs = with pkgs; [cachix jq];
text = ''
nix flake archive --json \
| jq -r '.path,(.inputs|to_entries[].value.path)' \
| cachix push willruggiano;
nix build --json \
| jq -r '.[].outputs | to_entries[].value' \
| cachix push willruggiano;
cachix pin willruggiano nvim-drv "$(nix build --print-out-paths)"
'';
};
update.program = pkgs.writeShellApplication {
name = "update.sh";
runtimeInputs = with pkgs; [niv];
text = ''
nix flake update &&
niv update &&
nix run .#nvim-treesitter.update-grammars &&
nix flake check --impure &&
git commit -am 'chore: 🌶️🌶️🌶️' &&
git push
'';
};
};
devenv.shells.default = {
name = "neovim";
# https://github.com/cachix/devenv/issues/528
containers = lib.mkForce {};
packages = with pkgs; [alejandra just niv nodejs tree-sitter];
pre-commit.hooks = {
alejandra.enable = true;
stylua.enable = true;
};
scripts = {
plug-add.exec = ''
niv add git git@github.com:$1 && git add -A
'';
};
};
formatter = pkgs.alejandra;
packages = {
default = pkgs.symlinkJoin {
name = "nvim-bin";
paths = [
config.neovim.final # `nvim`
(pkgs.writeShellScriptBin "fvim" ''
nvim +'Telescope smart_open'
'')
];
meta.mainProgram = "nvim";
};
kulala-fmt = pkgs.callPackage ./pkgs/kulala-fmt {};
luafun = pkgs.luajit.pkgs.callPackage ./pkgs/luafun.nix {};
neovim-nightly = inputs'.neovim.packages.default;
nvim = config.neovim.final;
nvim-dbee = pkgs.callPackage ./pkgs/nvim-dbee.nix {};
nvim-treesitter = pkgs.callPackage ./pkgs/nvim-treesitter {};
sqruff = pkgs.callPackage ./pkgs/sqruff.nix {inherit inputs;};
# vtsls = pkgs.callPackage ./pkgs/vtsls {};
};
};
};
}