cleanup nix setup

This commit is contained in:
elkowar 2020-08-11 16:25:46 +02:00
parent f5b202f0ce
commit b3eaf2bb34
7 changed files with 145 additions and 97 deletions

View file

@ -1 +1 @@
/nix/store/spsy6k9bx1rvrfqwmd848r2j6pw1w3bi-home-manager-files/.config/htop/htoprc
/nix/store/v0n44jjhbc1jh715dysni16gyskaf3g4-home-manager-files/.config/htop/htoprc

View file

@ -0,0 +1,19 @@
{ config, lib, pkgs, ... }:
let
cfg = config.elkowar.generalConfig;
myConf = import ../myConfig.nix;
in
{
options.elkowar.generalConfig = with lib; {
shellAliases = lib.mkOption {
type = types.attrsOf types.str;
default = {};
description = ''
A map of aliases that will get applied to zsh and fish configuration.
'';
};
};
config = {
programs.zsh.shellAliases = cfg.shellAliases;
};
}

View file

@ -1,42 +1,54 @@
{ myConf, pkgs ? import <nixpkgs> }:
{ config, lib, pkgs, ... }:
let
cfg = config.elkowar.programs.tmux;
myConf = import ../myConfig.nix;
in
{
enable = true;
clock24 = true;
historyLimit = 10000;
keyMode = "vi";
shortcut = "y";
terminal = "tmux-256color";
customPaneNavigationAndResize = true;
extraConfig = ''
bind v split-window -h -c "#{pane_current_oath}"
bind b split-window -v -c "#{pane_current_oath}"
bind c new-window -c "#{pane_current_path}"
unbind '"'
unbind %
set -g mouse on
options.elkowar.programs.tmux = {
enable = lib.mkEnableOption "Enable the tmux configuration";
};
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
unbind [
bind < copy-mode
unbind p
bind > paste-buffer
bind-key C-a set -g status off
bind-key C-s set -g status on
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -M -X copy-pipe 'xclip -in -selection clipboard'
config = lib.mkIf cfg.enable {
programs.tmux = {
enable = true;
clock24 = true;
historyLimit = 10000;
keyMode = "vi";
shortcut = "y";
terminal = "tmux-256color";
customPaneNavigationAndResize = true;
extraConfig = ''
bind v split-window -h -c "#{pane_current_oath}"
bind b split-window -v -c "#{pane_current_oath}"
bind c new-window -c "#{pane_current_path}"
unbind '"'
unbind %
set -g mouse on
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none
'';
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
unbind [
bind < copy-mode
unbind p
bind > paste-buffer
bind-key C-a set -g status off
bind-key C-s set -g status on
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -M -X copy-pipe 'xclip -in -selection clipboard'
plugins = with pkgs.tmuxPlugins; [
{
plugin = prefix-highlight;
}
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none
'';
];
plugins = with pkgs.tmuxPlugins; [
{
plugin = prefix-highlight;
}
];
};
};
}

View file

@ -1,5 +1,11 @@
{ myConf, pkgs ? import <nixpkgs> }:
{ config, lib, pkgs, ... }:
let
cfg = config.elkowar.programs.zsh;
myConf = import ../myConfig.nix;
makeAbbrs = with builtins; abbrs: concatStringsSep "\n"
(
attrValues
@ -96,31 +102,36 @@ let
in
{
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
dotDir = ".config/zsh";
#defaultKeymap = "viins";
history = {
save = 10000;
share = false;
extended = true;
ignoreDups = true;
ignoreSpace = true;
options.elkowar.programs.zsh = {
enable = lib.mkEnableOption "ZSH configuration";
};
config = {
programs.zsh = {
enable = true;
localVariables = {
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "bg=${myConf.colors.accentDark}"; # why does this not work D:
ZSH_AUTOSUGGEST_USE_ASYNC = 1;
};
shellAliases = {
ls = "exa --icons";
};
enableAutosuggestions = true;
enableCompletion = true;
dotDir = ".config/zsh";
#defaultKeymap = "viins";
history = {
save = 10000;
share = false;
extended = true;
ignoreDups = true;
ignoreSpace = true;
};
initExtraBeforeCompInit = ''
localVariables = {
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "bg=${myConf.colors.accentDark}"; # why does this not work D:
ZSH_AUTOSUGGEST_USE_ASYNC = 1;
};
shellAliases = {
ls = "exa --icons";
};
initExtraBeforeCompInit = ''
zstyle ':completion:*' menu select
zstyle ':completion::complete:*' gain-privileges 1
@ -131,44 +142,46 @@ in
fpath+=( /usr/share/zsh/site-functions/ )
'';
initExtra = ''
export MANPAGER='nvim +Man! +"set nocul" +"set noshowcmd" +"set noruler" +"set noshowmode" +"set laststatus=2" +"set statusline=\ %t"'
export MANPAGER='nvim +Man! +"set nocul" +"set noshowcmd" +"set noruler" +"set noshowmode" +"set laststatus=0"'
initExtra = ''
export MANPAGER='nvim +Man! +"set nocul" +"set noshowcmd" +"set noruler" +"set noshowmode" +"set laststatus=2" +"set statusline=\ %t"'
export MANPAGER='nvim +Man! +"set nocul" +"set noshowcmd" +"set noruler" +"set noshowmode" +"set laststatus=0"'
setopt nobeep
setopt nobeep
setopt HIST_IGNORE_ALL_DUPS
autoload -Uz colors && colors
autoload -Uz promptinit && promptinit
setopt HIST_IGNORE_ALL_DUPS
autoload -Uz colors && colors
autoload -Uz promptinit && promptinit
#_comp_options+=(globdots)
#_comp_options+=(globdots)
# enable cdr command
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs
# enable cdr command
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs
# deer is a ranger-style file manager directly in the shell that doesn't fully context-switch
#source ~/nixpkgs/config/deer.zsh
#zle -N deer
#bindkey '\ek' deer
# deer is a ranger-style file manager directly in the shell that doesn't fully context-switch
#source ~/nixpkgs/config/deer.zsh
#zle -N deer
#bindkey '\ek' deer
${fzf-tab-stuff}
${fixedKeybinds}
${abbrs}
${manFunction}
${fzf-tab-stuff}
${fixedKeybinds}
${abbrs}
${manFunction}
${builtins.readFile ./prompt.zsh}
'';
${builtins.readFile ./prompt.zsh}
'';
plugins = let
sources = import ./zsh/nix/sources.nix;
in
[
{ name = "fzf-tab"; src = sources.fzf-tab; }
{ name = "zsh-autosuggestions"; src = sources.zsh-autosuggestions; }
{ name = "history-substring-search"; src = sources.zsh-history-substring-search; }
{ name = "zsh-abbr"; src = sources.zsh-abbr; }
{ name = "fast-syntax-highlighting"; src = sources.fast-syntax-highlighting; }
];
plugins = let
sources = import ./zsh/nix/sources.nix;
in
[
{ name = "fzf-tab"; src = sources.fzf-tab; }
{ name = "zsh-autosuggestions"; src = sources.zsh-autosuggestions; }
{ name = "history-substring-search"; src = sources.zsh-history-substring-search; }
{ name = "zsh-abbr"; src = sources.zsh-abbr; }
{ name = "fast-syntax-highlighting"; src = sources.fast-syntax-highlighting; }
];
};
};
}

View file

@ -31,10 +31,6 @@ in
desktop.enable = true;
};
gtk = import ./config/gtk.nix { inherit pkgs; inherit myConf; };
imports = [ ./profiles/base.nix ./profiles/desktop.nix ];
}

View file

@ -10,7 +10,15 @@ in
#useZsh = lib.mkEnableOption
};
imports = [ ../config/tmux.nix ../config/generalConfig.nix ../config/zsh.nix ];
config = lib.mkIf cfg.enable {
elkowar.programs.tmux.enable = true;
elkowar.programs.zsh.enable = true;
elkowar.generalConfig.shellAliases = {
gc = "git commit";
};
home.packages = with pkgs; [
direnv
rnix-lsp
@ -29,15 +37,13 @@ in
fd
jq
(import (fetchTarball https://github.com/lf-/nix-doc/archive/main.tar.gz) {})
#(import (fetchTarball https://github.com/lf-/nix-doc/archive/main.tar.gz) {})
];
programs = {
home-manager.enable = true;
htop.enable = true;
zsh = import ../config/zsh.nix { inherit pkgs; inherit myConf; };
tmux = import ../config/tmux.nix { inherit pkgs; inherit myConf; };
fzf = {
enable = true;
enableFishIntegration = true;

View file

@ -11,6 +11,8 @@ in
config = lib.mkIf cfg.enable {
gtk = import ../config/gtk.nix { inherit pkgs; inherit myConf; };
home.packages = with pkgs; [
elkowar_local.bashtop
elkowar_local.liquidctl