mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
feat(nix): package Biome 2.3.5 and integrate with treefmt and devshell
This commit is contained in:
parent
40e5810994
commit
2c2e93e6f5
4 changed files with 63 additions and 19 deletions
|
|
@ -36,6 +36,7 @@
|
|||
forAllSystems = genAttrs platforms;
|
||||
|
||||
piOverlay = _final: prev: {
|
||||
biome = prev.callPackage ./nix/biome.nix { };
|
||||
pi = prev.callPackage ./nix/package.nix {
|
||||
inherit source packageJson platforms;
|
||||
nodejs = prev.nodejs_22;
|
||||
|
|
@ -45,9 +46,9 @@
|
|||
perSystem =
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgsFor system;
|
||||
pi = (pkgs.extend piOverlay).pi;
|
||||
treefmtWrapper = import ./nix/treefmt.nix { inherit pkgs source; };
|
||||
pkgs = (nixpkgsFor system).extend piOverlay;
|
||||
inherit (pkgs) pi;
|
||||
treefmtWrapper = import ./nix/treefmt.nix { inherit pkgs; };
|
||||
devShell = import ./nix/devshell.nix {
|
||||
inherit pkgs treefmtWrapper;
|
||||
nodejs = pkgs.nodejs_22;
|
||||
|
|
|
|||
50
nix/biome.nix
Normal file
50
nix/biome.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchurl,
|
||||
autoPatchelfHook,
|
||||
}:
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "biome";
|
||||
version = "2.3.5";
|
||||
|
||||
src =
|
||||
finalAttrs.passthru.sources.${stdenv.hostPlatform.system}
|
||||
or (throw "Unsupported system for Biome: ${stdenv.hostPlatform.system}");
|
||||
|
||||
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
|
||||
buildInputs = lib.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 = lib.licenses.mit;
|
||||
platforms = builtins.attrNames finalAttrs.passthru.sources;
|
||||
mainProgram = finalAttrs.pname;
|
||||
};
|
||||
})
|
||||
|
|
@ -3,14 +3,19 @@
|
|||
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,18 +1,8 @@
|
|||
{ pkgs, source }:
|
||||
let
|
||||
biomeConfig = pkgs.writeText "biome.json" (
|
||||
builtins.toJSON (
|
||||
(pkgs.lib.importJSON "${source}/biome.json")
|
||||
// {
|
||||
plugins = [ "${source}/scripts/biome/model-type-comparison.grit" ];
|
||||
}
|
||||
)
|
||||
);
|
||||
in
|
||||
{ pkgs }:
|
||||
pkgs.treefmt.withConfig {
|
||||
runtimeInputs = [
|
||||
pkgs.biome
|
||||
pkgs.nixfmt
|
||||
runtimeInputs = with pkgs; [
|
||||
biome
|
||||
nixfmt
|
||||
];
|
||||
settings = {
|
||||
global.tree_root_file = "flake.nix";
|
||||
|
|
@ -23,8 +13,6 @@ pkgs.treefmt.withConfig {
|
|||
"format"
|
||||
"--write"
|
||||
"--no-errors-on-unmatched"
|
||||
"--config-path"
|
||||
(builtins.toString biomeConfig)
|
||||
];
|
||||
includes = [
|
||||
"*.cjs"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue