progress in multi user config
This commit is contained in:
parent
f7891e1f30
commit
3a2f52f45e
68 changed files with 384 additions and 663 deletions
57
modules/home/shell/default.nix
Normal file
57
modules/home/shell/default.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{ options, config, lib, pkgs, user, ... }:
|
||||
let
|
||||
inherit (lib.attrsets) attrValues;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
|
||||
cfg = config.modules.${user}.shell;
|
||||
in
|
||||
{
|
||||
options.modules.${user}.shell = let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) nullOr enum;
|
||||
in {
|
||||
default = mkOption {
|
||||
type = nullOr (enum ["fish" "zsh" "xonsh"]);
|
||||
default = null;
|
||||
description = "Default system shell";
|
||||
};
|
||||
corePkgs.enable = mkEnableOption "core shell packages";
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
(mkIf (cfg.default != null) {
|
||||
users.defaultUserShell = pkgs."${cfg.default}";
|
||||
|
||||
modules.shell.toolset.gnupg.enable = true;
|
||||
})
|
||||
|
||||
(mkIf cfg.corePkgs.enable {
|
||||
modules.shell.toolset = {
|
||||
btop.enable = true;
|
||||
fzf.enable = true;
|
||||
starship.enable = true;
|
||||
tmux.enable = true;
|
||||
};
|
||||
|
||||
home-manager.users.${user}.programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
config.whitelist.prefix = ["/home"];
|
||||
};
|
||||
|
||||
user.packages = attrValues {
|
||||
inherit (pkgs) any-nix-shell pwgen yt-dlp ripdrag yazi;
|
||||
inherit (pkgs) bat fd zoxide;
|
||||
|
||||
rgFull = pkgs.ripgrep.override {withPCRE2 = true;};
|
||||
};
|
||||
|
||||
home-manager.users.${user}.programs = {
|
||||
bat.enable = true;
|
||||
eza.enable = true;
|
||||
fzf.enable = true;
|
||||
zoxide.enable = true;
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
92
modules/home/shell/toolset/btop.nix
Normal file
92
modules/home/shell/toolset/btop.nix
Normal file
|
@ -0,0 +1,92 @@
|
|||
{ config, options, lib, pkgs, user, ... }:
|
||||
let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
in
|
||||
{
|
||||
options.modules.${user}.shell.toolset.btop = let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in { enable = mkEnableOption "system-monitor"; };
|
||||
|
||||
config = mkIf config.modules.${user}.shell.toolset.btop.enable {
|
||||
home-manager.users.${user}.programs.btop = let
|
||||
inherit (config.modules.themes) active;
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
settings = {
|
||||
force_tty = false;
|
||||
vim_keys = true; # Directional keys: "h,j,k,l,g,G"
|
||||
update_ms = 1500; # ms (s^{-3})
|
||||
temp_scale = "celsius";
|
||||
base_10_sizes = false;
|
||||
show_cpu_freq = true;
|
||||
clock_format = "%H:%M";
|
||||
background_update = true;
|
||||
disks_filter = "exclude=/boot";
|
||||
|
||||
rounded_corners = true;
|
||||
theme_background = false;
|
||||
truecolor = true;
|
||||
presets = concatStringsSep "," [
|
||||
"cpu:1:default"
|
||||
"proc:0:default cpu:0:default"
|
||||
"mem:0:default"
|
||||
"net:0:default cpu:0:block"
|
||||
"net:0:tty"
|
||||
];
|
||||
graph_symbol = "braille";
|
||||
graph_symbol_cpu = "default";
|
||||
graph_symbol_mem = "default";
|
||||
graph_symbol_net = "default";
|
||||
graph_symbol_proc = "default";
|
||||
shown_boxes = "proc cpu mem net";
|
||||
|
||||
proc_sorting = "cpu lazy";
|
||||
proc_reversed = false;
|
||||
proc_tree = false;
|
||||
proc_colors = true;
|
||||
proc_gradient = true;
|
||||
proc_per_core = true;
|
||||
proc_mem_bytes = true;
|
||||
proc_info_smaps = false;
|
||||
proc_left = false;
|
||||
|
||||
cpu_graph_upper = "total";
|
||||
cpu_graph_lower = "total";
|
||||
cpu_single_graph = false;
|
||||
cpu_bottom = false;
|
||||
show_uptime = true;
|
||||
check_temp = true;
|
||||
cpu_sensor = "Auto";
|
||||
show_coretemp = true;
|
||||
cpu_core_map = "";
|
||||
custom_cpu_name = "";
|
||||
|
||||
mem_graphs = true;
|
||||
mem_below_net = false;
|
||||
|
||||
show_swap = true;
|
||||
swap_disk = true;
|
||||
show_disks = true;
|
||||
only_physical = true;
|
||||
use_fstab = false; # Enable -> disables `only_physical`
|
||||
disk_free_priv = false;
|
||||
show_io_stat = true;
|
||||
|
||||
io_mode = false;
|
||||
io_graph_combined = false;
|
||||
io_graph_speeds = "";
|
||||
|
||||
net_download = 100;
|
||||
net_upload = 100;
|
||||
net_auto = true;
|
||||
net_sync = false;
|
||||
net_iface = "br0";
|
||||
show_battery = true;
|
||||
selected_battery = "Auto";
|
||||
log_level = "DEBUG";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
34
modules/home/shell/toolset/fzf.nix
Normal file
34
modules/home/shell/toolset/fzf.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ config, options, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (lib.attrsets) optionalAttrs;
|
||||
inherit (lib.modules) mkIf;
|
||||
in
|
||||
{
|
||||
options.modules.${user}.shell.toolset.fzf = let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in { enable = mkEnableOption "TUI Fuzzy Finder."; };
|
||||
|
||||
config = mkIf config.modules.${user}.shell.toolset.fzf.enable {
|
||||
home-manager.users.${user}.programs.fzf = let
|
||||
defShell = config.modules.shell.default;
|
||||
in {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
enableZshIntegration = defShell == "zsh";
|
||||
enableFishIntegration = defShell == "fish";
|
||||
|
||||
tmux.enableShellIntegration = true;
|
||||
tmux.shellIntegrationOptions = ["-d 40%"];
|
||||
|
||||
defaultCommand = "fd --type f";
|
||||
defaultOptions = ["--height 40%" "--border"];
|
||||
|
||||
changeDirWidgetCommand = "fd --type d";
|
||||
changeDirWidgetOptions = ["--preview 'tree -C {} | head -200'"];
|
||||
|
||||
fileWidgetCommand = "fd --type f";
|
||||
fileWidgetOptions = ["--preview 'head {}'"];
|
||||
historyWidgetOptions = ["--sort" "--exact"];
|
||||
};
|
||||
};
|
||||
}
|
117
modules/home/shell/toolset/git.nix
Normal file
117
modules/home/shell/toolset/git.nix
Normal file
|
@ -0,0 +1,117 @@
|
|||
{ config, options, lib, pkgs, user, ... }:
|
||||
let
|
||||
inherit (builtins) readFile;
|
||||
inherit (lib.attrsets) attrValues optionalAttrs;
|
||||
inherit (lib.modules) mkIf;
|
||||
in
|
||||
{
|
||||
options.modules.${user}.shell.toolset.git = let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in { enable = mkEnableOption "version-control system"; };
|
||||
|
||||
config = mkIf config.modules.${user}.shell.toolset.git.enable {
|
||||
user.packages = attrValues ({
|
||||
inherit (pkgs) act dura lazygit;
|
||||
inherit (pkgs.gitAndTools) gh git-open;
|
||||
}
|
||||
// optionalAttrs config.modules.shell.toolset.gnupg.enable {
|
||||
inherit (pkgs.gitAndTools) git-crypt;
|
||||
});
|
||||
|
||||
environment.sessionVariables.GITHUB_TOKEN = "$(cat /run/agenix/tokenGH)";
|
||||
|
||||
home-manager.users.${user}.programs = {
|
||||
zsh.initExtra = ''
|
||||
# -------===[ Helpful Git Fn's ]===------- #
|
||||
gitignore() {
|
||||
curl -s -o .gitignore https://gitignore.io/api/$1
|
||||
}
|
||||
'';
|
||||
|
||||
fish.functions = {
|
||||
gitignore = "curl -sL https://www.gitignore.io/api/$argv";
|
||||
};
|
||||
|
||||
git = {
|
||||
enable = true;
|
||||
package = pkgs.gitFull;
|
||||
difftastic = {
|
||||
enable = true;
|
||||
background = "dark";
|
||||
color = "always";
|
||||
display = "inline";
|
||||
};
|
||||
|
||||
ignores = [
|
||||
# General:
|
||||
"*.bloop"
|
||||
"*.bsp"
|
||||
"*.metals"
|
||||
"*.metals.sbt"
|
||||
"*metals.sbt"
|
||||
"*.direnv"
|
||||
"*.envrc"
|
||||
"*hie.yaml"
|
||||
"*.mill-version"
|
||||
"*.jvmopts"
|
||||
|
||||
# OS-related:
|
||||
".DS_Store?"
|
||||
".DS_Store"
|
||||
".CFUserTextEncoding"
|
||||
".Trash"
|
||||
".Xauthority"
|
||||
"thumbs.db"
|
||||
"Thumbs.db"
|
||||
"Icon?"
|
||||
|
||||
# Compiled residues:
|
||||
"*.class"
|
||||
"*.exe"
|
||||
"*.o"
|
||||
"*.pyc"
|
||||
"*.elc"
|
||||
];
|
||||
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
core = {
|
||||
editor = "nvim";
|
||||
whitespace = "trailing-space,space-before-tab";
|
||||
};
|
||||
credential.helper = "${pkgs.gitFull}/bin/git-credential-libsecret";
|
||||
|
||||
user = {
|
||||
name = "Chris Kruining";
|
||||
email = "chris@kruining.eu";
|
||||
signingKey = readFile "${config.user.home}/.ssh/id_rsa.pub";
|
||||
};
|
||||
|
||||
gpg.format = "ssh";
|
||||
commit.gpgSign = true;
|
||||
tag.gpgSign = true;
|
||||
|
||||
push = {
|
||||
autoSetupRemote = true;
|
||||
default = "current";
|
||||
gpgSign = "if-asked";
|
||||
autoSquash = true;
|
||||
};
|
||||
pull.rebase = true;
|
||||
|
||||
filter = {
|
||||
required = true;
|
||||
smudge = "git-lfs smudge -- %f";
|
||||
process = "git-lfs filter-process";
|
||||
clean = "git-lfs clean -- %f";
|
||||
};
|
||||
|
||||
url = {
|
||||
"https://github.com/".insteadOf = "gh:";
|
||||
"git@github.com:".insteadOf = "ssh+gh:";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
31
modules/home/shell/toolset/gnupg.nix
Normal file
31
modules/home/shell/toolset/gnupg.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ config, options, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (builtins) getEnv;
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.modules.${user}.shell.toolset.gnupg;
|
||||
in
|
||||
{
|
||||
options.modules.${user}.shell.toolset.gnupg = let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in { enable = mkEnableOption "cryptographic suite"; };
|
||||
|
||||
config = mkIf config.modules.shell.toolset.gnupg.enable {
|
||||
environment.variables.GNUPGHOME = "$XDG_CONFIG_HOME/gnupg";
|
||||
|
||||
home-manager.users.${user}.programs.gnupg.agent = {
|
||||
enable = true;
|
||||
enableSSHSupport = true;
|
||||
pinentryPackage = pkgs.pinentry-gnome3;
|
||||
|
||||
settings = let
|
||||
cacheTTL = 86400;
|
||||
in {
|
||||
default-cache-ttl = cacheTTL;
|
||||
default-cache-ttl-ssh = cacheTTL;
|
||||
max-cache-ttl = cacheTTL;
|
||||
max-cache-ttl-ssh = cacheTTL;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
85
modules/home/shell/toolset/starship.nix
Normal file
85
modules/home/shell/toolset/starship.nix
Normal file
|
@ -0,0 +1,85 @@
|
|||
{ config, options, lib, pkgs, user, ... }:
|
||||
let
|
||||
inherit (lib.modules) mkIf;
|
||||
in
|
||||
{
|
||||
options.modules.${user}.shell.toolset.starship = let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in { enable = mkEnableOption "minimal shell ricing"; };
|
||||
|
||||
config = mkIf config.modules.${user}.shell.toolset.starship.enable {
|
||||
home-manager.users.${user}.programs.starship = {
|
||||
enable = true;
|
||||
settings = let
|
||||
inherit (config.lib.stylix.colors) cyan red magenta yellow green blue;
|
||||
in {
|
||||
scan_timeout = 10;
|
||||
add_newline = true;
|
||||
line_break.disabled = true;
|
||||
|
||||
format = "$username$hostname$nix_shell$git_branch$git_commit$git_state$git_status$directory$jobs$cmd_duration$character";
|
||||
username = {
|
||||
style_user = "${cyan} bold";
|
||||
style_root = "${red} bold";
|
||||
format = "[$user]($style) ";
|
||||
disabled = false;
|
||||
show_always = true;
|
||||
};
|
||||
|
||||
hostname = {
|
||||
ssh_only = false;
|
||||
ssh_symbol = "🌐 ";
|
||||
format = "on [$hostname](bold ${red}) ";
|
||||
trim_at = ".local";
|
||||
disabled = false;
|
||||
};
|
||||
|
||||
nix_shell = {
|
||||
symbol = " ";
|
||||
format = "[$symbol$name]($style) ";
|
||||
style = "${magenta} bold";
|
||||
};
|
||||
|
||||
git_branch = {
|
||||
only_attached = true;
|
||||
format = "[$symbol$branch]($style) ";
|
||||
symbol = "שׂ";
|
||||
style = "${yellow} bold";
|
||||
};
|
||||
|
||||
git_commit = {
|
||||
only_detached = true;
|
||||
format = "[ﰖ$hash]($style) ";
|
||||
style = "${yellow} bold";
|
||||
};
|
||||
|
||||
git_state = {
|
||||
style = "${magenta} bold";
|
||||
};
|
||||
|
||||
git_status = {
|
||||
style = "${green} bold";
|
||||
};
|
||||
|
||||
directory = {
|
||||
read_only = " ";
|
||||
truncation_length = 0;
|
||||
};
|
||||
|
||||
cmd_duration = {
|
||||
format = "[$duration]($style) ";
|
||||
style = "${blue}";
|
||||
};
|
||||
|
||||
jobs = {
|
||||
style = "${green} bold";
|
||||
};
|
||||
|
||||
character = {
|
||||
success_symbol = "[\\$](${green}} bold)";
|
||||
error_symbol = "[\\$](${red} bold)";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
103
modules/home/shell/toolset/tmux.nix
Normal file
103
modules/home/shell/toolset/tmux.nix
Normal file
|
@ -0,0 +1,103 @@
|
|||
{ config, options, lib, pkgs, user, ... }:
|
||||
let
|
||||
inherit (lib.modules) mkIf;
|
||||
in
|
||||
{
|
||||
options.modules.${user}.shell.toolset.tmux = let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in { enable = mkEnableOption "terminal multiplexer"; };
|
||||
|
||||
config = mkIf config.modules.${user}.shell.toolset.tmux.enable {
|
||||
home-manager.users.${user}.programs.tmux = {
|
||||
enable = true;
|
||||
secureSocket = true;
|
||||
keyMode = "vi";
|
||||
prefix = "C-a";
|
||||
terminal = "tmux-256color";
|
||||
|
||||
baseIndex = 1;
|
||||
clock24 = true;
|
||||
disableConfirmationPrompt = true;
|
||||
escapeTime = 0;
|
||||
|
||||
aggressiveResize = false;
|
||||
resizeAmount = 2;
|
||||
reverseSplit = false;
|
||||
historyLimit = 5000;
|
||||
newSession = true;
|
||||
|
||||
plugins = let
|
||||
inherit (pkgs.tmuxPlugins) resurrect continuum;
|
||||
in [
|
||||
{
|
||||
plugin = resurrect;
|
||||
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
||||
}
|
||||
{
|
||||
plugin = continuum;
|
||||
extraConfig = ''
|
||||
set -g @continuum-restore 'on'
|
||||
set -g @continuum-save-interval '60' # minutes
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
# -------===[ Color Correction ]===------- #
|
||||
set-option -ga terminal-overrides ",*256col*:Tc"
|
||||
set-option -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
|
||||
set-environment -g COLORTERM "truecolor"
|
||||
|
||||
# -------===[ General-Configurations ]===------- #
|
||||
set-option -g renumber-windows on
|
||||
set-window-option -g automatic-rename on
|
||||
set-window-option -g word-separators ' @"=()[]'
|
||||
|
||||
set-option -g mouse on
|
||||
set-option -s focus-events on
|
||||
set-option -g renumber-windows on
|
||||
set-option -g allow-rename off
|
||||
|
||||
# -------===[ Activity/Sound ]===------- #
|
||||
set-option -g bell-action none
|
||||
set-option -g visual-bell off
|
||||
set-option -g visual-silence off
|
||||
set-option -g visual-activity off
|
||||
set-window-option -g monitor-activity off
|
||||
|
||||
# -------===[ Status-Bar ]===------- #
|
||||
set-option -g status on
|
||||
set-option -g status-interval 1
|
||||
set-option -g status-style bg=default,bold,italics
|
||||
|
||||
set-option -g status-position top
|
||||
set-option -g status-justify left
|
||||
|
||||
set-option -g status-left-length "40"
|
||||
set-option -g status-right-length "80"
|
||||
|
||||
# -------===[ Keybindings ]===------- #
|
||||
bind-key c clock-mode
|
||||
|
||||
# Window Control(s):
|
||||
bind-key q kill-session
|
||||
bind-key Q kill-server
|
||||
bind-key t new-window -c '#{pane_current_path}'
|
||||
|
||||
# Buffers:
|
||||
bind-key b list-buffers
|
||||
bind-key p paste-buffer
|
||||
bind-key P choose-buffer
|
||||
|
||||
# Split bindings:
|
||||
bind-key - split-window -v -c '#{pane_current_path}'
|
||||
bind-key / split-window -h -c '#{pane_current_path}'
|
||||
|
||||
# Copy/Paste bindings:
|
||||
bind-key -T copy-mode-vi v send-keys -X begin-selection -N "Start visual mode for selection"
|
||||
bind-key -T copy-mode-vi y send-keys -X copy-selection -N "Yank text into buffer"
|
||||
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle -N "Yank region into buffer"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
99
modules/home/shell/zsh.nix
Normal file
99
modules/home/shell/zsh.nix
Normal file
|
@ -0,0 +1,99 @@
|
|||
{ config, options, pkgs, lib, ... }:
|
||||
let
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) concatStrings escapeNixString;
|
||||
|
||||
cfg = config.modules.shell;
|
||||
in
|
||||
{
|
||||
config = mkIf (cfg.default == "zsh") {
|
||||
modules.shell = {
|
||||
corePkgs.enable = true;
|
||||
toolset = {
|
||||
starship.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.${user}.programs.starship.enableZshIntegration = true;
|
||||
|
||||
# Enable completion for sys-packages:
|
||||
environment.pathsToLink = ["/share/zsh"];
|
||||
|
||||
home-manager.users.${user}.programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
autosuggestion.enable = true;
|
||||
|
||||
history = {
|
||||
size = 10000;
|
||||
path = "$XDG_CONFIG_HOME/zsh/history";
|
||||
};
|
||||
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins = ["git" "docker-compose" "zoxide"];
|
||||
};
|
||||
|
||||
plugins = let
|
||||
mkZshPlugin = {
|
||||
pkg,
|
||||
file ? "${pkg.pname}.plugin.zsh",
|
||||
}: {
|
||||
name = pkg.pname;
|
||||
src = pkg.src;
|
||||
inherit file;
|
||||
};
|
||||
in
|
||||
with pkgs; [
|
||||
(mkZshPlugin {pkg = zsh-abbr;})
|
||||
(mkZshPlugin {pkg = zsh-autopair;})
|
||||
(mkZshPlugin {pkg = zsh-you-should-use;})
|
||||
(mkZshPlugin {
|
||||
pkg = zsh-nix-shell;
|
||||
file = "nix-shell.plugin.zsh";
|
||||
})
|
||||
|
||||
{
|
||||
name = "zsh-autosuggestion";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-autosuggestions";
|
||||
rev = "v0.7.0";
|
||||
sha256 = "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "zsh-completions";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-completions";
|
||||
rev = "0.34.0";
|
||||
sha256 = "0jjgvzj3v31yibjmq50s80s3sqi4d91yin45pvn3fpnihcrinam9";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "zsh-syntax-highlighting";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-syntax-highlighting";
|
||||
rev = "0.7.0";
|
||||
sha256 = "0s1z3whzwli5452h2yzjzzj27pf1hd45g223yv0v6hgrip9f853r";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
home-manager.users.${user}.xdg.configFile."zsh-abbreviations" = {
|
||||
target = "zsh/abbreviations";
|
||||
text = let
|
||||
abbrevs = import "${config.sneeuwvlok.configDir}/shell-abbr";
|
||||
in ''
|
||||
${concatStrings (mapAttrsToList
|
||||
(k: v: "abbr ${k}=${escapeNixString v}")
|
||||
abbrevs
|
||||
)}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue