add enable option for programs.tmux

This commit is contained in:
Daiderd Jordan 2016-12-12 23:38:53 +01:00
parent 2af32bbcfe
commit d24886a648
No known key found for this signature in database
GPG key ID: D02435D05B810C96
3 changed files with 17 additions and 14 deletions

View file

@ -1,8 +1,7 @@
{ config, lib, pkgs, ... }:
{
environment.systemPackages =
[ pkgs.lnl.zsh
pkgs.lnl.tmux
[ pkgs.lnl.tmux
pkgs.lnl.vim
pkgs.curl
@ -24,7 +23,8 @@
system.defaults.global.InitialKeyRepeat = 10;
system.defaults.global.KeyRepeat = 1;
programs.tmux.loginShell = "${pkgs.lnl.zsh}/bin/zsh -l";
programs.tmux.enable = true;
programs.tmux.loginShell = "${config.programs.zsh.shell} -l";
programs.tmux.enableSensible = true;
programs.tmux.enableMouse = true;
programs.tmux.enableFzf = true;
@ -38,7 +38,6 @@
'';
programs.zsh.enable = true;
programs.zsh.shell = "${pkgs.lnl.zsh}/bin/zsh";
programs.zsh.shellInit = ''
export NIX_PATH=nixpkgs=$HOME/.nix-defexpr/nixpkgs:darwin=$HOME/.nix-defexpr/darwin:darwin-config=$HOME/.nixpkgs/darwin-config.nix:$HOME/.nix-defexpr/channels_root
@ -121,15 +120,6 @@
nixpkgs.config.allowUnfree = true;
nixpkgs.config.packageOverrides = self: {
lnl.zsh = pkgs.runCommand pkgs.zsh.name
{ buildInputs = [ pkgs.makeWrapper ]; }
''
source $stdenv/setup
mkdir -p $out/bin
makeWrapper ${pkgs.zsh}/bin/zsh $out/bin/zsh
'';
lnl.tmux = pkgs.runCommand pkgs.tmux.name
{ buildInputs = [ pkgs.makeWrapper ]; }
''

View file

@ -26,6 +26,14 @@ let
in {
options = {
programs.tmux.enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to configure tmux.
'';
};
programs.tmux.loginShell = mkOption {
type = types.path;
default = "$SHELL";
@ -83,7 +91,7 @@ in {
};
config = {
config = mkIf cfg.enable {
programs.tmux.tmuxOptions.login-shell.text = if stdenv.isDarwin then ''
set -g default-command "reattach-to-user-namespace ${cfg.loginShell}"

View file

@ -64,6 +64,11 @@ in
config = mkIf cfg.enable {
environment.systemPackages =
[ # Include zsh package
pkgs.zsh
];
environment.variables.SHELL = "${cfg.shell}";
environment.etc."zshenv".text = ''