From 3a6a93050910bb4a231a5a659fbf3317e0e947d2 Mon Sep 17 00:00:00 2001 From: Pancake Appletree <189892522+appleptree@users.noreply.github.com> Date: Sat, 2 May 2026 23:24:49 +0200 Subject: [PATCH 01/10] feat(wrapperModules.bat): init --- wrapperModules/b/bat/module.nix | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 wrapperModules/b/bat/module.nix diff --git a/wrapperModules/b/bat/module.nix b/wrapperModules/b/bat/module.nix new file mode 100644 index 00000000..d7c73133 --- /dev/null +++ b/wrapperModules/b/bat/module.nix @@ -0,0 +1,49 @@ +{ + config, + wlib, + lib, + pkgs, + ... +}: +{ + imports = [ wlib.modules.default ]; + + options = { + configFile = lib.mkOption { + type = wlib.types.file pkgs; + default.content = ""; + description = '' + Bat flags to include via config file + ''; + }; + themes = lib.mkOption { + type = lib.types.attrsOf (wlib.types.file pkgs); + default = { }; + description = '' + Bat themes to link to theme directory + ''; + }; + }; + + config = + let + themes-constructFiles = lib.concatMapAttrs (name: value: { + "themes-${name}" = { + content = builtins.readFile value.path; + relPath = "themes/${name}"; + }; + }) config.themes; + in + { + package = lib.mkDefault pkgs.bat; + env.BAT_CONFIG_DIR = "${placeholder "out"}/themes"; + constructFiles = { + generatedConfig = { + content = builtins.readFile config.configFile.path; + relPath = "${config.binName}-config/config"; + }; + } + // themes-constructFiles; + meta.maintainers = [ wlib.maintainers.appleptree ]; + }; +} From f445ed42144b07dceef7dd1b169c1b520564c68f Mon Sep 17 00:00:00 2001 From: Pancake Appletree <189892522+appleptree@users.noreply.github.com> Date: Sat, 2 May 2026 23:38:03 +0200 Subject: [PATCH 02/10] docs(wrapperModules.bat): Improve description of themes option --- wrapperModules/b/bat/module.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrapperModules/b/bat/module.nix b/wrapperModules/b/bat/module.nix index d7c73133..d2c500c7 100644 --- a/wrapperModules/b/bat/module.nix +++ b/wrapperModules/b/bat/module.nix @@ -20,7 +20,7 @@ type = lib.types.attrsOf (wlib.types.file pkgs); default = { }; description = '' - Bat themes to link to theme directory + Bat themes to copy to `themes/` directory ''; }; }; From c198f9ebbcc845fcae01dda54e2748b62b1f70b4 Mon Sep 17 00:00:00 2001 From: Pancake Appletree <189892522+appleptree@users.noreply.github.com> Date: Sun, 3 May 2026 00:21:15 +0200 Subject: [PATCH 03/10] fix(wrapperModules.bat): Correctly reference bat-config dir in env var --- wrapperModules/b/bat/module.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrapperModules/b/bat/module.nix b/wrapperModules/b/bat/module.nix index d2c500c7..77a6e5df 100644 --- a/wrapperModules/b/bat/module.nix +++ b/wrapperModules/b/bat/module.nix @@ -36,7 +36,7 @@ in { package = lib.mkDefault pkgs.bat; - env.BAT_CONFIG_DIR = "${placeholder "out"}/themes"; + env.BAT_CONFIG_DIR = "${placeholder "out"}/${config.binName}-config/themes"; constructFiles = { generatedConfig = { content = builtins.readFile config.configFile.path; From 45a3b963dbc61328fbb9718ce87191ba45ef62b5 Mon Sep 17 00:00:00 2001 From: Pancake Appletree <189892522+appleptree@users.noreply.github.com> Date: Sun, 3 May 2026 00:21:15 +0200 Subject: [PATCH 04/10] fix(wrapperModules.bat): Simplify setting of config file content --- wrapperModules/b/bat/module.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrapperModules/b/bat/module.nix b/wrapperModules/b/bat/module.nix index 77a6e5df..fe133d33 100644 --- a/wrapperModules/b/bat/module.nix +++ b/wrapperModules/b/bat/module.nix @@ -39,7 +39,7 @@ env.BAT_CONFIG_DIR = "${placeholder "out"}/${config.binName}-config/themes"; constructFiles = { generatedConfig = { - content = builtins.readFile config.configFile.path; + content = config.configFile.content; relPath = "${config.binName}-config/config"; }; } From c6367a774603b635648b1662f2e4f3ec8ad55827 Mon Sep 17 00:00:00 2001 From: Pancake Appletree <189892522+appleptree@users.noreply.github.com> Date: Sun, 3 May 2026 00:27:33 +0200 Subject: [PATCH 05/10] fix(wrapperModules.bat): Reference constructFiles in configFile option type --- wrapperModules/b/bat/module.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wrapperModules/b/bat/module.nix b/wrapperModules/b/bat/module.nix index fe133d33..65c2891f 100644 --- a/wrapperModules/b/bat/module.nix +++ b/wrapperModules/b/bat/module.nix @@ -10,7 +10,9 @@ options = { configFile = lib.mkOption { - type = wlib.types.file pkgs; + type = wlib.types.file { + path = lib.mkOptionDefault config.constructFiles.generatedConfig.path; + }; default.content = ""; description = '' Bat flags to include via config file From 7bf81a4b35beea769797483ad252b85d32c07b6f Mon Sep 17 00:00:00 2001 From: Pancake Appletree <189892522+appleptree@users.noreply.github.com> Date: Sun, 3 May 2026 01:19:50 +0200 Subject: [PATCH 06/10] fix(wrapperModules.bat): Correctly reference bat-config path in env var --- wrapperModules/b/bat/module.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrapperModules/b/bat/module.nix b/wrapperModules/b/bat/module.nix index 65c2891f..e924137b 100644 --- a/wrapperModules/b/bat/module.nix +++ b/wrapperModules/b/bat/module.nix @@ -38,7 +38,7 @@ in { package = lib.mkDefault pkgs.bat; - env.BAT_CONFIG_DIR = "${placeholder "out"}/${config.binName}-config/themes"; + env.BAT_CONFIG_DIR = "${placeholder "out"}/${config.binName}-config"; constructFiles = { generatedConfig = { content = config.configFile.content; From e7a99feff76340161babca5a4a958811fb289e58 Mon Sep 17 00:00:00 2001 From: Pancake Appletree <189892522+appleptree@users.noreply.github.com> Date: Sun, 3 May 2026 01:27:33 +0200 Subject: [PATCH 07/10] feat(wrapperModules.bat): Add syntaxes support --- wrapperModules/b/bat/module.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/wrapperModules/b/bat/module.nix b/wrapperModules/b/bat/module.nix index e924137b..dfda40ef 100644 --- a/wrapperModules/b/bat/module.nix +++ b/wrapperModules/b/bat/module.nix @@ -25,6 +25,13 @@ Bat themes to copy to `themes/` directory ''; }; + syntaxes = lib.mkOption { + type = lib.types.attrsOf (wlib.types.file pkgs); + default = { }; + description = '' + Bat/Sublime syntaxes to copy to `syntaxes/` directory + ''; + }; }; config = @@ -35,6 +42,12 @@ relPath = "themes/${name}"; }; }) config.themes; + syntaxes-constructFiles = lib.concatMapAttrs (name: value: { + "syntaxes-${name}" = { + content = builtins.readFile value.path; + relPath = "syntaxes/${name}"; + }; + }) config.syntaxes; in { package = lib.mkDefault pkgs.bat; @@ -45,7 +58,8 @@ relPath = "${config.binName}-config/config"; }; } - // themes-constructFiles; + // themes-constructFiles + // syntaxes-constructFiles; meta.maintainers = [ wlib.maintainers.appleptree ]; }; } From 1d4f2e80e207dbb6341b3cae8e92598dc6ae7d9d Mon Sep 17 00:00:00 2001 From: Pancake Appletree <189892522+appleptree@users.noreply.github.com> Date: Sun, 3 May 2026 01:46:07 +0200 Subject: [PATCH 08/10] feat(wrapperModules.bat): Accept paths forming strings in syntaxes option --- wrapperModules/b/bat/module.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrapperModules/b/bat/module.nix b/wrapperModules/b/bat/module.nix index dfda40ef..e2dd396c 100644 --- a/wrapperModules/b/bat/module.nix +++ b/wrapperModules/b/bat/module.nix @@ -26,7 +26,7 @@ ''; }; syntaxes = lib.mkOption { - type = lib.types.attrsOf (wlib.types.file pkgs); + type = lib.types.attrsOf lib.types.string; default = { }; description = '' Bat/Sublime syntaxes to copy to `syntaxes/` directory @@ -44,7 +44,7 @@ }) config.themes; syntaxes-constructFiles = lib.concatMapAttrs (name: value: { "syntaxes-${name}" = { - content = builtins.readFile value.path; + content = builtins.readFile value; relPath = "syntaxes/${name}"; }; }) config.syntaxes; From 0b4fc0422aba5fb7b48c4b47cba2c09f6b9d34a2 Mon Sep 17 00:00:00 2001 From: Pancake Appletree <189892522+appleptree@users.noreply.github.com> Date: Sun, 3 May 2026 07:33:55 +0200 Subject: [PATCH 09/10] feat(wrapperModules.bat): Change syntaxes option type to stringable --- wrapperModules/b/bat/module.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrapperModules/b/bat/module.nix b/wrapperModules/b/bat/module.nix index e2dd396c..aa487216 100644 --- a/wrapperModules/b/bat/module.nix +++ b/wrapperModules/b/bat/module.nix @@ -26,7 +26,7 @@ ''; }; syntaxes = lib.mkOption { - type = lib.types.attrsOf lib.types.string; + type = lib.types.attrsOf wlib.types.stringable; default = { }; description = '' Bat/Sublime syntaxes to copy to `syntaxes/` directory From 8bf6b77d6e64800fbbc3b48a68b533a73c1c41a2 Mon Sep 17 00:00:00 2001 From: Pancake Appletree <189892522+appleptree@users.noreply.github.com> Date: Sun, 3 May 2026 17:54:08 +0200 Subject: [PATCH 10/10] fix(wrapperModules.bat): Let accepting paths as syntaxes work without IFD --- wrapperModules/b/bat/module.nix | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/wrapperModules/b/bat/module.nix b/wrapperModules/b/bat/module.nix index aa487216..f3ba8987 100644 --- a/wrapperModules/b/bat/module.nix +++ b/wrapperModules/b/bat/module.nix @@ -29,7 +29,7 @@ type = lib.types.attrsOf wlib.types.stringable; default = { }; description = '' - Bat/Sublime syntaxes to copy to `syntaxes/` directory + Paths of bat/sublime syntaxes to symnlink to `syntaxes/` directory ''; }; }; @@ -42,12 +42,6 @@ relPath = "themes/${name}"; }; }) config.themes; - syntaxes-constructFiles = lib.concatMapAttrs (name: value: { - "syntaxes-${name}" = { - content = builtins.readFile value; - relPath = "syntaxes/${name}"; - }; - }) config.syntaxes; in { package = lib.mkDefault pkgs.bat; @@ -58,8 +52,12 @@ relPath = "${config.binName}-config/config"; }; } - // themes-constructFiles - // syntaxes-constructFiles; + // themes-constructFiles; + buildCommand.makeBatSyntaxes = + "mkdir -p ${placeholder "out"}/syntaxes\n" + + lib.concatMapAttrsStringSep "\n" ( + name: value: "ln -s ${value} ${placeholder "out"}/syntaxes/${name}" + ) config.syntaxes; meta.maintainers = [ wlib.maintainers.appleptree ]; }; }