Skip to content
Open
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
28 changes: 26 additions & 2 deletions programs/biome.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,23 @@ let

cfg = config.programs.biome;
opts = options.programs.biome;
biomeVersion = if builtins.match "^1\\." pkgs.biome.version != null then "1.9.4" else "2.1.2";
biomeVersion =
let
v = pkgs.biome.version;
in
if builtins.match "^1\\." v != null then
"1.9.4"
else if builtins.match "^2\\.2\\." v != null then
"2.2.5"
else if builtins.match "^2\\.3\\." v != null then
"2.3.5"
else
"2.1.2";
schemaHashes = {
"1.9.4" = "sha256-SkkULLRk4CQzk+j0h8PAqOY6vGOrdG5ja7Z/tSAAKnY=";
"2.1.2" = "sha256-n4Y16J7g34e0VdQzRItu/P7n5oppkY4Vm4P1pQxOILU=";
"2.2.5" = "sha256-no7jIazvyEp+hdwmuArQ/yRgnWrAw/NEM5qRInMRuaE=";
"2.3.5" = "sha256-8O59CmHaP7/XuGs9BteOTcltddYSTxEIM/64dLfbLk0=";
};

ext.js = [
Expand Down Expand Up @@ -78,6 +91,12 @@ in
description = "Allows to format a document that has unsafe fixes.";
default = false;
};
configPath = l.mkOption {
type = t.nullOr t.str;
description = "Path to a Biome configuration file.";
default = null;
example = "/path/to/biome.json";
};
settings = l.mkOption {
inherit (json) type;
description = "Raw Biome configuration (must conform to Biome JSON schema)";
Expand Down Expand Up @@ -151,7 +170,12 @@ in
cp "$json" $out
'';
in
[
[ ]
++ l.optionals (cfg.configPath != null) [
"--config-path"
"${cfg.configPath}"
]
++ l.optionals (cfg.configPath == null) [
"--config-path"
"${if cfg.validate.enable then validatedConfig else jsonFile}"
]
Expand Down