Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
bun-version: "1.4.2"
- run: bun install --frozen-lockfile
- run: bun run check
- run: npm pack --dry-run
- run: bun pm pack --dry-run
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ coverage/
.DS_Store
*.log
.claude/
.direnv/
.pre-commit-config.yaml
45 changes: 45 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"format_on_save": "on",
"lsp": {
"biome": {
"settings": {
"require_config_file": true
}
},
"nil": {
"binary": {
"path": "direnv",
"arguments": ["exec", ".", "nil"]
}
}
},
"languages": {
"JavaScript": {
"formatter": { "language_server": { "name": "biome" } },
"code_actions_on_format": {
"source.organizeImports.biome": true
}
},
"TypeScript": {
"formatter": { "language_server": { "name": "biome" } },
"code_actions_on_format": {
"source.organizeImports.biome": true
}
},
"JSON": {
"formatter": { "language_server": { "name": "biome" } }
},
"JSONC": {
"formatter": { "language_server": { "name": "biome" } }
},
"Nix": {
"language_servers": ["nil", "!nixd"],
"formatter": {
"external": {
"command": "direnv",
"arguments": ["exec", ".", "nixfmt", "-"]
}
}
}
}
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ gets**.

## Development

You need Bun 1.4.2, Python 3 and macOS or Linux.
You need Bun 1.4.2, Python 3 and macOS or Linux. [Nix](https://nixos.org)
gives the shell all three, and lints each commit with Biome and nixfmt:
`nix develop`, or `direnv allow` once.

```sh
bun install --frozen-lockfile
Expand Down
82 changes: 82 additions & 0 deletions flake.lock

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

69 changes: 69 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
description = "The Leverage plugin for Pi: its development shell";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
# Only for Bun: stable has 1.3.13, and the project pins 1.4.2.
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
git-hooks.url = "github:cachix/git-hooks.nix";
git-hooks.inputs.nixpkgs.follows = "nixpkgs";
};

outputs =
{
nixpkgs,
nixpkgs-unstable,
git-hooks,
...
}:
let
systems = [
"aarch64-darwin"
"x86_64-darwin"
"aarch64-linux"
"x86_64-linux"
];
forEach = f: nixpkgs.lib.genAttrs systems (system: f system nixpkgs.legacyPackages.${system});
# Lints each commit once the shell is entered.
hooks = forEach (
system: pkgs:
git-hooks.lib.${system}.run {
src = ./.;
hooks = {
# The project's own Biome, the version CI checks with.
biome = {
enable = true;
name = "biome";
entry = "node_modules/.bin/biome check --write --no-errors-on-unmatched --files-ignore-unknown=true";
types_or = [
"javascript"
"jsx"
"ts"
"tsx"
"json"
];
};
nixfmt.enable = true;
};
}
);
in
{
devShells = forEach (
system: pkgs: {
default = pkgs.mkShell {
inherit (hooks.${system}) shellHook;
packages = [
nixpkgs-unstable.legacyPackages.${system}.bun
pkgs.nodejs_24
# The tests drive real terminals through Python.
pkgs.python3
# Zed's language server for flake.nix.
pkgs.nil
]
++ hooks.${system}.enabledPackages;
};
}
);
};
}
Loading