From 6e9ef448dbd75d222e2da6267b5d045a016153d0 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Mon, 11 Aug 2025 23:02:50 +0200 Subject: [PATCH] feat(tmux): use soft secrets to handle sessions --- flake.lock | 6 +++--- hosts/morty/home-config.nix | 5 ++++- hosts/work/home-config.nix | 6 +----- modules/home-manager/cli/tmux/default.nix | 9 ++++----- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/flake.lock b/flake.lock index d6ca730..0932201 100644 --- a/flake.lock +++ b/flake.lock @@ -61,10 +61,10 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1754941966, - "narHash": "sha256-P+I9HIL6p+ySfsFR+3wQYOWouB3lXXeipMG7MYYWX9o=", + "lastModified": 1754945619, + "narHash": "sha256-kcvY8kUakGwUUWvk6mgIbp5Xj2ABsjj0oBcKQ3MtjTM=", "ref": "main", - "rev": "a1a559d8a00dbc4b00abd99f02f536c0f6027a32", + "rev": "6878e000fef8449ed6d640436a3bc630fa8788b2", "shallow": true, "type": "git", "url": "ssh://git@git.epha.se:24422/ephase/nix-private.git" diff --git a/hosts/morty/home-config.nix b/hosts/morty/home-config.nix index ed063e5..ae0d96c 100644 --- a/hosts/morty/home-config.nix +++ b/hosts/morty/home-config.nix @@ -25,7 +25,10 @@ git.enable = true; neovim.enable = true; starship.enable = true; - tmux.enable = true; + tmux = { + enable = true; + extraConfig = inputs.nix-private.tmux.personal; + }; utils.enable = true; vifm.enable = true; zellij.enable = true; diff --git a/hosts/work/home-config.nix b/hosts/work/home-config.nix index 03922d8..0712e15 100644 --- a/hosts/work/home-config.nix +++ b/hosts/work/home-config.nix @@ -26,12 +26,8 @@ starship.enable = true; tmux = { enable = true; - extraConfig = '' - bind -n M-F9 run 'create-tmux-session -n quipu -r quipuapp "run:nvim ." repo:quipu-infrastructure neww:quipu-infra p:sellsy hsplit:50 run:k9s repo:charts neww:charts' - bind -n M-F8 run 'create-tmux-session -n verifactu -r verifactu "run:nvim ." repo:verifactu-infrastructure neww:verifactu-infra repo:sellsy hsplit:50 run:k9s repo:charts neww:charts' - ''; + extraConfig = inputs.nix-private.tmux.work; }; - utils.enable = true; vifm.enable = true; zellij.enable = true; diff --git a/modules/home-manager/cli/tmux/default.nix b/modules/home-manager/cli/tmux/default.nix index a2748ba..1ff3293 100644 --- a/modules/home-manager/cli/tmux/default.nix +++ b/modules/home-manager/cli/tmux/default.nix @@ -1,5 +1,5 @@ -{ lib, config, pkgs, ... }: +{ lib, config, pkgs, inputs, ... }: with lib; let cfg = config.modules.cli.tmux; @@ -51,9 +51,6 @@ in bind -n M-F3 if 'tmux has-session -t 3' {switch-client -t 3} {display-popup -E -E 'create-tmux-session -i 3'} bind -n M-F4 if 'tmux has-session -t 4' {switch-client -t 4} {display-popup -E -E 'create-tmux-session -i 4'} - # Alt+F10 for launching my Nix project - bind -n M-F10 run 'create-tmux-session -n config -r nix "run:nvim ." vsplit:20' - # change window with Alt+{1..5} bind -n -N "Goto window 1" M-1 select-window -T -t 1 bind -n -N "Goto window 2" M-2 select-window -T -t 2 @@ -86,7 +83,9 @@ in set -g status-left-length 100 set -g status-left '#[bg=colour0, fg=colour6]  #S ' set -g status-right ' ' - '' + cfg.extraConfig; + '' + + inputs.nix-private.tmux.nix + + cfg.extraConfig; plugins = with pkgs; [ tmuxPlugins.tmux-fzf ];