From e00dd0d7d2565a9d79c3826b088bef039624382e Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Fri, 23 Apr 2021 02:25:13 -0500 Subject: [PATCH] programs.tmux: use xdg config path (#1928) Tmux 3.2 includes support to use `$XDG_CONFIG_HOME/tmux/tmux.conf` as well as `~/.config/tmux/tmux.conf` for configuration file. --- modules/programs/tmux.nix | 7 +++---- tests/modules/programs/tmux/default-shell.nix | 4 ++-- .../modules/programs/tmux/disable-confirmation-prompt.nix | 4 ++-- tests/modules/programs/tmux/emacs-with-plugins.nix | 6 ++++-- tests/modules/programs/tmux/not-enabled.nix | 2 +- tests/modules/programs/tmux/prefix.nix | 4 ++-- tests/modules/programs/tmux/shortcut-without-prefix.nix | 4 ++-- tests/modules/programs/tmux/vi-all-true.nix | 4 ++-- 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix index 295df490a..8628155b8 100644 --- a/modules/programs/tmux.nix +++ b/modules/programs/tmux.nix @@ -109,7 +109,7 @@ let } )]; - home.file.".tmux.conf".text = '' + xdg.configFile."tmux/tmux.conf".text = '' # ============================================= # # Load plugins with Home Manager # # --------------------------------------------- # @@ -335,10 +335,9 @@ in }; }) - # config file ~/.tmux.conf - { home.file.".tmux.conf".text = mkBefore tmuxConf; } + { xdg.configFile."tmux/tmux.conf".text = mkBefore tmuxConf; } (mkIf (cfg.plugins != []) configPlugins) - { home.file.".tmux.conf".text = mkAfter cfg.extraConfig; } + { xdg.configFile."tmux/tmux.conf".text = mkAfter cfg.extraConfig; } ]) ); } diff --git a/tests/modules/programs/tmux/default-shell.nix b/tests/modules/programs/tmux/default-shell.nix index 05091c6ab..af05eb0e7 100644 --- a/tests/modules/programs/tmux/default-shell.nix +++ b/tests/modules/programs/tmux/default-shell.nix @@ -19,8 +19,8 @@ in { }; nmt.script = '' - assertFileExists home-files/.tmux.conf - assertFileContent home-files/.tmux.conf \ + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf \ ${substituteExpected ./default-shell.conf} ''; }; diff --git a/tests/modules/programs/tmux/disable-confirmation-prompt.nix b/tests/modules/programs/tmux/disable-confirmation-prompt.nix index 9c65ad6ee..aec1f66cf 100644 --- a/tests/modules/programs/tmux/disable-confirmation-prompt.nix +++ b/tests/modules/programs/tmux/disable-confirmation-prompt.nix @@ -18,8 +18,8 @@ with lib; ]; nmt.script = '' - assertFileExists home-files/.tmux.conf - assertFileContent home-files/.tmux.conf \ + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf \ ${./disable-confirmation-prompt.conf} ''; }; diff --git a/tests/modules/programs/tmux/emacs-with-plugins.nix b/tests/modules/programs/tmux/emacs-with-plugins.nix index f9bccaa2c..4a0382d8d 100644 --- a/tests/modules/programs/tmux/emacs-with-plugins.nix +++ b/tests/modules/programs/tmux/emacs-with-plugins.nix @@ -42,8 +42,10 @@ with lib; ]; nmt.script = '' - assertFileExists home-files/.tmux.conf - assertFileContent home-files/.tmux.conf ${./emacs-with-plugins.conf} + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf ${ + ./emacs-with-plugins.conf + } ''; }; } diff --git a/tests/modules/programs/tmux/not-enabled.nix b/tests/modules/programs/tmux/not-enabled.nix index b7c675a83..d5f08b36f 100644 --- a/tests/modules/programs/tmux/not-enabled.nix +++ b/tests/modules/programs/tmux/not-enabled.nix @@ -7,7 +7,7 @@ with lib; programs.tmux = { enable = false; }; nmt.script = '' - assertPathNotExists home-files/.tmux.conf + assertPathNotExists home-files/.config/tmux/tmux.conf ''; }; } diff --git a/tests/modules/programs/tmux/prefix.nix b/tests/modules/programs/tmux/prefix.nix index 80ed69640..9f97940e7 100644 --- a/tests/modules/programs/tmux/prefix.nix +++ b/tests/modules/programs/tmux/prefix.nix @@ -18,8 +18,8 @@ with lib; ]; nmt.script = '' - assertFileExists home-files/.tmux.conf - assertFileContent home-files/.tmux.conf \ + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf \ ${./prefix.conf} ''; }; diff --git a/tests/modules/programs/tmux/shortcut-without-prefix.nix b/tests/modules/programs/tmux/shortcut-without-prefix.nix index 52290c4fc..5c294ef97 100644 --- a/tests/modules/programs/tmux/shortcut-without-prefix.nix +++ b/tests/modules/programs/tmux/shortcut-without-prefix.nix @@ -19,8 +19,8 @@ with lib; ]; nmt.script = '' - assertFileExists home-files/.tmux.conf - assertFileContent home-files/.tmux.conf \ + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf \ ${./shortcut-without-prefix.conf} ''; }; diff --git a/tests/modules/programs/tmux/vi-all-true.nix b/tests/modules/programs/tmux/vi-all-true.nix index bce032fd6..8b9cf1a36 100644 --- a/tests/modules/programs/tmux/vi-all-true.nix +++ b/tests/modules/programs/tmux/vi-all-true.nix @@ -22,8 +22,8 @@ with lib; ]; nmt.script = '' - assertFileExists home-files/.tmux.conf - assertFileContent home-files/.tmux.conf ${./vi-all-true.conf} + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf ${./vi-all-true.conf} ''; }; }