refactor to use common components

This commit is contained in:
RingOfStorms (Josh) 2024-05-11 12:07:42 -05:00
parent 1ec7eadcb8
commit c3644453ca
12 changed files with 62 additions and 222 deletions

View file

@ -38,6 +38,10 @@ in
file = /${settings.secretsDir}/nix2t.age; file = /${settings.secretsDir}/nix2t.age;
owner = settings.user.username; owner = settings.user.username;
}; };
nix2l001 = {
file = /${settings.secretsDir}/nix2l001.age;
owner = settings.user.username;
};
}; };
}; };
} }

32
secrets/nix2l001.age Normal file
View file

@ -0,0 +1,32 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IDd6MzN5USBZK2x2
S2tVOWplL3ZnaFI1NjhpTHlDS0lCOXdjVFExd21jSEE5UVNDUGdjClBNNU1ZbWtt
SWNuSGkyRVo4aTlhbkxWNkN5Wk9MTnFyOTJFOXFucTgyR2cKLT4gc3NoLWVkMjU1
MTkgSmh2TCtRIDRwcjYyWk5TcVlWWUY2bzBRamhIZXlIcW5DNjczcTdRNWhhZVQ5
ekIxaU0KbUNFUWdDR1dHRldGZjJvOUVPMlZ0MkZ5L25tRTNTVTJ6MHpsck0xWkVU
OAotPiBzc2gtZWQyNTUxOSBTcENqQlEgOFVvSzhVdXN6SzZnTjBQREVVS1phWFpQ
K0NhUGo5ZlhhMVBLRHIzcW1SOAp3OEZDWHFyZFhFZUdVQWRid1RNK0x1QTFJWU5D
eExaOGRod2M1QmY3TmNRCi0+IHNzaC1lZDI1NTE5IEJZS0crdyB0dUh3dUo5MHNi
OHNnU3g5K25lV0Z0dW93UFJXR1RWTXdxd0RzRFFOTUFrCk9XTEdHdGpNT1YzVzJI
YmdoZGJ0Wmpuekd4ZmdENFIwamlkODBGVGszdVUKLT4gc3NoLWVkMjU1MTkgWHpm
bWFRIEdyVEFDSkNqWWRiSlZpSEhLTnVQQlJqMFlUcTNmanNocjVSdkhQWlVHQncK
U2VNZENPNGJKR0dsRndMZHliNkltQ3hyekFIb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DAbAklCB4nvrm9YK0
F34NM92QHy0zB6h8Gg7s1TzSpdiMzkQPy7KeC6z2T8FafjE8ika6ULiBFsTPzSzL
rEjAhooKaxFK
-----END AGE ENCRYPTED FILE-----

View file

@ -18,19 +18,25 @@ let
]; ];
in in
{ {
## Too make a new secret: `ragenix --editor=vi -v -e FILE.age` add file below and in the ragenix.nix file ## To make a new secret: `ragenix --editor=vi -v -e FILE.age` add file below and in the ragenix.nix file
# #
# TODO come up with a rotate method/encrypt the device keys better. This isn't very secure feeling to me the way I am doing this now. If anyone gains access to any one of my devices, then my secrets are no longer secret. This is not a good model. # TODO come up with a rotate method/encrypt the device keys better. This isn't very secure feeling to me the way I am doing this now. If anyone gains access to any one of my devices, then my secrets are no longer secret. This is not a good model.
# Git keys
"nix2github.age" = { "nix2github.age" = {
inherit publicKeys; inherit publicKeys;
}; };
"nix2bitbucket.age" = { "nix2bitbucket.age" = {
inherit publicKeys; inherit publicKeys;
}; };
# Server keys
"nix2h001.age" = { "nix2h001.age" = {
inherit publicKeys; inherit publicKeys;
}; };
"nix2t.age" = { "nix2t.age" = {
inherit publicKeys; inherit publicKeys;
}; };
"nix2l001.age" = {
inherit publicKeys;
};
} }

View file

@ -12,6 +12,7 @@
"h001" = { "h001" = {
identityFile = age.secrets.nix2h001.path; identityFile = age.secrets.nix2h001.path;
# TODO come back to these 10.12.14.## addrs and change them to intranet IP's instead of local network. # TODO come back to these 10.12.14.## addrs and change them to intranet IP's instead of local network.
# LOCAL HOME NETWORK ONLY
hostname = "10.12.14.2"; hostname = "10.12.14.2";
user = "root"; user = "root";
}; };
@ -32,6 +33,11 @@
} }
]; ];
}; };
"l001" = {
identityFile = age.secrets.nix2l001.path;
hostname = "172.105.22.34";
user = "root";
};
}; };
}; };
} }

View file

@ -1,4 +1,4 @@
{ lib, ylib, settings, ... }: { settings, ... }:
{ {
imports = [ imports = [
(settings.usersDir + "/_common/components/home_manager/tmux/tmux.nix") (settings.usersDir + "/_common/components/home_manager/tmux/tmux.nix")

View file

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

View file

@ -1,43 +0,0 @@
{ ... }:
{
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

@ -1,61 +0,0 @@
# 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 -c "#{pane_current_path}"
bind ',' command-prompt "rename-window %%"
bind "\|" split-window -h -c "#{pane_current_path}"
bind "\\" split-window -v -c "#{pane_current_path}"
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 -r space resize-pane -Z
bind S 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 : 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
set -sg escape-time 0

View file

@ -1,65 +0,0 @@
{ 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";
shell = "${pkgs.zsh}/bin/zsh";
terminal = "screen-256color";
aggressiveResize = true;
sensibleOnTop = false;
plugins = [
{
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

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

View file

@ -1,29 +0,0 @@
{ ... }:
{
programs.zsh = {
enable = true;
autosuggestion.enable = true;
shellAliases = { };
defaultKeymap = "emacs";
initExtra = ''
# 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
'';
};
}

View file

@ -0,0 +1,12 @@
{ settings, ... }:
{
imports = [
(settings.usersDir + "/_common/components/home_manager/tmux/tmux.nix")
(settings.usersDir + "/_common/components/home_manager/atuin.nix")
(settings.usersDir + "/_common/components/home_manager/starship.nix")
(settings.usersDir + "/_common/components/home_manager/zoxide.nix")
(settings.usersDir + "/_common/components/home_manager/zsh.nix")
];
}