progress in multi user config

This commit is contained in:
Chris Kruining 2025-03-18 16:43:07 +01:00
parent f7891e1f30
commit 3a2f52f45e
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
68 changed files with 384 additions and 663 deletions

View 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";
};
};
};
}

View 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"];
};
};
}

View 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:";
};
};
};
};
};
}

View 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;
};
};
};
}

View 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)";
};
};
};
};
}

View 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"
'';
};
};
}