diff --git a/programs/biome.nix b/programs/biome.nix index dea4de57..5aa7bd46 100644 --- a/programs/biome.nix +++ b/programs/biome.nix @@ -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 = [ @@ -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)"; @@ -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}" ]