Skip to content

Commit d534133

Browse files
committed
add nix flake files
1 parent f92f889 commit d534133

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

flake.lock

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
description = "A Nix-flake-based development environment for Cursorless";
3+
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5+
6+
outputs = { self, nixpkgs }:
7+
let
8+
overlays = [
9+
(final: prev: rec {
10+
nodejs = prev.nodejs-18_x;
11+
pnpm = prev.nodePackages.pnpm;
12+
})
13+
];
14+
supportedSystems =
15+
[ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
16+
forEachSupportedSystem = f:
17+
nixpkgs.lib.genAttrs supportedSystems (system:
18+
f {
19+
pkgs = import nixpkgs {
20+
inherit overlays system;
21+
config.allowUnfree = true;
22+
};
23+
});
24+
pythonVersion = builtins.replaceStrings
25+
[ "py" ]
26+
[ "python" ]
27+
(nixpkgs.lib.importTOML ./pyproject.toml).tool.ruff.target-version;
28+
in
29+
{
30+
devShells = forEachSupportedSystem ({ pkgs }: {
31+
default = pkgs.mkShell {
32+
packages = with pkgs; [
33+
nodejs
34+
pnpm
35+
pkgs.${pythonVersion}
36+
vsce
37+
pre-commit
38+
];
39+
# To prevent weird broken non-interactive bash terminal
40+
buildInputs = [ pkgs.bashInteractive ];
41+
shellHook = ''
42+
if [ ! -f .git/hooks/pre-commit ]; then
43+
pre-commit install
44+
fi
45+
'';
46+
};
47+
});
48+
};
49+
}

0 commit comments

Comments
 (0)