Commit bdf2918c8fa7

Vincent Demeester <vincent@sbr.pm>
2018-11-01 13:33:22
profiles: add tmux and enable it by default
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 8a3255b
Changed files (5)
tmux/keybindings → modules/profiles/assets/tmux/keybindings
File renamed without changes
tmux/tmux.conf → modules/profiles/assets/tmux/tmux.conf
File renamed without changes
modules/profiles/tmux.nix
@@ -0,0 +1,34 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.profiles.tmux;
+in
+{
+  options = {
+    profiles.tmux = {
+      enable = mkOption {
+        default = true;
+        description = "Enable tmux profile and configuration";
+        type = types.bool;
+      };
+    };
+  };
+  config = mkIf cfg.enable {
+    home.file.".tmux.conf".text = ''
+      source-file $HOME/.config/tmux/tmux.conf
+      set-environment -g TMUX_PLUGIN_MANAGER_PATH '$HOME/.config/tmux/plugins'
+
+      set -g @plugin 'tmux-plugins/tpm'
+      set -g @plugin 'tmux-plugins/tmux-resurrect'
+      set -g @plugin 'tmux-plugins/tmux-continuum'
+      set -g @plugin 'tmux-plugins/tmux-copycat'
+
+      set -g @continuum-restore 'on'
+
+      run '${pkgs.tmux-tpm}/tpm'
+    '';
+    xdg.configFile."tmux/tmux.conf".source = ./assets/tmux/tmux.conf;
+    xdg.configFile."tmux/commons/keybindings".source = ./assets/tmux/keybindings;
+  };
+}
modules/module-list.nix
@@ -7,6 +7,7 @@
     ./profiles/ssh.nix
     ./profiles/fish.nix
     ./profiles/i3.nix
+    ./profiles/tmux.nix
     ./services/shairport-sync.nix
   ];
 }
base.nix
@@ -3,7 +3,7 @@
 let home_directory = builtins.getEnv "HOME"; in
 
 rec {
-imports = [ modules/module-list.nix ];
+  imports = [ modules/module-list.nix ];
   programs = {
     home-manager = {
       enable = true;
@@ -11,21 +11,6 @@ imports = [ modules/module-list.nix ];
     };
   };
   home.file.".nix-channels".source = ./nix-channels;
-  home.file.".tmux.conf".text = ''
-    source-file $HOME/.config/tmux/tmux.conf
-    set-environment -g TMUX_PLUGIN_MANAGER_PATH '$HOME/.config/tmux/plugins'
-
-    set -g @plugin 'tmux-plugins/tpm'
-    set -g @plugin 'tmux-plugins/tmux-resurrect'
-    set -g @plugin 'tmux-plugins/tmux-continuum'
-    set -g @plugin 'tmux-plugins/tmux-copycat'
-
-    set -g @continuum-restore 'on'
-
-    run '${pkgs.tmux-tpm}/tpm'
-'';
-  xdg.configFile."tmux/tmux.conf".source = ./tmux/tmux.conf;
-  xdg.configFile."tmux/commons/keybindings".source = ./tmux/keybindings;
   home.packages = with pkgs; [
     scripts
     direnv