mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-05 08:17:01 +00:00
add environment.loginShell option
This commit is contained in:
parent
732866d6b6
commit
15f19af0bb
4 changed files with 31 additions and 10 deletions
|
@ -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 = {};
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
|
@ -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 ''
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
Loading…
Add table
Reference in a new issue