mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36: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)
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -3,20 +3,7 @@
|
|||
enable = true;
|
||||
};
|
||||
|
||||
nmt.script =
|
||||
let
|
||||
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}
|
||||
'';
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/wezterm/wezterm.lua
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue