mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-15 21:08:21 +00:00
add programs.tmux.loginShell option
This commit is contained in:
parent
a31cda3b84
commit
ccedaf9aea
2 changed files with 41 additions and 15 deletions
30
config.nix
30
config.nix
|
@ -33,15 +33,16 @@ let
|
||||||
];
|
];
|
||||||
|
|
||||||
launchd.daemons.nix-daemon =
|
launchd.daemons.nix-daemon =
|
||||||
{ serviceConfig.Program = "/nix/var/nix/profiles/default/bin/nix-daemon";
|
{ serviceConfig.Program = "${pkgs.nix}/bin/nix-daemon";
|
||||||
serviceConfig.KeepAlive = true;
|
serviceConfig.KeepAlive = true;
|
||||||
serviceConfig.RunAtLoad = true;
|
serviceConfig.RunAtLoad = true;
|
||||||
serviceConfig.EnvironmentVariables.SSL_CERT_FILE = "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt";
|
serviceConfig.EnvironmentVariables.SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||||
serviceConfig.EnvironmentVariables.TMPDIR = "/nix/tmp";
|
serviceConfig.EnvironmentVariables.TMPDIR = "/nix/tmp";
|
||||||
serviceConfig.SoftResourceLimits.NumberOfFiles = 4096;
|
serviceConfig.SoftResourceLimits.NumberOfFiles = 4096;
|
||||||
serviceConfig.ProcessType = "Background";
|
serviceConfig.ProcessType = "Background";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.tmux.loginShell = "${pkgs.zsh}/bin/zsh";
|
||||||
programs.tmux.enableSensible = true;
|
programs.tmux.enableSensible = true;
|
||||||
programs.tmux.enableMouse = true;
|
programs.tmux.enableMouse = true;
|
||||||
programs.tmux.enableVim = true;
|
programs.tmux.enableVim = true;
|
||||||
|
@ -49,14 +50,16 @@ let
|
||||||
environment.variables.EDITOR = "vim";
|
environment.variables.EDITOR = "vim";
|
||||||
environment.variables.HOMEBREW_CASK_OPTS = "--appdir=/Applications/cask";
|
environment.variables.HOMEBREW_CASK_OPTS = "--appdir=/Applications/cask";
|
||||||
|
|
||||||
environment.variables.GIT_SSL_CAINFO = "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt";
|
environment.variables.GIT_SSL_CAINFO = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||||
environment.variables.SSL_CERT_FILE = "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt";
|
environment.variables.SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||||
|
|
||||||
environment.shellAliases.l = "ls -lh";
|
environment.shellAliases.l = "ls -lh";
|
||||||
environment.shellAliases.ls = "ls -G";
|
environment.shellAliases.ls = "ls -G";
|
||||||
|
environment.shellAliases.tmux = "${pkgs.tmux}/bin/tmux -f ${config.environment.etc."tmux.conf".source}";
|
||||||
|
environment.shellAliases.zsh = "${pkgs.zsh}/bin/zsh";
|
||||||
|
|
||||||
environment.etc."tmux.conf".text = ''
|
environment.etc."tmux.conf".text = ''
|
||||||
source-file ${config.system.build.setTmuxOptions}
|
${config.programs.tmux.config}
|
||||||
bind 0 set status
|
bind 0 set status
|
||||||
|
|
||||||
set -g status-bg black
|
set -g status-bg black
|
||||||
|
@ -100,6 +103,9 @@ let
|
||||||
|
|
||||||
export NIX_PATH=nixpkgs=$HOME/.nix-defexpr/nixpkgs
|
export NIX_PATH=nixpkgs=$HOME/.nix-defexpr/nixpkgs
|
||||||
|
|
||||||
|
typeset -U NIX_PATH
|
||||||
|
typeset -U PATH
|
||||||
|
|
||||||
# Set up secure multi-user builds: non-root users build through the
|
# Set up secure multi-user builds: non-root users build through the
|
||||||
# Nix daemon.
|
# Nix daemon.
|
||||||
if [ "$USER" != root -a ! -w /nix/var/nix/db ]; then
|
if [ "$USER" != root -a ! -w /nix/var/nix/db ]; then
|
||||||
|
@ -107,13 +113,13 @@ let
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nixdarwin-rebuild () {
|
nixdarwin-rebuild () {
|
||||||
case $1 in
|
case $1 in
|
||||||
'build') nix-build --no-out-link '<nixpkgs>' -A nixdarwin.toplevel ;;
|
'build') nix-build --no-out-link '<nixpkgs>' -A nixdarwin.toplevel ;;
|
||||||
'repl') nix-repl "$HOME/.nixpkgs/config.nix" ;;
|
'repl') nix-repl "$HOME/.nixpkgs/config.nix" ;;
|
||||||
'shell') nix-shell '<nixpkgs>' -p nixdarwin.toplevel --run "zsh -l" ;;
|
'shell') nix-shell '<nixpkgs>' -p nixdarwin.toplevel --run "${pkgs.zsh}/bin/zsh -l" ;;
|
||||||
'switch') nix-env -f '<nixpkgs>' -iA nixdarwin.toplevel && nix-shell '<nixpkgs>' -A nixdarwin.toplevel --run 'sudo $out/activate' && exec zsh -l ;;
|
'switch') nix-env -f '<nixpkgs>' -iA nixdarwin.toplevel && nix-shell '<nixpkgs>' -A nixdarwin.toplevel --run 'sudo $out/activate' && exec ${pkgs.zsh}/bin/zsh -l ;;
|
||||||
"") return 1 ;;
|
"") return 1 ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
source $HOME/.zshrc.local
|
source $HOME/.zshrc.local
|
||||||
|
|
|
@ -14,6 +14,14 @@ let
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
|
programs.tmux.loginShell = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "$SHELL";
|
||||||
|
description = ''
|
||||||
|
Configure default login shell.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
programs.tmux.enableSensible = mkOption {
|
programs.tmux.enableSensible = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -41,9 +49,16 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.tmux.config = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
description = ''
|
||||||
|
Configuration options.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
programs.tmux.text = mkOption {
|
programs.tmux.text = mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
type = types.attrsOf types.str;
|
type = types.attrsOf types.lines;
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,8 +66,13 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
system.build.setTmuxOptions = pkgs.writeText "set-tmux-options"
|
programs.tmux.config = lib.concatStringsSep "\n" tmuxConfigs;
|
||||||
(lib.concatStringsSep "\n" tmuxConfigs);
|
|
||||||
|
programs.tmux.text.login-shell = if stdenv.isDarwin then ''
|
||||||
|
set -g default-command "reattach-to-user-namespace -l ${cfg.loginShell}"
|
||||||
|
'' else ''
|
||||||
|
set -g default-command "${cfg.loginShell}"
|
||||||
|
'';
|
||||||
|
|
||||||
programs.tmux.text.sensible = mkIf cfg.enableSensible (''
|
programs.tmux.text.sensible = mkIf cfg.enableSensible (''
|
||||||
set -g default-terminal "screen-256color"
|
set -g default-terminal "screen-256color"
|
||||||
|
|
Loading…
Add table
Reference in a new issue