use imports and split programs into their own files for organization

This commit is contained in:
= 2024-03-11 03:30:34 -05:00
parent 88107ecd41
commit a442323649
25 changed files with 850 additions and 357 deletions

View file

@ -1,30 +0,0 @@
{
# 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";
}

24
flake.lock generated
View file

@ -16,9 +16,31 @@
"type": "github"
}
},
"nypkgs": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1710063049,
"narHash": "sha256-cKiaLtaLKHspCnLSweW3YEEwo3XfvTEFTbopLRSVzbc=",
"owner": "yunfachi",
"repo": "nypkgs",
"rev": "a003afbe194af34a443319619d5f9c074b1f16c7",
"type": "github"
},
"original": {
"owner": "yunfachi",
"ref": "master",
"repo": "nypkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"nypkgs": "nypkgs"
}
}
},

View file

@ -2,11 +2,20 @@
description = "My systems flake";
inputs = {
# Nix utility methods
nypkgs = {
url = "github:yunfachi/nypkgs/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# Pinned nix version
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-23.11-small";
# TODO
# home-manager = { };
};
outputs = { self, nixpkgs, ... } @ args:
outputs = { self, nypkgs, nixpkgs, ... } @ args:
let
nixosSystem = nixpkgs.lib.nixosSystem;
mkMerge = nixpkgs.lib.mkMerge;
@ -19,18 +28,25 @@
};
user = {
username = "josh";
git = {
email = "ringofstorms@gmail.com";
name = "RingOfStorms (Joshua Bell)";
};
};
usersDir = ./users;
systemsDir = ./systems;
commonDir = ./_common;
flakeDir = ./.;
};
ypkgs = nypkgs.legacyPackages.${settings.system.architecture};
ylib = ypkgs.lib;
in
{
nixosConfigurations.${settings.system.hostname} = nixosSystem {
system = settings.system.architecture;
modules = [ ./systems/_common/configuration.nix ./systems/${settings.system.hostname}/configuration.nix ];
specialArgs = args // { inherit settings; };
specialArgs = args // { inherit settings; inherit ylib; };
};
# homeConfigurations = { };
};

View file

@ -24,6 +24,16 @@ I used the existing windows 100MB boot partition and it fills up constantly. Hav
# TODO
- Use top level split out home manager configurations instead of the one built into the system config...
- get dot files setup better (see todo comment on wezterm config)
- Make a flake for neovim and move out some system packages required for that into that flake, re-use for root and user rather than cloning each place?
- EDITOR env var set to neovim
- gif command from video
```sh
gif () {
if [[ -z $1 ]]; then
echo "No gif specified"
return 1
fi
ffmpeg -i $1 -filter_complex "fps=7,scale=iw:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=32[p];[s1][p]paletteuse=dither=bayer" $1".gif"
}
```
-

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, settings, ... }:
{ config, lib, pkgs, settings, ylib, ... }:
let
home-manager = builtins.fetchTarball {
url = "https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz";
@ -23,7 +23,7 @@ in
security.polkit.enable = true;
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
home-manager.extraSpecialArgs = { inherit settings; };
home-manager.extraSpecialArgs = { inherit settings; inherit ylib; };
# ==========
# Common
@ -45,5 +45,55 @@ in
LC_TIME = settings.system.defaultLocale;
};
# Some basics
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
# Basics
neovim
vim
wget
curl
neofetch
bat
htop
nvtop
unzip
git
fzf
ripgrep
];
environment.shellAliases = {
n = "nvim";
nn = "nvim --headless '+SessionDelete' +qa > /dev/null 2>&1 && nvim";
bat = "bat --theme Coldark-Dark";
cat = "bat --pager=never -p";
nix-boot-clean = "find '/boot/loader/entries' -type f | head -n -4 | xargs -I {} rm {}; nix-collect-garbage -d; nixos-rebuild boot; echo; df";
# general unix
date_compact = "date +'%Y%m%d'";
date_short = "date +'%Y-%m-%d'";
ls = "ls --color -Ga";
ll = "ls --color -Gal";
lss = "du --max-depth=0 -h * 2>/dev/null";
psg = "ps aux | head -n 1 && ps aux | grep -v 'grep' | grep";
cl = "clear";
# git
stash = "git stash";
pop = "git stash pop";
branch = "git checkout -b";
status = "git status";
diff = "git diff";
branches = "git branch -a";
gcam = "git commit -a -m";
stashes = "git stash list";
# ripgrep
rg="rg --no-ignore";
rgf="rg --files 2>/dev/null | rg";
};
environment.shellInit = builtins.readFile ./shellInit.sh;
system.stateVersion = "23.11";
}

View file

@ -0,0 +1,131 @@
# basics
htop_psg () {
htop -p $(psg $1 | awk '{r=r s $2;s=","} END{print r}')
}
htop_pid () {
htop -p $(ps -ef | awk -v proc=$1 '$3 == proc { cnt++;if (cnt == 1) { printf "%s",$2 } else { printf ",%s",$2 } }')
}
kill_psg() {
PIDS=$(ps aux | grep -v "grep" | grep ${1} | awk '{print $2}')
echo Killing ${PIDS}
for pid in ${PIDS}; do
kill -9 ${pid} &> /dev/null
done
}
term_psg() {
assert_command awk
assert_command grep
PIDS=$(ps aux | grep -v "grep" | grep ${1} | awk '{print $2}')
echo Terminating ${PIDS}
for pid in ${PIDS}; do
kill -15 ${pid} &> /dev/null
done
}
skill_psg() {
PIDS=$(ps aux | grep -v "grep" | grep ${1} | awk '{print $2}')
echo Quitting ${PIDS}
for pid in ${PIDS}; do
sudo kill -9 ${pid} &> /dev/null
done;
}
mail_clear() {
: > /var/mail/$USER
}
# git
getdefault () {
assert_command git
assert_command grep
assert_command sed
git remote show origin | grep "HEAD branch" | sed 's/.*: //'
}
master () {
assert_command git
git stash
git checkout $(getdefault)
pull
}
mp () {
master
prunel
}
pullmaster () {
assert_command git
git pull origin $(getdefault)
}
push () {
assert_command git
assert_command sed
B=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git pull origin $B
git push origin $B --no-verify
}
pull () {
assert_command git
assert_command sed
git fetch
B=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git pull origin $B
}
forcepush () {
assert_command git
assert_command sed
B=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git push origin $B --force
}
remote_branches () {
assert_command git
assert_command grep
git branch -a | grep 'remotes' | grep -v -E '.*(HEAD|${DEFAULT})' | cut -d'/' -f 3-
}
local_branches () {
assert_command git
assert_command grep
assert_command cut
git branch -a | grep -v 'remotes' | grep -v -E '.*(HEAD|${DEFAULT})' | grep -v '^*' | cut -d' ' -f 3-
}
prunel () {
assert_command git
git fetch
git remote prune origin
for local in $(local_branches); do
in=false
for remote in $(remote_branches); do
if [[ ${local} = ${remote} ]]; then
in=true
fi
done;
if [[ $in = 'false' ]]; then
git branch -D ${local}
else
echo 'Skipping branch '${local}
fi
done;
}
checkout () {
assert_command git
git fetch
git checkout $1
pull
}
from_master () {
assert_command git
git checkout $(getdefault) $@
}

View file

@ -96,7 +96,10 @@ in
shell = pkgs.zsh;
};
# TODO how to do this from home manager file instead
environment.pathsToLink = [ "/share/fish" ];
environment.pathsToLink = [ "/share/zsh" ];
programs.zsh = {
enable = true;
};
home-manager.users.${settings.user.username} = homeManagerUser;
services.xserver.enable = true;
@ -108,17 +111,6 @@ in
# $ nix search wget
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
# Basics
neovim
vim
wget
curl
neofetch
bat
htop
nvtop
unzip
git
# [Laptop] Battery status
acpi
# extras, more for my neovim setup TODO move these into a more isolated place for nvim setup? Should be its own flake probably
@ -126,23 +118,13 @@ in
rustc
nodejs_21
python313
ripgrep
# ripgrep # now in common
nodePackages.cspell
#
fzf
];
programs.zsh = {
enable = true;
};
# does for all shells. Can use `programs.zsh.shellAliases` for specific ones
environment.shellAliases = {
n = "nvim";
battery = "acpi";
wifi = "nmtui";
bat = "bat --theme Coldark-Dark";
cat = "bat --pager=never -p";
nix-boot-clean = "find '/boot/loader/entries' -type f | head -n -4 | xargs -I {} rm {}; nix-collect-garbage -d; nixos-rebuild boot; echo; df";
};
}

View file

@ -1,8 +1,9 @@
{ pkgs, settings, ... }: {
{ settings, ylib, ... } @ args: {
home.stateVersion = "23.11";
programs.home-manager.enable = true;
home.username = settings.user.username;
home.homeDirectory = "/home/${settings.user.username}";
programs.home-manager.enable = true;
imports = ylib.umport { paths = [ ./programs ]; recursive = true; };
}

View file

@ -0,0 +1,55 @@
{ settings, ... }:
{
programs.git = {
enable = true;
userEmail = settings.user.git.email;
userName = settings.user.git.name;
extraConfig = {
core.pager = "cat";
core.editor = "nvim";
pull.rebase = false;
};
difftastic = {
enable = true;
background = "dark";
};
# TODO move from common system? Need root user home managed too...
# aliases: {}
ignores = [
# --------------
# Intellij
# --------------
"*.iml"
# --------------
# MAC OS
# --------------
".DS_Store"
".AppleDouble"
".LSOverride"
# Icon must end with two \r
"Icon"
# Thumbnails
"._*"
# Files that might appear in the root of a volume
".DocumentRevisions-V100"
".fseventsd"
".Spotlight-V100"
".TemporaryItems"
".Trashes"
".VolumeIcon.icns"
".com.apple.timemachine.donotpresent"
# Directories potentially created on remote AFP share
".AppleDB"
".AppleDesktop"
"Network Trash Folder"
"Temporary Items"
".apdisk"
];
};
}

View file

@ -1,82 +0,0 @@
{ pkgs, ... }:
{
"org/gnome/shell" = {
favorite-apps = [
"vivaldi-stable.desktop"
"org.wezfurlong.wezterm.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 = [ "" ];
};
"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-down = [ "" ];
move-to-workspace-last = [ "" ];
move-to-workspace-left = [ "" ];
move-to-workspace-right = [ "" ];
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/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 = [ "" ];
};
}

View file

@ -1,217 +1,16 @@
{ pkgs, lib, settings, ... } @ args:
let
# TODO update to be in this config normally
# cursor fix? https://github.com/wez/wezterm/issues/1742#issuecomment-1075333507
weztermConfig = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/RingOfStorms/setup/72635c6674540bfefa2325f69e6ee6de9a11a62b/home/dotfiles/wezterm.lua";
sha256 = "sha256-kwbg9S9IHhAw6RTPvRjqGew5qz8a8VxjqonkgEKGtys=";
};
tmux = pkgs.tmuxPlugins;
in
{ settings, ylib, ... } @ _args:
{
imports = [
(settings.usersDir + "/_common/home.nix")
];
home.packages = with pkgs; [
firefox-esr
wezterm
vivaldi
ollama
# Desktop Environment stuff
wofi # app launcher TODO configure this somehow
gnome.dconf-editor # use `dump dconf /` before and after and diff the files for easy editing of dconf below
gnomeExtensions.workspace-switch-wraparound
#gnome.gnome-tweaks
#gnomeExtensions.forge # probably dont need on this on tiny laptop but may explore this instead of sway for my desktop
];
home.file.".wezterm.lua".source = weztermConfig; # todo actual configure this in nix instead of pulling from existing one. Maybe lookup the more official home manager dotfile solutions instead of inline
home.file.".psqlrc".text = ''
\pset pager off
'';
programs.zsh = {
enable = true;
enableAutosuggestions = true;
};
# 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 ''
# Reset everything then add what we want exactly
unbind-key -a
# Window stuff
bind -r H previous-window
bind -r L next-window
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
bind r command-prompt "rename-window %%"
bind | split-window -h -c "#{pane_current_path}"
bind \\ split-window -v -c "#{pane_current_path}"
bind t new-window
bind T command-prompt -p "window name:" "new-window; rename-window '%%'"
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
# Sessions
bind C-s command-prompt -p "session name:" "new-session -s '%%'"
bind C-r command-prompt "rename-session %%"
bind -r C-L switch-client -n
bind -r C-H switch-client -p
# Pane stuff
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
bind -r , resize-pane -L 20
bind -r . resize-pane -R 20
bind -r - resize-pane -D 7
bind -r = resize-pane -U 7
bind q kill-pane
bind w kill-window
bind x swap-pane -D
# Tmux util
bind p paste-buffer
bind X source-file ~/.config/tmux/tmux.conf
bind z resize-pane -Z
bind : command-prompt
bind ^Q 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
'';
programs.tmux = {
enable = true;
# Revisit this later, permission denied to make anything in run as my user...
secureSocket = false;
shortcut = "a";
prefix = "C-a";
baseIndex = 1;
mouse = true;
keyMode = "vi";
newSession = true;
shell = "${pkgs.zsh}/bin/zsh";
terminal = "screen-256color";
aggressiveResize = true;
plugins = [
{
plugin = tmux.sessionist;
extraConfig = ''
set -g @sessionist-join-pane "j"
set -g @sessionist-goto "o"
set -g @default_key_bindings_new "UNSET"
'';
imports =
# Common settings all users share
[ (settings.usersDir + "/_common/home.nix") ]
# User programs
++ ylib.umport {
paths = [ ./programs ];
recursive = true;
}
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=";
# User theme
++ ylib.umport {
paths = [ ./theme ];
recursive = true;
};
});
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"
'';
}
];
};
programs.atuin = {
enable = true;
enableZshIntegration = true;
flags = [ "--disable-up-arrow" ];
settings = {
workspaces = true;
exit-mode = "return-query";
enter_accept = true;
};
};
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
add_newline = false;
palette = "catppuccin_coal";
palettes.catppuccin_coal = import "${settings.commonDir}/catppuccin_coal.nix";
};
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
options = [ "--cmd cd" ];
};
dconf = {
enable = true;
settings = (import ./gnome_settings.nix args);
};
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,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.firefox-esr ];
}

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,57 @@
# Reset everything then add what we want exactly
unbind-key -a
# Window stuff
bind -r H previous-window
bind -r L next-window
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
bind r command-prompt "rename-window %%"
bind | split-window -h -c "#{pane_current_path}"
bind \\ split-window -v -c "#{pane_current_path}"
bind t new-window
bind T command-prompt -p "window name:" "new-window; rename-window '%%'"
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
# Sessions
bind C-s command-prompt -p "session name:" "new-session -s '%%'"
bind C-r command-prompt "rename-session %%"
bind -r C-L switch-client -n
bind -r C-H switch-client -p
# Pane stuff
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
bind -r , resize-pane -L 20
bind -r . resize-pane -R 20
bind -r - resize-pane -D 7
bind -r = resize-pane -U 7
bind q kill-pane
bind w kill-window
bind x swap-pane -D
# Tmux util
bind p paste-buffer
bind X source-file ~/.config/tmux/tmux.conf
bind z resize-pane -Z
bind : command-prompt
bind ^Q 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,77 @@
{ 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;
shortcut = "a";
prefix = "C-a";
baseIndex = 1;
mouse = true;
keyMode = "vi";
newSession = true;
shell = "${pkgs.zsh}/bin/zsh";
terminal = "screen-256color";
aggressiveResize = true;
plugins = [
{
plugin = tmux.sessionist;
extraConfig = ''
set -g @sessionist-join-pane "j"
set -g @sessionist-goto "o"
set -g @default_key_bindings_new "UNSET"
'';
}
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"
'';
}
];
};
}

View file

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

View file

@ -0,0 +1,168 @@
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.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,20 @@
{ ... }:
{
programs.zsh = {
enable = true;
enableAutosuggestions = true;
shellAliases = { };
profileExtra = ''
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
'';
};
}

View file

@ -0,0 +1,97 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
# use `dump dconf /` before and after and diff the files for easy editing of dconf below
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/shell" = {
favorite-apps = [
"vivaldi-stable.desktop"
"org.wezfurlong.wezterm.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 = [ "" ];
};
"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>Down" ];
move-to-workspace-up = [ "<Control><Super>Up" ];
move-to-workspace-left = [ "<Control><Super>Left" ];
move-to-workspace-right = [ "<Control><Super>Right" ];
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/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" ];
};
};
};
}

25
users/josh/theme/gtk.nix Normal file
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";
}