mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
chore(nix): drop Biome, treefmt, and the devshell
Keep the flake focused on packaging pi. Biome was only needed for the devshell and formatting check.
This commit is contained in:
parent
1b9424443d
commit
7201ac43ae
7 changed files with 4 additions and 172 deletions
1
.github/workflows/nix.yml
vendored
1
.github/workflows/nix.yml
vendored
|
|
@ -131,7 +131,6 @@ jobs:
|
|||
run: |
|
||||
nix build -L --no-link \
|
||||
.#checks.${{ matrix.system }}.smoke \
|
||||
.#checks.${{ matrix.system }}.formatting \
|
||||
.#checks.${{ matrix.system }}.repo-hygiene
|
||||
|
||||
- name: Smoke-test
|
||||
|
|
|
|||
12
README.md
12
README.md
|
|
@ -110,18 +110,6 @@ npm run check # Lint, format, and type check
|
|||
./pi-test.sh # Run pi from sources (can be run from any directory)
|
||||
```
|
||||
|
||||
### Nix development shell
|
||||
|
||||
The flake provides the same toolchain without npm-managed binaries. Node.js 22
|
||||
and the Biome version pinned in `package.json` come from Nix, so `nix fmt` and
|
||||
`npm run check` format the same way.
|
||||
|
||||
```bash
|
||||
nix develop # Shell with Node.js, Biome, and treefmt
|
||||
nix fmt # Format JavaScript, TypeScript, JSON, CSS, and Nix
|
||||
nix flake check # Build pi, then run the smoke, formatting, and hygiene checks
|
||||
```
|
||||
|
||||
### Using local packages outside the monorepo
|
||||
|
||||
Build every public package into one coherent local artifact set:
|
||||
|
|
|
|||
30
flake.nix
30
flake.nix
|
|
@ -36,9 +36,6 @@
|
|||
forAllSystems = genAttrs platforms;
|
||||
|
||||
piOverlay = _final: prev: {
|
||||
biome = prev.callPackage ./nix/biome.nix {
|
||||
inherit source;
|
||||
};
|
||||
pi = prev.callPackage ./nix/package.nix {
|
||||
inherit source packageJson platforms;
|
||||
nodejs = prev.nodejs_22;
|
||||
|
|
@ -49,19 +46,11 @@
|
|||
system:
|
||||
let
|
||||
pkgs = (nixpkgsFor system).extend piOverlay;
|
||||
inherit (pkgs) pi;
|
||||
nodejs = pkgs.nodejs_22;
|
||||
treefmtWrapper = import ./nix/treefmt.nix { inherit pkgs; };
|
||||
devShell = import ./nix/devshell.nix { inherit pkgs nodejs treefmtWrapper; };
|
||||
in
|
||||
{
|
||||
inherit
|
||||
pkgs
|
||||
pi
|
||||
nodejs
|
||||
devShell
|
||||
treefmtWrapper
|
||||
;
|
||||
inherit pkgs;
|
||||
inherit (pkgs) pi;
|
||||
nodejs = pkgs.nodejs_22;
|
||||
}
|
||||
);
|
||||
in
|
||||
|
|
@ -69,12 +58,7 @@
|
|||
checks = forAllSystems (
|
||||
system:
|
||||
import ./nix/checks.nix {
|
||||
inherit (perSystem.${system})
|
||||
pkgs
|
||||
pi
|
||||
nodejs
|
||||
treefmtWrapper
|
||||
;
|
||||
inherit (perSystem.${system}) pkgs pi nodejs;
|
||||
inherit source;
|
||||
}
|
||||
);
|
||||
|
|
@ -84,12 +68,6 @@
|
|||
pi = perSystem.${system}.pi;
|
||||
});
|
||||
|
||||
devShells = forAllSystems (system: {
|
||||
default = perSystem.${system}.devShell;
|
||||
});
|
||||
|
||||
formatter = forAllSystems (system: perSystem.${system}.treefmtWrapper);
|
||||
|
||||
apps = forAllSystems (system: rec {
|
||||
default = pi;
|
||||
pi = {
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchurl,
|
||||
autoPatchelfHook,
|
||||
source,
|
||||
}:
|
||||
let
|
||||
inherit (lib) importJSON optionals licenses;
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "biome";
|
||||
version = (importJSON "${source}/package.json").devDependencies."@biomejs/biome";
|
||||
|
||||
src =
|
||||
finalAttrs.passthru.sources.${stdenv.hostPlatform.system}
|
||||
or (throw "Unsupported system for Biome: ${stdenv.hostPlatform.system}");
|
||||
|
||||
nativeBuildInputs = optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
|
||||
buildInputs = optionals stdenv.hostPlatform.isLinux [ stdenv.cc.cc.lib ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 biome $out/bin/biome
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.sources = {
|
||||
x86_64-linux = fetchurl {
|
||||
url = "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-${finalAttrs.version}.tgz";
|
||||
hash = "sha256-2k7rG5YgEyMtJ7jAI+JWPzWhdxlNZI6TqyMVngU9Dus=";
|
||||
};
|
||||
aarch64-linux = fetchurl {
|
||||
url = "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-${finalAttrs.version}.tgz";
|
||||
hash = "sha256-cLKXQ7uIyS2aQ7P95IHh7A7hI7z89p8WUKeYW3/4N/I=";
|
||||
};
|
||||
x86_64-darwin = fetchurl {
|
||||
url = "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-${finalAttrs.version}.tgz";
|
||||
hash = "sha256-cD7JJVxSXEAQnYSgWAbOC1EPJ+M0+q7h0xg57OXao4o=";
|
||||
};
|
||||
aarch64-darwin = fetchurl {
|
||||
url = "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-${finalAttrs.version}.tgz";
|
||||
hash = "sha256-sMi2Aywy3UnD9hQPyroTMPfCsFSZKRqqnb8uC5oNX34=";
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Toolchain of the web";
|
||||
homepage = "https://biomejs.dev/";
|
||||
license = licenses.mit;
|
||||
platforms = builtins.attrNames finalAttrs.passthru.sources;
|
||||
mainProgram = finalAttrs.pname;
|
||||
};
|
||||
})
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
pkgs,
|
||||
pi,
|
||||
treefmtWrapper,
|
||||
source,
|
||||
nodejs,
|
||||
}:
|
||||
|
|
@ -18,27 +17,6 @@
|
|||
touch $out
|
||||
'';
|
||||
|
||||
formatting =
|
||||
pkgs.runCommand "pi-formatting-check"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
treefmtWrapper
|
||||
pkgs.git
|
||||
];
|
||||
}
|
||||
''
|
||||
export HOME=$(mktemp -d)
|
||||
mkdir repo && cd repo
|
||||
cp -r ${source}/. .
|
||||
chmod -R +w .
|
||||
git init -q
|
||||
git config user.email "test@example.com"
|
||||
git config user.name "Test"
|
||||
git add .
|
||||
treefmt --ci
|
||||
touch $out
|
||||
'';
|
||||
|
||||
repo-hygiene =
|
||||
pkgs.runCommand "pi-repo-hygiene-check"
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
nodejs,
|
||||
treefmtWrapper,
|
||||
}:
|
||||
let
|
||||
inherit (pkgs.lib) getExe;
|
||||
in
|
||||
pkgs.mkShell {
|
||||
packages = [
|
||||
nodejs
|
||||
pkgs.git
|
||||
pkgs.biome
|
||||
treefmtWrapper
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export BIOME_BINARY="${getExe pkgs.biome}"
|
||||
git config core.hooksPath .husky
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
{ pkgs }:
|
||||
pkgs.treefmt.withConfig {
|
||||
runtimeInputs = with pkgs; [
|
||||
biome
|
||||
nixfmt
|
||||
];
|
||||
settings = {
|
||||
global.tree_root_file = "flake.nix";
|
||||
formatter = {
|
||||
biome = {
|
||||
command = "biome";
|
||||
options = [
|
||||
"format"
|
||||
"--write"
|
||||
"--no-errors-on-unmatched"
|
||||
];
|
||||
includes = [
|
||||
"*.cjs"
|
||||
"*.css"
|
||||
"*.cts"
|
||||
"*.graphql"
|
||||
"*.js"
|
||||
"*.json"
|
||||
"*.jsonc"
|
||||
"*.mjs"
|
||||
"*.mts"
|
||||
"*.ts"
|
||||
];
|
||||
};
|
||||
nixfmt = {
|
||||
command = "nixfmt";
|
||||
includes = [ "*.nix" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue