wezterm: don't create config if extraConfig is empty, and don't create one by default (#6908)
Tests updated to check the file wasn't created when no config is provided.
This commit is contained in:
parent
98f4fef7fd
commit
542078066b
2 changed files with 11 additions and 24 deletions
|
|
@ -9,6 +9,7 @@ let
|
|||
inherit (lib)
|
||||
literalExpression
|
||||
mkIf
|
||||
mkMerge
|
||||
mkEnableOption
|
||||
mkOption
|
||||
types
|
||||
|
|
@ -35,9 +36,7 @@ in
|
|||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = ''
|
||||
return {}
|
||||
'';
|
||||
default = "";
|
||||
example = literalExpression ''
|
||||
-- Your lua code / config here
|
||||
local mylib = require 'mylib';
|
||||
|
|
@ -100,8 +99,8 @@ in
|
|||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile =
|
||||
{
|
||||
xdg.configFile = mkMerge [
|
||||
(mkIf (cfg.extraConfig != "") {
|
||||
"wezterm/wezterm.lua".text = ''
|
||||
-- Generated by Home Manager.
|
||||
-- See https://wezfurlong.org/wezterm/
|
||||
|
|
@ -110,13 +109,14 @@ in
|
|||
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
}
|
||||
// lib.mapAttrs' (
|
||||
})
|
||||
(lib.mapAttrs' (
|
||||
name: value:
|
||||
lib.nameValuePair "wezterm/colors/${name}.toml" {
|
||||
source = tomlFormat.generate "${name}.toml" { colors = value; };
|
||||
}
|
||||
) cfg.colorSchemes;
|
||||
) cfg.colorSchemes)
|
||||
];
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration shellIntegrationStr;
|
||||
programs.zsh.initContent = mkIf cfg.enableZshIntegration shellIntegrationStr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue