Skip to content

Commit 1cdf49e

Browse files
committed
feat: working debug on nix
1 parent cdaf58e commit 1cdf49e

File tree

6 files changed

+131
-1
lines changed

6 files changed

+131
-1
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@ packages/test-harness/testSubsetGrep.properties
4646

4747
cursorless.nvim/node/cursorless-neovim
4848
cursorless.nvim/node/test-harness
49+
50+
# nix
51+
.direnv

flake.lock

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

flake.nix

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
description = "A Nix-flake-based development environment for Cursorless";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6+
};
7+
8+
outputs =
9+
{ self, nixpkgs }:
10+
let
11+
supportedSystems = [
12+
"x86_64-linux"
13+
"aarch64-linux"
14+
"x86_64-darwin"
15+
"aarch64-darwin"
16+
];
17+
forEachSupportedSystem =
18+
f:
19+
nixpkgs.lib.genAttrs supportedSystems (
20+
system:
21+
f {
22+
pkgs = import nixpkgs {
23+
inherit system;
24+
overlays = [
25+
# https://github.com/NixOS/nixpkgs/pull/317333
26+
(final: prev: {
27+
nodePackages = prev.nodePackages // {
28+
neovim = prev.buildNpmPackage rec {
29+
pname = "neovim-node-client";
30+
version = "5.1.1-dev.0";
31+
src = prev.fetchFromGitHub {
32+
owner = "neovim";
33+
repo = "node-client";
34+
rev = "d99ececf115ddc8ade98467417c1bf0120b676b5";
35+
hash = "sha256-eiKyhJNz7kH2iX55lkn7NZYTj6yaSZLMZxqiqPxDIPs=";
36+
};
37+
npmDeps = prev.fetchNpmDeps {
38+
inherit src;
39+
hash = "sha256-UoMq+7evskxtZygycxLBgeUtwrET8jYKeZwMiXdBMAw=";
40+
};
41+
postInstall = ''
42+
mkdir -p $out/bin
43+
ln -s $out/lib/node_modules/neovim/node_modules/.bin/neovim-node-host $out/bin
44+
'';
45+
};
46+
};
47+
neovim = prev.neovim.override { withNodeJs = true; };
48+
49+
})
50+
51+
];
52+
};
53+
}
54+
);
55+
pythonVersion = builtins.replaceStrings [ "py" ] [
56+
"python"
57+
] (nixpkgs.lib.importTOML ./pyproject.toml).tool.ruff.target-version;
58+
in
59+
{
60+
61+
devShells = forEachSupportedSystem (
62+
{ pkgs }:
63+
{
64+
default = pkgs.mkShell {
65+
packages =
66+
let
67+
python = pkgs.${pythonVersion};
68+
pythonPackages = pkgs."${pythonVersion}Packages";
69+
in
70+
[
71+
pkgs.corepack
72+
pkgs.vsce
73+
# https://github.com/NixOS/nixpkgs/pull/251418
74+
(pkgs.pre-commit.overrideAttrs (previousAttrs: {
75+
makeWrapperArgs = ''
76+
--set PYTHONPATH $PYTHONPATH
77+
'';
78+
}))
79+
80+
python
81+
pkgs.neovim
82+
];
83+
# To prevent weird broken non-interactive bash terminal
84+
buildInputs = [ pkgs.bashInteractive ];
85+
shellHook = ''
86+
if [ ! -f .git/hooks/pre-commit ]; then
87+
pre-commit install
88+
fi
89+
pnpm install
90+
PATH=${pkgs.lib.getBin pkgs.neovim}/bin:$PATH}
91+
'';
92+
};
93+
}
94+
);
95+
};
96+
}

packages/cursorless-neovim/scripts/debug-neovim.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ export NVIM_NODE_LOG_FILE="${workspaceFolder}/packages/cursorless-neovim/out/nvi
1010
export NVIM_NODE_LOG_LEVEL="info"
1111
export CURSORLESS_MODE="${cursorless_mode}"
1212

13-
nvim -u "${workspaceFolder}/init.lua"
13+
command nvim -u "${workspaceFolder}/init.lua"

packages/cursorless-neovim/scripts/populate-dist.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
set -euo pipefail
33

44
echo "Populating dist directory..."
5+
if [ ! -e "${CURSORLESS_REPO_ROOT-nonexistent}" ]; then
6+
CURSORLESS_REPO_ROOT=$(git rev-parse --show-toplevel)
7+
fi
58
echo "CURSORLESS_REPO_ROOT: $CURSORLESS_REPO_ROOT"
69
cursorless_nvim_dir="$CURSORLESS_REPO_ROOT/cursorless.nvim"
710
cursorless_neovim_node_in_dir="$CURSORLESS_REPO_ROOT/packages/cursorless-neovim"

0 commit comments

Comments
 (0)