mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
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)
|
inherit (lib)
|
||||||
literalExpression
|
literalExpression
|
||||||
mkIf
|
mkIf
|
||||||
|
mkMerge
|
||||||
mkEnableOption
|
mkEnableOption
|
||||||
mkOption
|
mkOption
|
||||||
types
|
types
|
||||||
|
|
@ -35,9 +36,7 @@ in
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = ''
|
default = "";
|
||||||
return {}
|
|
||||||
'';
|
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
-- Your lua code / config here
|
-- Your lua code / config here
|
||||||
local mylib = require 'mylib';
|
local mylib = require 'mylib';
|
||||||
|
|
@ -100,8 +99,8 @@ in
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [ cfg.package ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
xdg.configFile =
|
xdg.configFile = mkMerge [
|
||||||
{
|
(mkIf (cfg.extraConfig != "") {
|
||||||
"wezterm/wezterm.lua".text = ''
|
"wezterm/wezterm.lua".text = ''
|
||||||
-- Generated by Home Manager.
|
-- Generated by Home Manager.
|
||||||
-- See https://wezfurlong.org/wezterm/
|
-- See https://wezfurlong.org/wezterm/
|
||||||
|
|
@ -110,13 +109,14 @@ in
|
||||||
|
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
}
|
})
|
||||||
// lib.mapAttrs' (
|
(lib.mapAttrs' (
|
||||||
name: value:
|
name: value:
|
||||||
lib.nameValuePair "wezterm/colors/${name}.toml" {
|
lib.nameValuePair "wezterm/colors/${name}.toml" {
|
||||||
source = tomlFormat.generate "${name}.toml" { colors = value; };
|
source = tomlFormat.generate "${name}.toml" { colors = value; };
|
||||||
}
|
}
|
||||||
) cfg.colorSchemes;
|
) cfg.colorSchemes)
|
||||||
|
];
|
||||||
|
|
||||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration shellIntegrationStr;
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration shellIntegrationStr;
|
||||||
programs.zsh.initContent = mkIf cfg.enableZshIntegration shellIntegrationStr;
|
programs.zsh.initContent = mkIf cfg.enableZshIntegration shellIntegrationStr;
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,7 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script =
|
nmt.script = ''
|
||||||
let
|
assertPathNotExists home-files/.config/wezterm/wezterm.lua
|
||||||
expected = builtins.toFile "wezterm.lua" ''
|
'';
|
||||||
-- Generated by Home Manager.
|
|
||||||
-- See https://wezfurlong.org/wezterm/
|
|
||||||
|
|
||||||
local wezterm = require 'wezterm'
|
|
||||||
|
|
||||||
return {}
|
|
||||||
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
''
|
|
||||||
assertFileExists home-files/.config/wezterm/wezterm.lua
|
|
||||||
assertFileContent home-files/.config/wezterm/wezterm.lua ${expected}
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue