summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2016-12-18 14:04:31 +0100
committerDaiderd Jordan <daiderd@gmail.com>2016-12-18 14:04:31 +0100
commit15f19af0bb8e127668926bc0b2d0f3120bf94f54 (patch)
treec9766b5eee4713a9e3b731f3638f67322a43cedc /modules
parent732866d6b67a85d77e020029909546e5e55e72d4 (diff)
add environment.loginShell option
Diffstat (limited to 'modules')
-rw-r--r--modules/environment/default.nix8
-rw-r--r--modules/programs/bash.nix1
-rw-r--r--modules/programs/tmux.nix31
-rw-r--r--modules/programs/zsh.nix1
4 files changed, 31 insertions, 10 deletions
diff --git a/modules/environment/default.nix b/modules/environment/default.nix
index 5644264..d5cd419 100644
--- a/modules/environment/default.nix
+++ b/modules/environment/default.nix
@@ -60,6 +60,14 @@ in {
description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
};
+ environment.loginShell = mkOption {
+ type = types.str;
+ default = "$SHELL";
+ description = ''
+ Configure default login shell.
+ '';
+ };
+
environment.variables = mkOption {
type = types.attrsOf (types.either types.str (types.listOf types.str));
default = {};
diff --git a/modules/programs/bash.nix b/modules/programs/bash.nix
index 7a021ff..5317a23 100644
--- a/modules/programs/bash.nix
+++ b/modules/programs/bash.nix
@@ -56,6 +56,7 @@ in
pkgs.bash
];
+ environment.loginShell = mkDefault "${shell}/bin/bash -l";
environment.variables.SHELL = mkDefault "${shell}/bin/bash";
environment.etc."bashrc".text = ''
diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix
index dc233fb..259a204 100644
--- a/modules/programs/tmux.nix
+++ b/modules/programs/tmux.nix
@@ -8,6 +8,20 @@ let
cfg = config.programs.tmux;
+ tmux = pkgs.runCommand pkgs.tmux.name
+ { buildInputs = [ pkgs.makeWrapper ]; }
+ ''
+ source $stdenv/setup
+
+ mkdir -p $out/bin
+ makeWrapper ${pkgs.tmux}/bin/tmux $out/bin/tmux \
+ --set __ETC_BASHRC_SOURCED "" \
+ --set __ETC_ZPROFILE_SOURCED "" \
+ --set __ETC_ZSHENV_SOURCED "" \
+ --set __ETC_ZSHRC_SOURCED "" \
+ --add-flags -f --add-flags /etc/tmux.conf
+ '';
+
text = import ../system/write-text.nix {
inherit lib;
mkTextDerivation = name: text: pkgs.writeText "tmux-options-${name}" text;
@@ -34,14 +48,6 @@ in {
'';
};
- programs.tmux.loginShell = mkOption {
- type = types.str;
- default = "$SHELL";
- description = ''
- Configure default login shell for tmux.
- '';
- };
-
programs.tmux.enableSensible = mkOption {
type = types.bool;
default = false;
@@ -93,6 +99,11 @@ in {
config = mkIf cfg.enable {
+ environment.systemPackages =
+ [ # Include wrapped tmux package.
+ tmux
+ ];
+
environment.etc."tmux.conf".text = ''
${tmuxOptions}
${cfg.tmuxConfig}
@@ -101,9 +112,9 @@ in {
'';
programs.tmux.tmuxOptions.login-shell.text = if stdenv.isDarwin then ''
- set -g default-command "reattach-to-user-namespace ${cfg.loginShell}"
+ set -g default-command "reattach-to-user-namespace ${config.environment.loginShell}"
'' else ''
- set -g default-command "${cfg.loginShell}"
+ set -g default-command "${config.environment.loginShell}"
'';
programs.tmux.tmuxOptions.sensible.text = mkIf cfg.enableSensible ''
diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix
index aeea21d..0417365 100644
--- a/modules/programs/zsh.nix
+++ b/modules/programs/zsh.nix
@@ -128,6 +128,7 @@ in
pkgs.zsh
];
+ environment.loginShell = mkDefault "${shell}/bin/zsh -l";
environment.variables.SHELL = mkDefault "${shell}/bin/zsh";
environment.etc."zshenv".text = ''