Skip to content

Commit

Permalink
add nix flake files
Browse files Browse the repository at this point in the history
  • Loading branch information
fidgetingbits committed Mar 6, 2024
1 parent f92f889 commit d534133
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
description = "A Nix-flake-based development environment for Cursorless";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

outputs = { self, nixpkgs }:
let
overlays = [
(final: prev: rec {
nodejs = prev.nodejs-18_x;
pnpm = prev.nodePackages.pnpm;
})
];
supportedSystems =
[ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f {
pkgs = import nixpkgs {
inherit overlays system;
config.allowUnfree = true;
};
});
pythonVersion = builtins.replaceStrings
[ "py" ]
[ "python" ]
(nixpkgs.lib.importTOML ./pyproject.toml).tool.ruff.target-version;
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
nodejs
pnpm
pkgs.${pythonVersion}
vsce
pre-commit
];
# To prevent weird broken non-interactive bash terminal
buildInputs = [ pkgs.bashInteractive ];
shellHook = ''
if [ ! -f .git/hooks/pre-commit ]; then
pre-commit install
fi
'';
};
});
};
}

0 comments on commit d534133

Please sign in to comment.