diff --git a/; b/; new file mode 100644 index 0000000..dad5d18 --- /dev/null +++ b/; @@ -0,0 +1,33 @@ +{ + lib, + options, + machine, + ... +}: +with lib; +{ + options = { + custom.program = mkOption { + type = types.attrsOf ( + types.submodule ( + { config, ... }: + { + options = { + name = mkOption { + type = types.string; + }; + home-config = mkOption { + type = types.deferredModule; + }; + system-config = mkOption { + type = types.deferredModule; + default = _: { }; + }; + }; + config = if builtins.isNull machine.home-only then config.system-config else config.home-config; + } + ) + ); + }; + }; +} diff --git a/hosts/fili/services/factorio/default.nix b/hosts/fili/services/factorio/default.nix index 89a92a6..80815ba 100644 --- a/hosts/fili/services/factorio/default.nix +++ b/hosts/fili/services/factorio/default.nix @@ -1,8 +1,9 @@ -{ lib -, pkgs -, config -, secrets -, ... +{ + lib, + pkgs, + config, + secrets, + ... }: let factorioVersion = @@ -60,11 +61,12 @@ let }; privateUsers = "no"; - config = - { config - , pkgs - , lib - , ... + imports = + { + config, + pkgs, + lib, + ... }: { systemd.services.factorio.serviceConfig.User = "factorio"; @@ -106,19 +108,18 @@ in }; containers = - factorioContainer "tawney" - { - autosave-interval = 20; - admins = [ - "jonay2000" - "computerdruid" - "pineapple" - ]; - extraSettingsFile = config.sops.secrets.factorio.path; - # mods = getMods .factorio-mods/tawney; - package = factorioVersion "2.0.69" "sha256-I1FHuz7WtfCmmTiTxskv3+U1upWrhmBG9R+GUoS1c0E="; - port = 20001; - } + factorioContainer "tawney" { + autosave-interval = 20; + admins = [ + "jonay2000" + "computerdruid" + "pineapple" + ]; + extraSettingsFile = config.sops.secrets.factorio.path; + # mods = getMods .factorio-mods/tawney; + package = factorioVersion "2.0.69" "sha256-I1FHuz7WtfCmmTiTxskv3+U1upWrhmBG9R+GUoS1c0E="; + port = 20001; + } // factorioContainer "snek" { autosave-interval = 20; admins = [ diff --git a/hosts/kili/configuration.nix b/hosts/kili/configuration.nix index 378d6d1..0387ab2 100644 --- a/hosts/kili/configuration.nix +++ b/hosts/kili/configuration.nix @@ -1,6 +1,7 @@ -{ pkgs -, config -, ... +{ + pkgs, + config, + ... }: { imports = [ @@ -62,27 +63,25 @@ nautilus adwaita-icon-theme - (pkgs.callPackage - ( - { stdenv }: - stdenv.mkDerivation { - name = "global-cursor-theme"; - unpackPhase = "true"; - outputs = [ "out" ]; - installPhase = '' - mkdir -p $out/share/icons/default - cat << EOF > $out/share/icons/default/index.theme - [Icon Theme] - Name=Default - Comment=Default Cursor Theme - Inherits=Adwaita - EOF - ''; - } - ) - { }) + (pkgs.callPackage ( + { stdenv }: + stdenv.mkDerivation { + name = "global-cursor-theme"; + unpackPhase = "true"; + outputs = [ "out" ]; + installPhase = '' + mkdir -p $out/share/icons/default + cat << EOF > $out/share/icons/default/index.theme + [Icon Theme] + Name=Default + Comment=Default Cursor Theme + Inherits=Adwaita + EOF + ''; + } + ) { }) - perf + config.boot.kernelPackages.perf rr ]; diff --git a/programs/default.nix b/programs/default.nix index c22ce6d..fb72b37 100644 --- a/programs/default.nix +++ b/programs/default.nix @@ -4,7 +4,6 @@ imports = lib.concatLists [ [ ./xdg.nix - ./ssh.nix ./nvim ./fish ./kanata @@ -44,10 +43,11 @@ inherit inputs; requirements = [ "graphical" ]; home-config = - { config - , pkgs - , lib - , ... + { + config, + pkgs, + lib, + ... }: let disableFeatures = [ diff --git a/programs/fish/default.nix b/programs/fish/default.nix index 5bc8d3d..9df1f8e 100644 --- a/programs/fish/default.nix +++ b/programs/fish/default.nix @@ -5,260 +5,256 @@ inputs@{ machine, ... }: inherit inputs; requirements = [ "cli" ]; home-config = - { config - , pkgs - , lib - , ... + { + config, + pkgs, + lib, + ... }: - with builtins; - with lib.attrsets; - let - scripts = (import ./scripts.nix) pkgs; - aliases = with scripts; { - "cp-mov" = cp-media "mov" "movies"; - "cp-ser" = cp-media "ser" "shows"; - "cp-ani" = cp-media "ani" "anime"; - "ragdoll" = ragdoll; - "dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm"; - "p" = calc; - "s" = "systemctl"; - "j" = "journalctl"; - "ju" = "journalctl -u"; - "jfu" = "journalctl -fu"; - "ls" = "${pkgs.eza}/bin/eza --git"; - "ll" = "${pkgs.eza}/bin/eza --git"; - "lt" = "${pkgs.eza}/bin/eza --long --tree -L 3"; - "open" = "${pkgs.xdg-utils}/bin/xdg-open"; - "cb" = "${pkgs.wl-clipboard-rs}/bin/wl-copy"; - "cat" = "${pkgs.bat}/bin/bat"; + with builtins; + with lib.attrsets; + let + scripts = (import ./scripts.nix) pkgs; + aliases = with scripts; { + "cp-mov" = cp-media "mov" "movies"; + "cp-ser" = cp-media "ser" "shows"; + "cp-ani" = cp-media "ani" "anime"; + "dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm"; + "p" = builtins.trace calc calc; + "s" = "systemctl"; + "j" = "journalctl"; + "ju" = "journalctl -u"; + "jfu" = "journalctl -fu"; + "ls" = "${pkgs.eza}/bin/eza --git"; + "ll" = "${pkgs.eza}/bin/eza --git"; + "lt" = "${pkgs.eza}/bin/eza --long --tree -L 3"; + "open" = "${pkgs.xdg-utils}/bin/xdg-open"; + "cb" = "${pkgs.wl-clipboard-rs}/bin/wl-copy"; + "cat" = "${pkgs.bat}/bin/bat"; - # "pull" = "${pkgs.git}/bin/git pull"; - # "push" = "${pkgs.git}/bin/git push"; - # "commit" = "${pkgs.git}/bin/git commit"; - # "add" = "${pkgs.git}/bin/git add"; - # "patch" = "${pkgs.git}/bin/git add -p"; - # "amend" = "${pkgs.git}/bin/git commit --amend"; - # "log" = "${pkgs.git}/bin/git log --all --graph --decorate"; - # "st" = "${pkgs.git}/bin/git status"; - # "checkout" = "${pkgs.git}/bin/git checkout"; - # "rebase" = "${pkgs.git}/bin/git rebase"; - # "stash" = "${pkgs.git}/bin/git stash"; + # "pull" = "${pkgs.git}/bin/git pull"; + # "push" = "${pkgs.git}/bin/git push"; + # "commit" = "${pkgs.git}/bin/git commit"; + # "add" = "${pkgs.git}/bin/git add"; + # "patch" = "${pkgs.git}/bin/git add -p"; + # "amend" = "${pkgs.git}/bin/git commit --amend"; + # "log" = "${pkgs.git}/bin/git log --all --graph --decorate"; + # "st" = "${pkgs.git}/bin/git status"; + # "checkout" = "${pkgs.git}/bin/git checkout"; + # "rebase" = "${pkgs.git}/bin/git rebase"; + # "stash" = "${pkgs.git}/bin/git stash"; - "edit" = "jj edit"; - "old" = "jj edit @-"; - "new" = "jj edit @+"; - "rebase" = "jj rebase"; - "pull" = "jj git fetch; jj catchup"; - "msg" = "jj describe -m"; - "branch" = "jj bookmark set"; - "stat" = "jj status"; - "push" = "jj git push"; + "edit" = "jj edit"; + "old" = "jj edit @-"; + "new" = "jj edit @+"; + "rebase" = "jj rebase"; + "pull" = "jj git fetch; jj catchup"; + "msg" = "jj describe -m"; + "branch" = "jj bookmark set"; + "stat" = "jj status"; + "push" = "jj git push"; - "tidy" = "x test tidy --bless"; - "ui" = "x test tests/ui/"; + "tidy" = "x test tidy --bless"; + "ui" = "x test tests/ui/"; - "f" = "nautilus --no-desktop . &"; - }; - # extracting any compressed format - extract = '' - function extract -a file -d "decompress a file" - if not test -f $file - echo "'$file' is not a valid file" - return 1 - end - switch $file - # tar can automatically figure out how to decompress - case '*.{tar,tar.{bz2,zst,gz,xz},tbz2,tgz'; ${pkgs.gnutar}/bin/tar xf $file; end - case '*.bz2'; bunzip2 $file; end - case '*.rar'; unrar e $file; end - case '*.gz'; gunzip $file; end - case '*.zip'; ${pkgs.unzip}/bin/unzip $file; end - case '*.Z'; uncompress $file; end - case '*.7z'; 7z x $file; end - case '*'; - echo "'$file' cannot be extracted" - return 1 - end + "f" = "nautilus --no-desktop . &"; + }; + # extracting any compressed format + extract = '' + function extract -a file -d "decompress a file" + if not test -f $file + echo "'$file' is not a valid file" + return 1 end - ''; - in - { - programs = { - atuin = { - enable = true; - enableFishIntegration = true; + switch $file + # tar can automatically figure out how to decompress + case '*.{tar,tar.{bz2,zst,gz,xz},tbz2,tgz'; ${pkgs.gnutar}/bin/tar xf $file; end + case '*.bz2'; bunzip2 $file; end + case '*.rar'; unrar e $file; end + case '*.gz'; gunzip $file; end + case '*.zip'; ${pkgs.unzip}/bin/unzip $file; end + case '*.Z'; uncompress $file; end + case '*.7z'; 7z x $file; end + case '*'; + echo "'$file' cannot be extracted" + return 1 + end + end + ''; + in + { + programs = { + atuin = { + enable = true; + enableFishIntegration = true; - settings = { - filter_mode_shell_up_key_binding = "workspace"; - exit_mode = "return-original"; - inline_height = 20; - workspaces = true; - }; - }; - - zoxide = { - enable = true; - enableFishIntegration = true; - }; - - direnv = { - enable = true; - # enableFishIntegration = lib.mkDefault true; - }; - - fzf = { - enable = true; - enableFishIntegration = true; - }; - - fish = { - enable = true; - shellAliases = aliases; - plugins = with pkgs.fishPlugins; [ - { - name = "bang-bang"; - src = pkgs.fetchFromGitHub { - owner = "oh-my-fish"; - repo = "plugin-bang-bang"; - rev = "ec991b80ba7d4dda7a962167b036efc5c2d79419"; - hash = "sha256-oPPCtFN2DPuM//c48SXb4TrFRjJtccg0YPXcAo0Lxq0="; - }; - } - { - name = "tide"; - inherit (tide) src; - } - { - name = "sponge"; - inherit (sponge) src; - } - { - name = "autopair"; - inherit (autopair) src; - } - ]; - - functions = { - fish_jj_prompt = { - body = '' - if not ${config.programs.jujutsu.package}/bin/jj root --quiet &>/dev/null - return 1 - end - - ${config.programs.jujutsu.package}/bin/jj log --ignore-working-copy --no-graph --color always -r @ -T ' - separate( - " ", - bookmarks.join(", "), - change_id.shortest(), - commit_id.shortest(), - if(conflict, "conflict"), - if(empty, "empty"), - if(divergent, "divergent"), - if(hidden, "hidden"), - ) - ' - ''; - }; - - _tide_item_jj = { - body = '' - set -l _tide_item_jj_color $_tide_location_color - echo -ns $_tide_item_jj_color" ("(fish_jj_prompt)$_tide_item_jj_color")" - ''; - }; - - _tide_item_git = { - body = '' - if not test -d .jj - fish_git_prompt '%s' - end - ''; - }; - }; - - interactiveShellInit = '' - fish_vi_key_bindings - - bind \e\[3\;5~ kill-word - bind \cH backward-kill-word - bind \cV beginning-of-line - bind \f end-of-line - - bind -M insert \e\[3\;5~ kill-word - bind -M insert \cH backward-kill-word - bind -M insert \cV beginning-of-line - bind -M insert \f end-of-line - - bind \cl 'clear; commandline -f repaint' - bind -M insert \cl 'clear; commandline -f repaint' - - set -g sponge_successful_exit_codes 0 - set -g sponge_allow_previously_successful false - set -g sponge_delay 10 - - ${config.programs.jujutsu.package}/bin/jj util completion fish | source - - # if set -q tide_left_prompt_items; and not contains "jj" $tide_left_prompt_items - # set -l tide_item_jj_idx (contains -i "pwd" $tide_left_prompt_items) - # if test $tide_item_jj_idx - # set tide_left_prompt_items \ - # $tide_left_prompt_items[1..$tide_item_jj_idx] \ - # jj \ - # $tide_left_prompt_items[(math $tide_item_jj_idx + 1)..-1] - # end - # end - - function t - cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)" - end - - function temp - t $argv - end - - function rs - cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)" - cargo init . --bin --name $(basename "$PWD") - vim src/main.rs - end - - fish_add_path "$HOME/.cargo/bin" - fish_add_path "$HOME/.local/bin" - fish_add_path "$HOME/Documents/scripts" - fish_add_path "$HOME/.nix-profile/bin" - - function fish_greeting - ${pkgs.blahaj}/bin/blahaj -s - echo "mrow! This is $(uname -n) and ur $(whoami) :3" - end - ''; + settings = { + filter_mode_shell_up_key_binding = "workspace"; + exit_mode = "return-original"; + inline_height = 20; + workspaces = true; }; }; - home.activation = { - setupTide = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - setupTide() { - ${pkgs.fish}/bin/fish -c ${lib.escapeShellArg "tide configure ${ - lib.cli.toCommandLineShell (optionName: { - option = if builtins.stringLength optionName > 1 then "--${optionName}" else "-${optionName}"; - sep = null; - explicitBool = false; - }) { - auto = true; - style = "Lean"; - prompt_colors = "True color"; - show_time = "No"; - lean_prompt_height = "Two lines"; - prompt_connection = "Disconnected"; - prompt_spacing = "Compact"; - icons = "Few icons"; - transient = "Yes"; - } - }"} >/dev/null 2>&1 + zoxide = { + enable = true; + enableFishIntegration = true; + }; + + direnv = { + enable = true; + # enableFishIntegration = lib.mkDefault true; + }; + + fzf = { + enable = true; + enableFishIntegration = true; + }; + + fish = { + enable = true; + shellAliases = aliases; + plugins = with pkgs.fishPlugins; [ + { + name = "bang-bang"; + src = pkgs.fetchFromGitHub { + owner = "oh-my-fish"; + repo = "plugin-bang-bang"; + rev = "ec991b80ba7d4dda7a962167b036efc5c2d79419"; + hash = "sha256-oPPCtFN2DPuM//c48SXb4TrFRjJtccg0YPXcAo0Lxq0="; + }; } - setupTide + { + name = "tide"; + inherit (tide) src; + } + { + name = "sponge"; + inherit (sponge) src; + } + { + name = "autopair"; + inherit (autopair) src; + } + ]; + + functions = { + fish_jj_prompt = { + body = '' + if not ${config.programs.jujutsu.package}/bin/jj root --quiet &>/dev/null + return 1 + end + + ${config.programs.jujutsu.package}/bin/jj log --ignore-working-copy --no-graph --color always -r @ -T ' + separate( + " ", + bookmarks.join(", "), + change_id.shortest(), + commit_id.shortest(), + if(conflict, "conflict"), + if(empty, "empty"), + if(divergent, "divergent"), + if(hidden, "hidden"), + ) + ' + ''; + }; + + _tide_item_jj = { + body = '' + set -l _tide_item_jj_color $_tide_location_color + echo -ns $_tide_item_jj_color" ("(fish_jj_prompt)$_tide_item_jj_color")" + ''; + }; + + _tide_item_git = { + body = '' + if not test -d .jj + fish_git_prompt '%s' + end + ''; + }; + }; + + interactiveShellInit = '' + fish_vi_key_bindings + + bind \e\[3\;5~ kill-word + bind \cH backward-kill-word + bind \cV beginning-of-line + bind \f end-of-line + + bind -M insert \e\[3\;5~ kill-word + bind -M insert \cH backward-kill-word + bind -M insert \cV beginning-of-line + bind -M insert \f end-of-line + + bind \cl 'clear; commandline -f repaint' + bind -M insert \cl 'clear; commandline -f repaint' + + set -g sponge_successful_exit_codes 0 + set -g sponge_allow_previously_successful false + set -g sponge_delay 10 + + ${config.programs.jujutsu.package}/bin/jj util completion fish | source + + # if set -q tide_left_prompt_items; and not contains "jj" $tide_left_prompt_items + # set -l tide_item_jj_idx (contains -i "pwd" $tide_left_prompt_items) + # if test $tide_item_jj_idx + # set tide_left_prompt_items \ + # $tide_left_prompt_items[1..$tide_item_jj_idx] \ + # jj \ + # $tide_left_prompt_items[(math $tide_item_jj_idx + 1)..-1] + # end + # end + + function t + cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)" + end + + function temp + t $argv + end + + function rs + cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)" + cargo init . --bin --name $(basename "$PWD") + vim src/main.rs + end + + fish_add_path "$HOME/.cargo/bin" + fish_add_path "$HOME/.local/bin" + fish_add_path "$HOME/Documents/scripts" + fish_add_path "$HOME/.nix-profile/bin" + + function fish_greeting + ${pkgs.blahaj}/bin/blahaj -s + echo "mrow! This is $(uname -n) and ur $(whoami) :3" + end ''; }; }; + + home.activation = { + setupTide = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + setupTide() { + ${pkgs.fish}/bin/fish -c ${lib.escapeShellArg "tide configure ${ + lib.cli.toGNUCommandLineShell { } { + auto = true; + style = "Lean"; + prompt_colors = "True color"; + show_time = "No"; + lean_prompt_height = "Two lines"; + prompt_connection = "Disconnected"; + prompt_spacing = "Compact"; + icons = "Few icons"; + transient = "Yes"; + } + }"} >/dev/null 2>&1 + } + setupTide + ''; + }; + }; }; } diff --git a/programs/fish/scripts.nix b/programs/fish/scripts.nix index c5324d8..465b3ea 100644 --- a/programs/fish/scripts.nix +++ b/programs/fish/scripts.nix @@ -22,16 +22,4 @@ ''; in "${s}/bin/cp-${name}"; - - ragdoll = "${pkgs.writeScriptBin "ragdoll" '' - RAND=$(xxd -l 32 -c 32 -p < /dev/urandom) - if [ -z "$TMUX_SESSION_NAME" ]; then - RAND=$(cat /dev/urandom | head -c 20 | base32) - export TMUX_SESSION_NAME="$RAND" - tmux rename-session -t "$(tmux display-message -p "#S")" "$TMUX_SESSION_NAME" - fi - - SSH_TMUX_SESSION_NAME="ssh-from-$(hostname)-$TMUX_SESSION_NAME" - tmux detach -E "kitten ssh -t ragdoll \"export TMUX_SESSION_NAME=$SSH_TMUX_SESSION_NAME; tmux attach -t $SSH_TMUX_SESSION_NAME || tmux new -e TMUX_SESSION_NAME=$SSH_TMUX_SESSION_NAME -s $SSH_TMUX_SESSION_NAME\"; exec tmux attach -t $TMUX_SESSION_NAME" - ''}/bin/ragdoll"; } diff --git a/programs/git/default.nix b/programs/git/default.nix index 13c40ee..3ef0743 100644 --- a/programs/git/default.nix +++ b/programs/git/default.nix @@ -5,10 +5,6 @@ inputs@{ machine, ... }: inherit inputs; requirements = [ "cli" ]; home-config = _: { - home.file.".gitignore".text = '' - server\ exited\ unexpectedly - ''; - programs.git = { enable = true; signing.key = "/home/jana/.ssh/id_ed25519.pub"; diff --git a/programs/jj/default.nix b/programs/jj/default.nix index 1947a1e..18c1e79 100644 --- a/programs/jj/default.nix +++ b/programs/jj/default.nix @@ -100,6 +100,8 @@ inputs@{ machine, ... }: "-c" script ]; + in + { tug = [ "bookmark" "move" @@ -108,9 +110,6 @@ inputs@{ machine, ... }: "--to" "coalesce(@ & ~empty(), @-)" ]; - in - { - inherit tug; fuck = [ "bookmark" "move" @@ -154,18 +153,6 @@ inputs@{ machine, ... }: "--from" "trunk()" ]; - n = [ "edit" "@+" ]; - p = [ "edit" "@-" ]; - - gp = [ "git" "push" ]; - t = tug; - - d = "describe"; - dm = [ "describe" "-m" ]; - e = "edit"; - s = "squash"; - si = "squash -i"; - sp = "split"; }; templates = { diff --git a/programs/kitty/default.nix b/programs/kitty/default.nix index be05db4..9f37d8f 100644 --- a/programs/kitty/default.nix +++ b/programs/kitty/default.nix @@ -34,11 +34,7 @@ inputs@{ machine, ... }: draw_minimal_borders = false; hide_window_decorations = true; - shell = "${pkgs.writeScriptBin "tmux-sesh" '' - RAND=$(cat /dev/urandom | head -c 20 | base32) - export TMUX_SESSION_NAME="kitty-$RAND" - exec ${pkgs.tmux}/bin/tmux new -e TMUX_SESSION_NAME=$TMUX_SESSION_NAME -s "$TMUX_SESSION_NAME" - ''}/bin/tmux-sesh"; + shell = "${pkgs.tmux}/bin/tmux"; clipboard_control = "write-clipboard write-primary read-clipboard read-primary"; foreground = "#fcfcfc"; diff --git a/programs/niri/default.nix b/programs/niri/default.nix index 417b4f8..087f962 100644 --- a/programs/niri/default.nix +++ b/programs/niri/default.nix @@ -21,7 +21,7 @@ inputs@{ machine, ... }: ] ++ (pkgs.lib.splitString " " cmd); - wallpaper = "${pkgs.custom.raw-data}/pacific.png"; + wallpaper = ("${pkgs.custom.raw-data}/pacific.png"); matugenSchemeType = "scheme-tonal-spot"; in { diff --git a/programs/nvim/config.lua b/programs/nvim/config.lua index 8db77ea..fa9219b 100644 --- a/programs/nvim/config.lua +++ b/programs/nvim/config.lua @@ -107,12 +107,9 @@ vim.cmd([[ -- multicursor vim.g.VM_default_mappings = 1 -vim.g.VM_mouse_mappings = 1 vim.g.VM_reselect_first = 1 vim.g.VM_notify_previously_selected = 1 vim.g.VM_theme = "iceblue" --- vim.g.VM_maps["Undo"] = 'u' --- vim.g.VM_maps["Redo"] = '' diff --git a/programs/nvim/default.nix b/programs/nvim/default.nix index 9cc33d0..915b743 100644 --- a/programs/nvim/default.nix +++ b/programs/nvim/default.nix @@ -5,10 +5,11 @@ inputs@{ machine, ... }: inherit inputs; requirements = [ "cli" ]; home-config = - { pkgs - , flakes - , lib - , ... + { + pkgs, + flakes, + lib, + ... }: let nvim_mime_types = [ @@ -57,11 +58,9 @@ inputs@{ machine, ... }: }; xdg.mimeApps.associations.added = lib.mergeAttrsList ( - map - (mime: { - ${mime} = [ "${desktop-entry-name}.desktop" ]; - }) - nvim_mime_types + map (mime: { + ${mime} = [ "${desktop-entry-name}.desktop" ]; + }) nvim_mime_types ); imports = [ diff --git a/programs/nvim/plugins.nix b/programs/nvim/plugins.nix index 818421a..db56eaa 100644 --- a/programs/nvim/plugins.nix +++ b/programs/nvim/plugins.nix @@ -384,7 +384,7 @@ in code_action.keys = { quit = ""; }; - symbol_in_winbar.enable = true; + symbol_in_winbar.enable = false; implement.enable = true; }; }; @@ -435,8 +435,8 @@ in __unkeyed-1 = "filetype"; } ]; - lualine_y = [{ __unkeyed-1 = "progress"; }]; - lualine_z = [{ __unkeyed-1 = "location"; }]; + lualine_y = [ { __unkeyed-1 = "progress"; } ]; + lualine_z = [ { __unkeyed-1 = "location"; } ]; }; }; }; diff --git a/programs/ssh.nix b/programs/ssh.nix deleted file mode 100644 index 1300ac9..0000000 --- a/programs/ssh.nix +++ /dev/null @@ -1,42 +0,0 @@ -inputs@{ machine, ... }: { - imports = - machine.program { - name = "ssh"; - inherit inputs; - requirements = [ "cli" ]; - home-config = _: { - programs.ssh = { - enable = true; - enableDefaultConfig = false; - matchBlocks = { - fili = { - user = "jana"; - hostname = "donsz.nl"; - }; - icecube = { - hostname = "192.168.178.138"; - proxyJump = "fili"; - }; - ragdoll = { - hostname = "192.168.178.138"; - proxyJump = "fili"; - }; - - "*" = { - forwardAgent = false; - serverAliveInterval = 0; - serverAliveCountMax = 3; - compression = false; - addKeysToAgent = null; - hashKnownHosts = false; - userKnownHostsFile = "~/.ssh/known_hosts"; - controlMaster = "no"; - controlPath = "~/.ssh/master-%r@%n:%p"; - controlPersist = null; - }; - }; - }; - }; - } - ; -} diff --git a/programs/tmux/default.nix b/programs/tmux/default.nix index e59f691..2154216 100644 --- a/programs/tmux/default.nix +++ b/programs/tmux/default.nix @@ -14,33 +14,32 @@ inputs@{ machine, ... }: shortcut = "k"; - plugins = - with pkgs; - with tmuxPlugins; - [ - { - plugin = mkTmuxPlugin { - pluginName = "suspend"; - version = "1a2f806"; - src = pkgs.fetchFromGitHub { - owner = "MunifTanjim"; - repo = "tmux-suspend"; - rev = "1a2f806666e0bfed37535372279fa00d27d50d14"; - sha256 = "0j7vjrwc7gniwkv1076q3wc8ccwj42zph5wdmsm9ibz6029wlmzv"; - }; + plugins = with pkgs; [ + { + plugin = tmuxPlugins.mkTmuxPlugin { + pluginName = "suspend"; + version = "1a2f806"; + src = pkgs.fetchFromGitHub { + owner = "MunifTanjim"; + repo = "tmux-suspend"; + rev = "1a2f806666e0bfed37535372279fa00d27d50d14"; + sha256 = "0j7vjrwc7gniwkv1076q3wc8ccwj42zph5wdmsm9ibz6029wlmzv"; }; - extraConfig = '' - set -g @suspend_key 'F11' - ''; - } - { - plugin = mode-indicator; - } - ]; + }; + extraConfig = '' + set -g @suspend_key 'F11' + ''; + } + { + plugin = tmuxPlugins.mode-indicator; + } + ]; extraConfig = '' # unbind every single normal keybinding - unbind -a + unbind-key -a + + set -g status-left "#{?client_prefix,#[bg=colour2],#[bg=colour1]}#[fg=colour0] #S " # for special characters to work right # like @@ -61,40 +60,39 @@ inputs@{ machine, ... }: bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel bind v copy-mode bind p paste-buffer -p - bind d detach set -s set-clipboard on # get back normal terminal emulator bindings - bind -n S-PPage copy-mode -u - bind -T copy-mode -n S-NPage send-keys -X page-down + bind-key -n S-PPage copy-mode -u + bind-key -T copy-mode -n S-NPage send-keys -X page-down # don't scroll to end when copying with mouse - bind -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe - bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe - bind -T copy-mode DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe - bind -T copy-mode TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe - bind -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe - bind -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe + bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe + bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe + bind-key -T copy-mode DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe + bind-key -T copy-mode TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe + bind-key -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe + bind-key -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe # window control bind t new-window -c "#{pane_current_path}" - bind Tab next-window - bind BTab previous-window + bind-key Tab next-window + bind-key BTab previous-window set -g automatic-rename-format "#{?#{==:#{pane_current_path},$HOME},~,#{b:pane_current_path}} (#{pane_current_command})" set -g renumber-windows on - bind Q confirm-before -p "kill-window #W? (y/n)" kill-window + bind-key Q confirm-before -p "kill-window #W? (y/n)" kill-window bind A last-window - bind 1 select-window -t :0 - bind 2 select-window -t :1 - bind 3 select-window -t :2 - bind 4 select-window -t :3 - bind 5 select-window -t :4 - bind 6 select-window -t :5 - bind 7 select-window -t :6 - bind 8 select-window -t :7 - bind 9 select-window -t :8 - bind 0 select-window -t :9 + bind-key 1 select-window -t :0 + bind-key 2 select-window -t :1 + bind-key 3 select-window -t :2 + bind-key 4 select-window -t :3 + bind-key 5 select-window -t :4 + bind-key 6 select-window -t :5 + bind-key 7 select-window -t :6 + bind-key 8 select-window -t :7 + bind-key 9 select-window -t :8 + bind-key 0 select-window -t :9 # pane control bind h select-pane -L @@ -113,44 +111,40 @@ inputs@{ machine, ... }: bind S-Down split-window -v -c "#{pane_current_path}" bind S-Up split-window -h -b -c "#{pane_current_path}" bind S-Right split-window -v -b -c "#{pane_current_path}" - bind -r -T prefix M-h resize-pane -L 5 - bind -r -T prefix M-j resize-pane -D 5 - bind -r -T prefix M-k resize-pane -U 5 - bind -r -T prefix M-l resize-pane -R 5 + bind-key -r -T prefix M-h resize-pane -L 5 + bind-key -r -T prefix M-j resize-pane -D 5 + bind-key -r -T prefix M-k resize-pane -U 5 + bind-key -r -T prefix M-l resize-pane -R 5 bind x swap-pane -D - bind z resize-pane -Z - - # swap a full screen and terminal - bind a if -F "#{?window_zoomed_flag,0,1}" "select-pane -l ; resize-pane -Z" "resize-pane -Z ; select-pane -l" # double-click ^k (or lshift with kanata) for previous pane like ^w in vim bind -r ^k select-pane -l - bind q confirm-before -p "kill-pane #P? (y/n)" kill-pane + bind-key q confirm-before -p "kill-pane #P? (y/n)" kill-pane - # bind o choose-tree -wZ - # bind O choose-tree -sZ + # bind-key o choose-tree -wZ + # bind-key O choose-tree -sZ # get back command mode and some other basics... bind : command-prompt bind r source-file ~/.config/tmux/tmux.conf \; display "config reloaded" - bind ? list-keys + bind-key ? list-keys - # Scroll in man etc + # Scroll oin man etc tmux_commands_with_legacy_scroll="nano less more man git" - bind -T root WheelUpPane \ + bind-key -T root WheelUpPane \ if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \ 'send -Mt=' \ 'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \ "send -t= Up" "copy-mode -et="' - bind -T root WheelDownPane \ + bind-key -T root WheelDownPane \ if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \ 'send -Mt=' \ 'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \ "send -t= Down" "send -Mt="' - bind -T copy-mode-vi ] \ + bind-key -T copy-mode-vi ] \ send-keys -X clear-selection \; \ send-keys -X search-forward "--> " \; \ send-keys -X next-word \; \ @@ -158,7 +152,7 @@ inputs@{ machine, ... }: send-keys -X jump-forward ":" \; \ send-keys -X jump-to-forward ":" \; - bind -T copy-mode-vi [ \ + bind-key -T copy-mode-vi [ \ send-keys -X clear-selection \; \ send-keys -X start-of-line \; \ send-keys -X search-backward "--> " \; \ @@ -167,8 +161,10 @@ inputs@{ machine, ... }: send-keys -X jump-forward ":" \; \ send-keys -X jump-to-forward ":" \; - bind [ copy-mode \; send-keys [ - bind ] copy-mode \; send-keys ] + bind-key [ copy-mode \; send-keys [ + bind-key ] copy-mode \; send-keys ] + + bind d select-pane -l \; send-keys [ # f: file search # unbound: git files @@ -178,31 +174,32 @@ inputs@{ machine, ... }: # M-i: ips # include line and column numbers in file search # rebind `f` so we can reuse it here - bind -T prefix C-f command-prompt { find-window -Z "%%" } + bind-key -T prefix C-f command-prompt { find-window -Z "%%" } # jyn is so sorry, and so am I now # https://github.com/jyn514/dotfiles/blob/65be3c004113290f41f858f4d7f1a6799fabab19/config/tmux.conf#L203-L212 # see `search-regex.sh` for wtf this means # TODO: include shell variable names - bind f copy-mode \; send-keys -X search-backward '(^|/|\<|[[:space:]"])((\.|\.\.)|[[:alnum:]~_"-]*)((/[][[:alnum:]_.#$%&+=@"-]+)+([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)|(/[][[:alnum:]_.#$%&+=@"-]+){2,}([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)?|(\.|\.\.)/([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?))' + bind-key f copy-mode \; send-keys -X search-backward '(^|/|\<|[[:space:]"])((\.|\.\.)|[[:alnum:]~_"-]*)((/[][[:alnum:]_.#$%&+=@"-]+)+([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)|(/[][[:alnum:]_.#$%&+=@"-]+){2,}([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)?|(\.|\.\.)/([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?))' # urls - bind u copy-mode \; send-keys -X search-backward '(https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&*+-]*' + bind-key u copy-mode \; send-keys -X search-backward '(https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&*+-]*' # hashes - bind g copy-mode \; send-keys -X search-backward '[[:<:]]([0-9a-f]{7,40}|[[:alnum:]]{52}|[0-9a-f]{64})[[:>:]]' + bind-key g copy-mode \; send-keys -X search-backward '[[:<:]]([0-9a-f]{7,40}|[[:alnum:]]{52}|[0-9a-f]{64})[[:>:]]' # ips - bind M-i copy-mode \; send-keys -X search-backward '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}' + bind-key M-i copy-mode \; send-keys -X search-backward '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}' - bind -T copy-mode-vi o send-keys -X copy-pipe \ + bind-key -T copy-mode-vi o send-keys -X copy-pipe \ 'cd #{pane_current_path}; xargs -I {} echo "echo {}" | bash | xargs ${../nvim/editor-hax.py} xdg-open-proxy' \; \ if -F "#{alternate_on}" { send-keys -X cancel } # save the buffer, then open an editor in the current pane - bind -T copy-mode-vi O send-keys -X copy-pipe-and-cancel \ + bind-key -T copy-mode-vi O send-keys -X copy-pipe-and-cancel \ 'tmux send-keys "C-q"; xargs -I {} tmux send-keys "vim {}"; tmux send-keys "C-m"' # search for the highlighted text - bind -T copy-mode-vi s send-keys -X copy-pipe \ + bind-key -T copy-mode-vi s send-keys -X copy-pipe \ "cd #{pane_current_path}; xargs -I {} open 'https://www.google.com/search?q={}'" \; \ if -F "#{alternate_on}" { send-keys -X cancel } # save buffer and retype into the shell - bind -T copy-mode-vi Tab send-keys -X copy-selection-and-cancel \; paste-buffer -p + bind-key -T copy-mode-vi Tab send-keys -X copy-selection-and-cancel \; paste-buffer -p + ''; }; };