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; options.elkowar.programs.tmux = {
clock24 = true; enable = lib.mkEnableOption "Enable the tmux configuration";
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
bind-key -T copy-mode-vi v send-keys -X begin-selection config = lib.mkIf cfg.enable {
bind-key -T copy-mode-vi y send-keys -X copy-selection programs.tmux = {
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle enable = true;
unbind [ clock24 = true;
bind < copy-mode historyLimit = 10000;
unbind p keyMode = "vi";
bind > paste-buffer shortcut = "y";
bind-key C-a set -g status off terminal = "tmux-256color";
bind-key C-s set -g status on customPaneNavigationAndResize = true;
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -M -X copy-pipe 'xclip -in -selection clipboard' 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 bind-key -T copy-mode-vi v send-keys -X begin-selection
set-option -g visual-bell off bind-key -T copy-mode-vi y send-keys -X copy-selection
set-option -g visual-silence off bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
set-window-option -g monitor-activity off unbind [
set-option -g bell-action none 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; [ set-option -g visual-activity off
{ set-option -g visual-bell off
plugin = prefix-highlight; 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 let
cfg = config.elkowar.programs.zsh;
myConf = import ../myConfig.nix;
makeAbbrs = with builtins; abbrs: concatStringsSep "\n" makeAbbrs = with builtins; abbrs: concatStringsSep "\n"
( (
attrValues attrValues
@ -96,31 +102,36 @@ let
in in
{ {
enable = true; options.elkowar.programs.zsh = {
enable = lib.mkEnableOption "ZSH configuration";
enableAutosuggestions = true;
enableCompletion = true;
dotDir = ".config/zsh";
#defaultKeymap = "viins";
history = {
save = 10000;
share = false;
extended = true;
ignoreDups = true;
ignoreSpace = true;
}; };
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 = { enableAutosuggestions = true;
ls = "exa --icons"; 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:*' menu select
zstyle ':completion::complete:*' gain-privileges 1 zstyle ':completion::complete:*' gain-privileges 1
@ -131,44 +142,46 @@ in
fpath+=( /usr/share/zsh/site-functions/ ) fpath+=( /usr/share/zsh/site-functions/ )
''; '';
initExtra = '' 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=2" +"set statusline=\ %t"'
export MANPAGER='nvim +Man! +"set nocul" +"set noshowcmd" +"set noruler" +"set noshowmode" +"set laststatus=0"' export MANPAGER='nvim +Man! +"set nocul" +"set noshowcmd" +"set noruler" +"set noshowmode" +"set laststatus=0"'
setopt nobeep setopt nobeep
setopt HIST_IGNORE_ALL_DUPS setopt HIST_IGNORE_ALL_DUPS
autoload -Uz colors && colors autoload -Uz colors && colors
autoload -Uz promptinit && promptinit autoload -Uz promptinit && promptinit
#_comp_options+=(globdots) #_comp_options+=(globdots)
# enable cdr command # enable cdr command
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs add-zsh-hook chpwd chpwd_recent_dirs
# deer is a ranger-style file manager directly in the shell that doesn't fully context-switch # deer is a ranger-style file manager directly in the shell that doesn't fully context-switch
#source ~/nixpkgs/config/deer.zsh #source ~/nixpkgs/config/deer.zsh
#zle -N deer #zle -N deer
#bindkey '\ek' deer #bindkey '\ek' deer
${fzf-tab-stuff} ${fzf-tab-stuff}
${fixedKeybinds} ${fixedKeybinds}
${abbrs} ${abbrs}
${manFunction} ${manFunction}
${builtins.readFile ./prompt.zsh} ${builtins.readFile ./prompt.zsh}
''; '';
plugins = let plugins = let
sources = import ./zsh/nix/sources.nix; sources = import ./zsh/nix/sources.nix;
in in
[ [
{ name = "fzf-tab"; src = sources.fzf-tab; } { name = "fzf-tab"; src = sources.fzf-tab; }
{ name = "zsh-autosuggestions"; src = sources.zsh-autosuggestions; } { name = "zsh-autosuggestions"; src = sources.zsh-autosuggestions; }
{ name = "history-substring-search"; src = sources.zsh-history-substring-search; } { name = "history-substring-search"; src = sources.zsh-history-substring-search; }
{ name = "zsh-abbr"; src = sources.zsh-abbr; } { name = "zsh-abbr"; src = sources.zsh-abbr; }
{ name = "fast-syntax-highlighting"; src = sources.fast-syntax-highlighting; } { name = "fast-syntax-highlighting"; src = sources.fast-syntax-highlighting; }
]; ];
};
};
} }

View file

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

View file

@ -10,7 +10,15 @@ in
#useZsh = lib.mkEnableOption #useZsh = lib.mkEnableOption
}; };
imports = [ ../config/tmux.nix ../config/generalConfig.nix ../config/zsh.nix ];
config = lib.mkIf cfg.enable { 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; [ home.packages = with pkgs; [
direnv direnv
rnix-lsp rnix-lsp
@ -29,15 +37,13 @@ in
fd fd
jq 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 = { programs = {
home-manager.enable = true; home-manager.enable = true;
htop.enable = true; htop.enable = true;
zsh = import ../config/zsh.nix { inherit pkgs; inherit myConf; };
tmux = import ../config/tmux.nix { inherit pkgs; inherit myConf; };
fzf = { fzf = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;

View file

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