forked from cursorless-dev/cursorless
-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
123 lines (117 loc) · 4.18 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
{
description = "A Nix-flake-based development environment for Cursorless";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs =
{ self, nixpkgs }:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSupportedSystem =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f {
pkgs = import nixpkgs {
inherit system;
overlays = [
# Updated neovim-node-client is pending merge:
# https://github.com/NixOS/nixpkgs/pull/317333
(final: prev: {
nodePackages = prev.nodePackages // {
neovim = prev.buildNpmPackage rec {
pname = "neovim-node-client";
version = "5.1.1-dev.0";
src = prev.fetchFromGitHub {
owner = "neovim";
repo = "node-client";
rev = "d99ececf115ddc8ade98467417c1bf0120b676b5";
hash = "sha256-eiKyhJNz7kH2iX55lkn7NZYTj6yaSZLMZxqiqPxDIPs=";
};
npmDeps = prev.fetchNpmDeps {
inherit src;
hash = "sha256-UoMq+7evskxtZygycxLBgeUtwrET8jYKeZwMiXdBMAw=";
};
postInstall = ''
mkdir -p $out/bin
ln -s $out/lib/node_modules/neovim/node_modules/.bin/neovim-node-host $out/bin
'';
};
};
neovim = prev.neovim.override { withNodeJs = true; };
# There is a recent bug that prevents cli --check invocation:
# See #2613
lua-language-server = prev.lua-language-server.overrideAttrs {
postPatch =
let
patch = prev.fetchurl {
url = "https://github.com/LuaLS/lua-language-server/pull/2775.patch";
sha256 = "sha256-5hjuNzBHLp9kiD6O8jTL5YlvaqR8IuJPHchIZE2/p/Q=";
};
in
''
patch -p1 < ${patch}
''
+ prev.lua-language-server.postPatch;
};
})
];
};
}
);
pythonVersion = builtins.replaceStrings [ "py" ] [
"python"
] (nixpkgs.lib.importTOML ./pyproject.toml).tool.ruff.target-version;
in
{
packages = forEachSupportedSystem (
{ pkgs }:
{
lua-language-server = pkgs.lua-language-server;
}
);
devShells = forEachSupportedSystem (
{ pkgs }:
{
default = pkgs.mkShell {
packages =
let
python = pkgs.${pythonVersion};
pythonPackages = pkgs."${pythonVersion}Packages";
in
[
pkgs.corepack
pkgs.vsce
pkgs.nodejs
# https://github.com/NixOS/nixpkgs/pull/251418
(pkgs.pre-commit.overrideAttrs (previousAttrs: {
makeWrapperArgs = ''
--set PYTHONPATH $PYTHONPATH
'';
}))
python
pkgs.lua-language-server # language server used by pre-commit hooks
pkgs.neovim
pkgs.luajitPackages.busted # for lua testing
pkgs.luarocks # pre-commit doesn't auto-install luarocks
pkgs.ps
];
# To prevent weird broken non-interactive bash terminal
buildInputs = [ pkgs.bashInteractive ];
shellHook = ''
if [ ! -f .git/hooks/pre-commit ]; then
echo "You can run 'pre-commit install' to install git commit hooks if you want them."
fi
pnpm install
PATH=${pkgs.lib.getBin pkgs.neovim}/bin:$PATH}
'';
};
}
);
};
}