Skip to content

Commit 4bf2e33

Browse files
committed
feat(nix): app defination to run neovim config with nix itself
1 parent e1528a0 commit 4bf2e33

File tree

2 files changed

+42
-21
lines changed

2 files changed

+42
-21
lines changed

flake.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,57 @@
11
{
2+
description = "";
3+
24
inputs = {
3-
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
5+
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
46
};
57

68
outputs =
7-
{ nixpkgs, ... }:
9+
{ self, nixpkgs, ... }:
810
let
911
systems = [
1012
"x86_64-linux"
1113
"aarch64-linux"
1214
"x86_64-darwin"
1315
"aarch64-darwin"
1416
];
15-
forAllSystems =
16-
function: nixpkgs.lib.genAttrs systems (system: function (import nixpkgs { inherit system; }));
17+
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f (import nixpkgs { inherit system; }));
1718
in
1819
{
19-
devShells = forAllSystems (pkgs: {
20-
default = pkgs.mkShell {
21-
packages = with pkgs; [
22-
neovim
23-
fd
20+
apps = forAllSystems (
21+
pkgs:
22+
let
23+
runtimeDeps = with pkgs; [
24+
gcc
25+
nixd
26+
lua-language-server
2427
ripgrep
28+
fd
2529
];
26-
shellHook = ''
27-
[ -d ~/.config/nvim ] && mv ~/.config/nvim ~/.config/nvim.before-pwnvim || true
28-
echo "Cloning, Syncing Neovim plugins ..."
29-
git clone --depth=1 https://github.com/pwnwriter/pwnvim ~/.config/nvim
30-
nvim --headless +"Lazy! sync" +qa
31-
'';
3230

33-
};
34-
});
31+
nvim = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (
32+
pkgs.neovimUtils.makeNeovimConfig {
33+
34+
customRC = ''
35+
set runtimepath^=${./.}
36+
source ${./.}/init.lua
37+
'';
38+
}
39+
// {
40+
wrapperArgs = [
41+
"--prefix"
42+
"PATH"
43+
":"
44+
"${pkgs.lib.makeBinPath runtimeDeps}"
45+
];
46+
}
47+
);
48+
in
49+
{
50+
default = {
51+
type = "app";
52+
program = "${nvim}/bin/nvim";
53+
};
54+
}
55+
);
3556
};
3657
}

0 commit comments

Comments
 (0)