-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f94e08
commit f38fc96
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,6 @@ next-env.d.ts | |
|
||
# test subset config | ||
packages/test-harness/testSubsetGrep.properties | ||
|
||
# nix | ||
.direnv/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
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; }; }); | ||
pythonVersion = builtins.replaceStrings [ "py" ] [ | ||
"python" | ||
] (nixpkgs.lib.importTOML ./pyproject.toml).tool.ruff.target-version; | ||
in | ||
{ | ||
devShells = forEachSupportedSystem ( | ||
{ pkgs }: | ||
{ | ||
default = pkgs.mkShell { | ||
packages = | ||
let | ||
python = pkgs.${pythonVersion}; | ||
pythonPackages = pkgs."${pythonVersion}Packages"; | ||
in | ||
[ | ||
pkgs.corepack | ||
pkgs.vsce | ||
pkgs.pre-commit | ||
|
||
python | ||
# Dependencies from pre-commit python scripts | ||
# run `pre-commit run --all-files` to find out what you need. | ||
pythonPackages.identify | ||
pythonPackages.cfgv | ||
pythonPackages.yamllint | ||
]; | ||
# To prevent weird broken non-interactive bash terminal | ||
buildInputs = [ pkgs.bashInteractive ]; | ||
shellHook = '' | ||
if [ ! -f .git/hooks/pre-commit ]; then | ||
pre-commit install | ||
fi | ||
# Cursorless .prettierrc depends on prettier-plugin-tailwindcss, which | ||
# pre-commit won't auto-install. So we have to manually install it into the | ||
# workspace until there is a nix package. | ||
if ! pnpm ls prettier-plugin-tailwindcss | grep prettier >/dev/null; then | ||
pnpm -w -D install prettier-plugin-tailwindcss | ||
# This updates the pnpm-lock.yaml, which we don't want to keep | ||
git restore pnpm-lock.yaml | ||
fi | ||
''; | ||
}; | ||
} | ||
); | ||
}; | ||
} |