From 75293c01222d6f3fc379030a7bccc66068c12fb6 Mon Sep 17 00:00:00 2001 From: Acid Bong Date: Mon, 17 Nov 2025 20:17:26 +0200 Subject: [PATCH 1/4] fix(biome): don't include empty config This change will allow usage of plain `biome.json` --- examples/formatter-biome.toml | 2 +- programs/biome.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/formatter-biome.toml b/examples/formatter-biome.toml index 2a79e06..fdfb1ba 100644 --- a/examples/formatter-biome.toml +++ b/examples/formatter-biome.toml @@ -18,4 +18,4 @@ includes = [ "*.jsonc", "*.css", ] -options = ["check", "--write", "--no-errors-on-unmatched", "--config-path", "config.json"] +options = ["check", "--write", "--no-errors-on-unmatched"] diff --git a/programs/biome.nix b/programs/biome.nix index dea4de5..654b518 100644 --- a/programs/biome.nix +++ b/programs/biome.nix @@ -151,7 +151,7 @@ in cp "$json" $out ''; in - [ + l.optionals (cfg.settings != { }) [ "--config-path" "${if cfg.validate.enable then validatedConfig else jsonFile}" ] From 353bcb086a610ac2c43728979685fdb967d30088 Mon Sep 17 00:00:00 2001 From: Acid Bong Date: Fri, 21 Nov 2025 18:48:31 +0200 Subject: [PATCH 2/4] fix(statix): don't include empty config --- programs/statix.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/programs/statix.nix b/programs/statix.nix index c2997fd..ed457e8 100644 --- a/programs/statix.nix +++ b/programs/statix.nix @@ -43,7 +43,9 @@ in # statix doesn't support multiple file targets command = pkgs.writeShellScriptBin "statix-fix" '' for file in "$@"; do - ${lib.getExe cfg.package} fix --config '${toString settingsDir}/statix.toml' "$file" + ${lib.getExe cfg.package} fix ${ + lib.optionalString (cfg.disabled-lints != [ ]) "--config '${settingsDir}/statix.toml'" + } "$file" done ''; }; From c6d459f5c926c683df4048e7e444e98ff65fdf7b Mon Sep 17 00:00:00 2001 From: Acid Bong Date: Fri, 21 Nov 2025 20:37:34 +0200 Subject: [PATCH 3/4] fix(php-cs-fixer): don't include nonexistent config --- examples/formatter-php-cs-fixer.toml | 2 +- programs/php-cs-fixer.nix | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/examples/formatter-php-cs-fixer.toml b/examples/formatter-php-cs-fixer.toml index 6bcb2d1..1a292b3 100644 --- a/examples/formatter-php-cs-fixer.toml +++ b/examples/formatter-php-cs-fixer.toml @@ -3,4 +3,4 @@ command = "php-cs-fixer" excludes = [] includes = ["*.php"] -options = ["fix", "--config", "./.php-cs-fixer.php"] +options = ["fix"] diff --git a/programs/php-cs-fixer.nix b/programs/php-cs-fixer.nix index a131d24..c33aae5 100644 --- a/programs/php-cs-fixer.nix +++ b/programs/php-cs-fixer.nix @@ -26,18 +26,15 @@ in options.programs.php-cs-fixer = { configFile = lib.mkOption { description = "Path to php-cs-fixer config file."; - type = types.oneOf [ - types.str - types.path - ]; - default = "./.php-cs-fixer.php"; - example = "./.php-cs-fixer.dist.php"; + type = types.nullOr (types.pathWith { }); + default = null; + example = lib.literalExpression "./.php-cs-fixer.dist.php"; }; }; config = lib.mkIf cfg.enable { settings.formatter.php-cs-fixer = { - options = [ + options = lib.optionals (cfg.configFile != null) [ "--config" "${cfg.configFile}" ]; From b77cf8ac526c6d06152ff3d7e39983a94db9a618 Mon Sep 17 00:00:00 2001 From: Acid Bong Date: Fri, 21 Nov 2025 21:30:34 +0200 Subject: [PATCH 4/4] fix(genemichaels): remove default values from config file, don't include if empty --- examples/formatter-genemichaels.toml | 2 +- programs/genemichaels.nix | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/formatter-genemichaels.toml b/examples/formatter-genemichaels.toml index f2d800d..c4550ec 100644 --- a/examples/formatter-genemichaels.toml +++ b/examples/formatter-genemichaels.toml @@ -3,4 +3,4 @@ command = "genemichaels" excludes = [] includes = ["*.rs"] -options = ["--config", "genemichaels.json"] +options = [] diff --git a/programs/genemichaels.nix b/programs/genemichaels.nix index 46bc787..0a0b3a7 100644 --- a/programs/genemichaels.nix +++ b/programs/genemichaels.nix @@ -7,6 +7,7 @@ }: let cfg = config.programs.genemichaels; + opt = options.programs.genemichaels; configFormat = pkgs.formats.json { }; inherit (lib) @@ -123,10 +124,14 @@ in settingsFile = mkOption { description = "The configuration file used by `genemichaels`."; - type = types.path; + type = types.nullOr types.path; example = lib.literalExpression ''./.genemichaels.json''; - default = configFormat.generate ".genemichaels.json" cfg.settings; - defaultText = lib.literalMD "Generated JSON file from `${showOptionParent options.programs.genemichaels.settings.max_width 1}`"; + default = + let + settings = lib.filterAttrs (key: value: value != opt.settings.${key}.default) cfg.settings; + in + if settings != { } then configFormat.generate ".genemichaels.json" settings else null; + defaultText = lib.literalMD "Generated JSON file from `${showOptionParent opt.settings.max_width 1}`"; }; threadCount = mkOption { @@ -166,10 +171,10 @@ in "--thread-count" (toString cfg.threadCount) ]) - ++ [ + ++ (optionals (cfg.settingsFile != null) [ "--config" (toString cfg.settingsFile) - ]; + ]); includes = cfg.includes; excludes = cfg.excludes; };