207 lines
5.3 KiB
Nix
207 lines
5.3 KiB
Nix
# Base home.nix
|
|
{ config, lib, pkgs, inputs, user, ... }:
|
|
{
|
|
programs.home-manager.enable = true;
|
|
home.username = "${user.name}";
|
|
home.homeDirectory = "/home/${user.name}";
|
|
home.sessionPath = [
|
|
"${config.home.homeDirectory}/.local/bin"
|
|
];
|
|
xdg = {
|
|
enable = true;
|
|
cacheHome = "${config.home.homeDirectory}/.cache";
|
|
configHome = "${config.home.homeDirectory}/.config";
|
|
dataHome = "${config.home.homeDirectory}/.local/share";
|
|
stateHome = "${config.home.homeDirectory}/.local/state";
|
|
};
|
|
home.file = {
|
|
"bash_login" = {
|
|
source = ./dots/bash_login;
|
|
target = ".bash_login";
|
|
};
|
|
"bash_logout" = {
|
|
source = ./dots/bash_logout;
|
|
target = ".bash_logout";
|
|
};
|
|
"bashrc" = {
|
|
source = ./dots/bashrc;
|
|
target = ".bashrc";
|
|
};
|
|
};
|
|
programs.fzf = {
|
|
enable = true;
|
|
tmux.enableShellIntegration = true;
|
|
};
|
|
programs.git = {
|
|
enable = true;
|
|
userName = "${user.long}";
|
|
userEmail = "${user.email}";
|
|
ignores = [
|
|
"*~"
|
|
"*.swp"
|
|
];
|
|
extraConfig = {
|
|
global = {
|
|
init.defaultbranch = "main";
|
|
};
|
|
};
|
|
};
|
|
programs.neovim = {
|
|
enable = true;
|
|
defaultEditor = true;
|
|
viAlias = true;
|
|
vimAlias = true;
|
|
extraConfig = ''
|
|
syntax enable
|
|
set nowrap
|
|
set linebreak
|
|
set number
|
|
set relativenumber
|
|
set splitbelow
|
|
set splitright
|
|
set tabstop=4
|
|
set shiftwidth=4
|
|
if filereadable(expand(".vim-project"))
|
|
source .vim-project
|
|
endif
|
|
'';
|
|
};
|
|
xdg.configFile."lf/icons".source = ./dots/icons;
|
|
programs.lf = {
|
|
enable = true;
|
|
commands = {
|
|
dragon-out = ''%${pkgs.xdragon}/bin/xdragon -a -x "$fx"'';
|
|
editor-open = ''$$EDITOR $f'';
|
|
mkdir = ''
|
|
''${{
|
|
printf "Directory Name: "
|
|
read DIR
|
|
mkdir $DIR
|
|
}}
|
|
'';
|
|
};
|
|
keybindings = {
|
|
"\\\"" = "";
|
|
o = "";
|
|
c = "mkdir";
|
|
"." = "set hidden!";
|
|
"`" = "mark-load";
|
|
"\\'" = "mark-load";
|
|
"<enter>" = "open";
|
|
do = "dragon-out";
|
|
"g~" = "cd";
|
|
gh = "cd";
|
|
"g/" = "/";
|
|
ee = "editor-open";
|
|
V = ''''$${pkgs.bat}/bin/bat --paging=always "$f"'';
|
|
};
|
|
settings = {
|
|
preview = true;
|
|
hidden = true;
|
|
drawbox = true;
|
|
icons = true;
|
|
ignorecase = true;
|
|
};
|
|
extraConfig =
|
|
let
|
|
previewer =
|
|
pkgs.writeShellScriptBin "pv.sh" ''
|
|
file=$1
|
|
w=$2
|
|
h=$3
|
|
x=$4
|
|
y=$5
|
|
|
|
if [[ "$( ${pkgs.file}/bin/file -Lb --mime-type "$file")" =~ ^image ]]; then
|
|
${pkgs.kitty}/bin/kitty +kitten icat --silent --stdin no --transfer-mode file --place "''${w}x''${h}@''${x}x''${y}" "$file" < /dev/null > /dev/tty
|
|
exit 1
|
|
fi
|
|
|
|
${pkgs.pistol}/bin/pistol "$file"
|
|
'';
|
|
cleaner = pkgs.writeShellScriptBin "clean.sh" ''
|
|
${pkgs.kitty}/bin/kitty +kitten icat --clear --stdin no --silent --transfer-mode file </dev/null > /dev/tty
|
|
'';
|
|
in
|
|
''
|
|
set cleaner ${cleaner}/bin/clean.sh
|
|
set previewer ${previewer}/bin/pv.sh
|
|
'';
|
|
};
|
|
programs.password-store = {
|
|
enable = true;
|
|
package = pkgs.pass.withExtensions (exts: [ exts.pass-otp exts.pass-import ]);
|
|
settings = {
|
|
PASSWORD_STORE_DIR = "XDG_DATA_HOME/password-store";
|
|
PASSWORD_STORE_CLIP_TIME = "60";
|
|
};
|
|
};
|
|
programs.tmux = {
|
|
enable = true;
|
|
baseIndex = 1;
|
|
clock24 = true;
|
|
escapeTime = 250;
|
|
historyLimit = 8000;
|
|
keyMode = "vi";
|
|
mouse = false;
|
|
newSession = false;
|
|
prefix = "C-b";
|
|
terminal = "screen-256color";
|
|
extraConfig = ''
|
|
# Do not rename windows automatically
|
|
set-option -g allow-rename off
|
|
|
|
# Hide statusbar while using one window
|
|
set -g status off
|
|
set-hook -g after-new-window 'if "[ #{session_windows} -gt 1 ]" "set status on"'
|
|
set-hook -g after-kill-pane 'if "[ #{session_windows} -lt 2 ]" "set status off"'
|
|
set-hook -g pane-exited 'if "[ #{session_windows} -lt 2 ]" "set status off"'
|
|
set-hook -g window-layout-changed 'if "[ #{session_windows} -lt 2 ]" "set status off"'
|
|
|
|
# Reload tmux.conf
|
|
unbind r
|
|
bind r source-file $HOME/.config/tmux/tmux.conf \; display "tmux config reloaded"
|
|
|
|
# Rebind vertical/horizontal splitting
|
|
unbind %
|
|
unbind v
|
|
bind v split-window -h -c "#{pane_current_path}"
|
|
unbind '"'
|
|
unbind c
|
|
bind c split-window -v -c "#{pane_current_path}"
|
|
|
|
unbind Enter
|
|
bind Enter new-window
|
|
unbind Tab
|
|
bind Tab last-window
|
|
|
|
unbind l
|
|
# Rebind moving panes
|
|
bind -n C-h select-pane -L
|
|
bind -n C-j select-pane -D
|
|
bind -n C-k select-pane -U
|
|
bind -n C-l select-pane -R
|
|
bind -n M-h select-pane -L
|
|
bind -n M-j select-pane -D
|
|
bind -n M-k select-pane -U
|
|
bind -n M-l select-pane -R
|
|
|
|
# Set status bar postition
|
|
set -g status-position top
|
|
|
|
# Status bar theme
|
|
set -g status-style "fg=#50fa7b"
|
|
|
|
# Window theme
|
|
setw -g window-status-current-style "bg=#50fa7b fg=#282a36"
|
|
setw -g window-status-current-format " #I:#W#F "
|
|
setw -g window-status-format "[#I:#W#F]"
|
|
'';
|
|
plugins = with pkgs; [
|
|
tmuxPlugins.urlview
|
|
tmuxPlugins.yank
|
|
];
|
|
};
|
|
home.stateVersion = "23.05";
|
|
}
|