per host nix modules by user

This commit is contained in:
ringofstorms 2024-04-07 12:54:35 -05:00
parent 8975b5cc3c
commit 5291ac3b47
26 changed files with 23 additions and 4 deletions

View file

@ -0,0 +1,51 @@
{ ... }:
{
# More of an experiment to try out since wezterm is being weird on wayland...
#
#
programs.alacritty = {
enable = true;
settings = {
window = {
decorations = "None";
dynamic_title = false;
};
colors = {
primary = {
foreground = "#e0e0e0";
background = "#262626";
cursor = "#171717";
vi_mode_cursor = "#636363";
};
normal = {
# Catppuccin Coal
black = "#1f1f1f";
red = "#f38ba8";
green = "#a6e3a1";
yellow = "#f9e2af";
blue = "#89b4fa";
magenta = "#cba6f7";
cyan = "#89dceb";
white = "#e0e0e0";
};
};
font = {
normal = { family = "JetBrainsMonoNL Nerd Font"; style = "Regular"; };
size = 12.0;
## TODO use 16 on macos ...
};
# TODO revisit... none of this is working.
keyboard.bindings = [
# { key = "m"; mods = "Command"; chars = "test"; }
# { key = "t"; mods = "Control"; action = { SendString = "\\x01t"; }; }
# { key = "w"; mods = "Control"; action = { SendString = "\\x01w"; }; }
# { key = "o"; mods = "Control"; action = { SendString = "testing123"; }; }
# { key = "w"; mods = "Control"; chars = "\\\\x01w"; }
# { key = "o"; mods = "Control"; chars = "\\\\x01o"; }
# { key = "1"; mods = "Control"; chars = "\\\\x011"; }
# { key = "2"; mods = "Control"; chars = "\\\\x012"; }
];
};
};
}

View file

@ -0,0 +1,14 @@
{ ... }:
{
programs.atuin = {
enable = true;
enableZshIntegration = true;
flags = [ "--disable-up-arrow" ];
settings = {
workspaces = true;
exit-mode = "return-query";
enter_accept = true;
};
};
}

View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.google-chrome ];
}

View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.comma ];
}

View file

@ -0,0 +1,118 @@
{ pkgs, lib, ... }:
with lib.hm.gvariant;
{
home.packages = with pkgs; [
# use `dconf dump /` before and after and diff the files for easy editing of dconf below
# > `dconf dump / > /tmp/dconf_dump_start && watch -n0.5 'dconf dump / > /tmp/dconf_dump_current && diff --color /tmp/dconf_dump_start /tmp/dconf_dump_current -U12'`
# OR (Must be logged into user directly, no SU to user will work): `dconf watch /`
# OR get the exact converted config from `dconf dump / | dconf2nix | less` and search with forward slash
# gnome.dconf-editor
# gnomeExtensions.workspace-switch-wraparound
#gnomeExtensions.forge # probably don't need on this on tiny laptop but may explore this instead of sway for my desktop
];
dconf = {
enable = true;
settings = {
"org/gnome/desktop/session" = {
idle-delay = mkUint32 0;
};
"org/gnome/shell" = {
favorite-apps = [
# "vivaldi-stable.desktop"
"Alacritty.desktop"
# Wezterm is not playing nice with me on gnome wayland :(
# "org.wezfurlong.wezterm.desktop"
"firefox.desktop"
"org.gnome.Nautilus.desktop"
];
enabled-extensions = with pkgs.gnomeExtensions; [
workspace-switch-wraparound.extensionUuid
];
};
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
enable-hot-corners = false;
show-battery-percentage = true;
};
"org/gnome/desktop/wm/preferences" = {
resize-with-right-button = true;
button-layout = "maximize:appmenu,close";
audible-bell = false;
wrap-around = true;
};
"org/gnome/settings-daemon/plugins/media-keys" = {
# Disable the lock screen shortcut
screensaver = [ "" ];
custom-keybindings = [ "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" ];
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "<Super>Return";
command = "alacritty";
name = "Launch terminal";
};
"org/gnome/desktop/wm/keybindings" = {
minimize = [ "" ];
move-to-workspace-1 = [ "" ];
move-to-workspace-2 = [ "" ];
move-to-workspace-3 = [ "" ];
move-to-workspace-4 = [ "" ];
move-to-workspace-last = [ "" ];
move-to-workspace-down = [ "<Control><Super>j" ];
move-to-workspace-up = [ "<Control><Super>k" ];
move-to-workspace-left = [ "<Control><Super>h" ];
move-to-workspace-right = [ "<Control><Super>l" ];
switch-to-workspace-1 = [ "<Super>1" ];
switch-to-workspace0 = [ "<Super>2" ];
switch-to-workspace-3 = [ "<Super>3" ];
switch-to-workspace-4 = [ "<Super>4" ];
switch-to-workspace-down = [ "" ];
switch-to-workspace-last = [ "" ];
switch-to-workspace-left = [ "<Super>h" ];
switch-to-workspace-right = [ "<Super>l" ];
};
"org/gnome/mutter" = {
edge-tiling = true;
workspaces-only-on-primary = true;
};
"org/gnome/settings-daemon/plugins/power" = {
power-button-action = "nothing";
sleep-inactive-ac-type = "nothing";
sleep-inactive-battery-type = "nothing";
idle-brightness = 15;
power-saver-profile-on-low-battery = false;
};
"org/gnome/desktop/screensaver" = {
lock-enabled = false;
idle-activation-enabled = false;
};
"org/gnome/desktop/applications/terminal" = {
exec = "alacritty";
};
"org/gnome/settings-daemon/plugins/color" = {
night-light-enabled = false;
night-light-schedule-automatic = false;
};
"org/gnome/shell/keybindings" = {
shift-overview-down = [ "<Super>j" ];
shift-overview-up = [ "<Super>k" ];
switch-to-application-1 = [ "" ];
switch-to-application-2 = [ "" ];
switch-to-application-3 = [ "" ];
switch-to-application-4 = [ "" ];
switch-to-application-5 = [ "" ];
switch-to-application-6 = [ "" ];
switch-to-application-7 = [ "" ];
switch-to-application-8 = [ "" ];
switch-to-application-9 = [ "" ];
toggle-quick-settings = [ "" ];
toggle-application-view = [ "<Super>space" ];
};
"org/gtk/gtk4/settings/file-chooser" = {
show-hidden = true;
};
};
};
}

View file

@ -0,0 +1,25 @@
{ pkgs, ... }:
{
gtk = {
enable = true;
cursorTheme = {
name = "Numix-Cursor";
package = pkgs.numix-cursor-theme;
};
gtk3.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
gtk4.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
};
home.sessionVariables.GTK_THEME = "palenight";
}

View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.discordo pkgs.discord ];
}

View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.firefox-esr ];
}

View file

@ -0,0 +1,5 @@
{ settings, pkgs, ... }:
{
home.packages = [ pkgs.gnome.nautilus ];
}

View file

@ -0,0 +1,5 @@
{ settings, pkgs, ... }:
{
home.packages = [ pkgs.ollama ];
}

View file

@ -0,0 +1,8 @@
{ ... }:
{
home.file.".psqlrc".text = ''
\pset pager off
'';
}

View file

@ -0,0 +1,43 @@
{ ... }:
{
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
add_newline = false;
palette = "catppuccin_coal";
palettes.catppuccin_coal = {
# Same as catppuccin mocha for these
rosewater = "#f5e0dc";
flamingo = "#f2cdcd";
pink = "#f5c2e7";
mauve = "#cba6f7";
red = "#f38ba8";
maroon = "#eba0ac";
peach = "#fab387";
yellow = "#f9e2af";
green = "#a6e3a1";
teal = "#94e2d5";
sky = "#89dceb";
sapphire = "#74c7ec";
blue = "#89b4fa";
lavender = "#b4befe";
# Coal variant: https://gist.github.com/RingOfStorms/b2ff0c4e37f5be9f985c72c3ec9a3e62
text = "#e0e0e0";
subtext1 = "#cccccc";
subtext0 = "#b8b8b8";
overlay2 = "#a3a3a3";
overlay1 = "#8c8c8c";
overlay0 = "#787878";
surface2 = "#636363";
surface1 = "#4f4f4f";
surface0 = "#3b3b3b";
base = "#262626";
mantle = "#1f1f1f";
crust = "#171717";
};
};
};
}

View file

@ -0,0 +1,63 @@
# Reset everything then add what we want exactly
unbind-key -a
bind C-Space send-prefix
# Windows
bind -r p previous-window
bind -r n next-window
bind -r & kill-window
bind -r c new-window
bind ',' command-prompt "rename-window %%"
bind -r '"' split-window -v -c "#{pane_current_path}"
bind -r % split-window -h -c "#{pane_current_path}"
# bind "'" command-prompt -T window-target -p index { select-window it ":%%" }
bind w choose-tree -Zw
bind -r 1 select-window -t:1
bind -r 2 select-window -t:2
bind -r 3 select-window -t:3
bind -r 4 select-window -t:4
bind -r 5 select-window -t:5
bind -r 6 select-window -t:6
bind -r 7 select-window -t:7
bind -r 8 select-window -t:8
bind -r 9 select-window -t:9
# custom
bind m command-prompt -p "Swap with window index:" "swap-window -t '%%'"
bind -r [ swap-window -t -1 \; previous-window
bind -r ] swap-window -t +1 \; next-window
# Panes
bind ! break-pane
bind -r left select-pane -L
bind -r down select-pane -D
bind -r up select-pane -U
bind -r right select-pane -R
bind -r x kill-pane
bind z resize-pane -Z
# custom
bind e select-layout tiled
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
# Sessions
bind $ command-prompt "rename-session %%"
bind -r ) switch-client -n
bind -r ( switch-client -p
# custom
bind C command-prompt -p "session name:" "new-session -s '%%'"
# Tmux util
bind X source-file ~/.config/tmux/tmux.conf
bind : command-prompt
bind C-D detach
# ==========
# My options
set-option -g terminal-overrides ',xterm-256color:RGB'
set -g detach-on-destroy off
set -g renumber-windows on
set -g status-position top

View file

@ -0,0 +1,74 @@
{ settings, lib, pkgs, ... } @ args:
let
tmux = pkgs.tmuxPlugins;
in
{
# home manager doesn't give us an option to add tmux extra config at the top so we do it ourselves here.
xdg.configFile."tmux/tmux.conf".text = lib.mkBefore (builtins.readFile ./tmux-reset.conf);
programs.tmux = {
enable = true;
# Revisit this later, permission denied to make anything in `/run` as my user...
secureSocket = false;
# default is B switch to space for easier dual hand use
shortcut = "Space";
prefix = "C-Space";
baseIndex = 1;
mouse = true;
keyMode = "vi";
newSession = true;
shell = "${pkgs.zsh}/bin/zsh";
terminal = "screen-256color";
aggressiveResize = true;
plugins = [
tmux.yank
# tmux.tmux-thumbs
# {
# plugin = tmux.fzf-tmux-url;
# extraConfig = ''
# set -g @fzf-url-fzf-options '-p 60%,30% --prompt = " " - -border-label=" Open URL "'
# set -g @fzf-url-history-limit '2000'
# '';
# }
{
plugin = tmux.catppuccin.overrideAttrs (_: {
src = pkgs.fetchFromGitHub {
owner = "ringofstorms";
repo = "tmux-catppuccin-coal";
rev = "e6d7c658e2d11798912ca1ed4e3626e3e1fad3fc";
sha256 = "sha256-M1XAeCz/lqgjZ7CnWCykJxZCDk+WVoawwHrR9SEO9ns=";
};
});
extraConfig = ''
set -g @catppuccin_flavour 'mocha'
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " "
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W#{?window_zoomed_flag,(),}"
set -g @catppuccin_status_modules_right "directory application date_time"
set -g @catppuccin_status_modules_left "session"
set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator " "
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_directory_text "#{b:pane_current_path}"
set -g @catppuccin_date_time_text "%H:%M"
'';
}
];
};
home.shellAliases = {
t = "tmux";
tat = "tmux ls 2>/dev/null && tmux attach-session -t \"$(tmux ls | head -n1 | cut -d: -f1)\" || tmux new-session";
};
}

View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.vivaldi ];
}

View file

@ -0,0 +1,170 @@
local info = os.getenv("WEZTERM_EXECUTABLE")
local nix_test = os.getenv("NIX_PROFILES")
local isMac = info:find("MacOS") ~= nil
local isNix = not (nix_test == nil or nix_text == "")
-- gets basename of path. From https://stackoverflow.com/a/39872872
-- local function basename(str)
-- return str:sub(str:find("/[^/|\\]*$") + 1)
-- end
local wezterm = require("wezterm")
local config = {}
if wezterm.config_builder then
config = wezterm.config_builder()
end
config.disable_default_key_bindings = true
config.keys = {
-- Manually add Ctrl+Shift+V for Paste
{
key = "v",
mods = "CTRL|SHIFT",
action = wezterm.action.PasteFrom("Clipboard"),
},
-- Manually add Ctrl+Shift+C for Copy
{
key = "c",
mods = "CTRL|SHIFT",
action = wezterm.action.CopyTo("Clipboard"),
},
-- Create new TMUX window
{
key = "t",
mods = "CTRL",
action = wezterm.action.SendString("\x01" .. "t"),
},
-- Close TMUX window
{
key = "w",
mods = "CTRL",
action = wezterm.action.SendString("\x01" .. "w"),
},
-- Close TMUX window
{
key = "o",
mods = "CTRL",
action = wezterm.action.SendString("\x01" .. "o"),
},
}
for i = 1, 9 do
table.insert(config.keys, {
key = tostring(i),
mods = "CTRL",
action = wezterm.action.SendString("\x01" .. tostring(i)),
})
end
-- My modifications: https://gist.github.com/RingOfStorms/b2ff0c4e37f5be9f985c72c3ec9a3e62
local scheme = wezterm.get_builtin_color_schemes()["Catppuccin Mocha"]
local c = {
text = "#e0e0e0",
subtext1 = "#cccccc",
subtext0 = "#b8b8b8",
overlay2 = "#a3a3a3",
overlay1 = "#8c8c8c",
overlay0 = "#787878",
surface2 = "#636363",
surface1 = "#4f4f4f",
surface0 = "#3b3b3b",
base = "#262626",
mantle = "#1f1f1f",
crust = "#171717",
}
scheme.foreground = c.text
scheme.background = c.base
scheme.cursor_fg = c.crust
scheme.selection_fg = c.text
scheme.selection_bg = c.surface2
scheme.scrollbar_thumb = c.surface2
scheme.split = c.overlay0
scheme.ansi[1] = c.surface1
scheme.ansi[8] = c.subtext1
scheme.brights[1] = c.surface2
scheme.brights[8] = c.subtext0
scheme.visual_bell = c.surface0
-- I don't use tab bar so not really needed
scheme.tab_bar.background = c.crust
scheme.tab_bar.active_tab.fg_color = c.crust
scheme.tab_bar.inactive_tab.bg_color = c.mantle
scheme.tab_bar.inactive_tab.fg_color = c.text
scheme.tab_bar.inactive_tab_hover.bg_color = c.base
scheme.tab_bar.inactive_tab_hover.fg_color = c.text
scheme.tab_bar.new_tab.bg_color = c.surface0
scheme.tab_bar.new_tab.fg_color = c.text
scheme.tab_bar.new_tab_hover.bg_color = c.surface1
scheme.tab_bar.new_tab_hover.fg_color = c.text
scheme.tab_bar.inactive_tab_edge = c.surface0
config.color_schemes = { ["Catppuccin Coal"] = scheme }
config.color_scheme = "Catppuccin Coal"
if isMac then
config.font_size = 16
config.window_decorations = "RESIZE"
elseif isNix then
config.enable_wayland = true
config.window_decorations = "NONE"
-- Fix for cursor disappearing in gnome
-- https://github.com/wez/wezterm/issues/1742#issuecomment-1075333507
local xcursor_size = nil
local xcursor_theme = nil
local success, stdout, stderr = wezterm.run_child_process({"gsettings", "get", "org.gnome.desktop.interface", "cursor-theme"})
if success then
xcursor_theme = stdout:gsub("'(.+)'\n", "%1")
end
local success, stdout, stderr = wezterm.run_child_process({"gsettings", "get", "org.gnome.desktop.interface", "cursor-size"})
if success then
xcursor_size = tonumber(stdout)
end
config.xcursor_theme = xcursor_theme
config.xcursor_size = xcursor_size
end
config.window_frame = {
font = wezterm.font({ family = "JetBrains Mono", weight = "Bold" }),
}
config.enable_tab_bar = false
-- config.colors = {
-- tab_bar = {
-- active_tab = {
-- bg_color = "#1c1c1c",
-- fg_color = "#ababab",
-- },
-- },
-- }
config.font = wezterm.font_with_fallback({
{
family = "JetBrainsMono Nerd Font Mono",
weight = "Regular",
},
{ family = "Terminus" },
})
-- wezterm.on("format-tab-title", function(tab)
-- local p = tab.active_pane
-- local idx = tab.is_active and "" or tab.tab_index + 1
-- local dir = basename(p.current_working_dir)
-- local title = idx .. " " .. dir
-- local proc = basename(p.foreground_process_name)
-- if proc ~= "zsh" then
-- title = title .. " " .. proc
-- end
-- return title
-- end)
return config

View file

@ -0,0 +1,6 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.wezterm ];
home.file.".wezterm.lua".source = ./wezterm.lua;
}

View file

@ -0,0 +1,9 @@
{ ... }:
{
programs.zoxide = {
enable = true;
enableZshIntegration = true;
options = [ "--cmd cd" ];
};
}

View file

@ -0,0 +1,29 @@
{ ... }:
{
programs.zsh = {
enable = true;
enableAutosuggestions = true;
shellAliases = { };
defaultKeymap = "emacs";
profileExtra = ''
# Make home/end and ctrl + left/right nav how I expect them to like in bash
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey '^[[1;5D' emacs-backward-word
bindkey '^[[1;5C' emacs-forward-word
# Auto completion/suggestions/and case insensitivity
autoload -Uz compinit && compinit
setopt correct
setopt extendedglob
setopt nocaseglob
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion
zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
zstyle ':completion:*' rehash true # automatically find new executables in path
'';
};
}