From 1fe3920c5086495be8562700c6975c36ee8c2b2c Mon Sep 17 00:00:00 2001 From: matt1432 Date: Fri, 1 Dec 2023 12:39:16 -0500 Subject: [PATCH] refactor(common): move some bash stuff to relevant modules --- common/home/bash/default.nix | 29 ++--------------------------- common/home/bash/programs.nix | 6 +++++- common/home/neovim/default.nix | 25 +++++++++++++++++-------- common/home/tmux/default.nix | 7 ++++--- modules/tailscale.nix | 17 ++++++++++++++++- 5 files changed, 44 insertions(+), 40 deletions(-) diff --git a/common/home/bash/default.nix b/common/home/bash/default.nix index d4c94713..4f40d99c 100644 --- a/common/home/bash/default.nix +++ b/common/home/bash/default.nix @@ -1,11 +1,5 @@ -{ - config, - lib, - ... -}: { - imports = [ - ./programs.nix - ]; +{lib, ...}: { + imports = [./programs.nix]; programs = { starship = let @@ -125,30 +119,11 @@ sudo = "sudo "; frick = "sudo $(fc -ln -1)"; - nivm = "nvim"; - nivim = "nvim"; - - tmux = "tmux -2"; ls = "ls -lah --color=auto"; tree = "tree -a -I node_modules"; cp = "cp -r"; chore = "(cd ~/.nix; git add flake.lock; git commit -m 'chore: update flake.lock'; git push)"; - - tup = "tailscale up --login-server https://headscale.nelim.org"; - - pc = "mosh matt@binto -- tmux -2u new -At laptop"; - oksys = "mosh matt@oksys -- tmux -2u new -At laptop"; - pve = "mosh matt@pve -- tmux -2u new -At laptop"; - - mc = "mosh mc@mc -- tmux -2u new -At laptop"; - pod = "mosh matt@pve -- ssh -t -p 6768 matt@10.0.0.122 'tmux -2u new -At laptop'"; - jelly = "mosh matt@pve -- ssh -t matt@10.0.0.123 'tmux -2u new -At laptop'"; - qbit = "mosh matt@pve -- ssh -t matt@10.0.0.128 'tmux -2u new -At laptop'"; - }; - sessionVariables = { - # FIXME: why is this not set by home-manager? - "RIPGREP_CONFIG_PATH" = "${config.xdg.configHome}/ripgrep/ripgreprc"; }; profileExtra = '' diff --git a/common/home/bash/programs.nix b/common/home/bash/programs.nix index 61a46875..e6afd375 100644 --- a/common/home/bash/programs.nix +++ b/common/home/bash/programs.nix @@ -1,10 +1,14 @@ -{pkgs, ...}: { +{pkgs, config, ...}: { programs = { fzf = { enable = true; enableBashIntegration = true; }; + bash.sessionVariables = { + # FIXME: why is this not set by home-manager? + "RIPGREP_CONFIG_PATH" = "${config.xdg.configHome}/ripgrep/ripgreprc"; + }; ripgrep = { enable = true; arguments = [ diff --git a/common/home/neovim/default.nix b/common/home/neovim/default.nix index b2879633..5ba0fcf2 100644 --- a/common/home/neovim/default.nix +++ b/common/home/neovim/default.nix @@ -6,25 +6,34 @@ ... }: let fileContents = lib.strings.fileContents; + + javaSdk = pkgs.temurin-bin-17; nvim-treesitter-hypr = tree-sitter-hypr-flake.packages.${pkgs.system}.default; coc-stylelintplus = coc-stylelintplus-flake.packages.${pkgs.system}.default; in { - # TODO: make a gradle module and have java in device-vars.nix - xdg.dataFile = { - ".gradle/gradle.properties".source = pkgs.writeText "gradle.properties" '' - org.gradle.java.home = ${pkgs.temurin-bin-17} - ''; - }; home.packages = with pkgs; [ gradle gradle-completion # FIXME: not working alejandra ]; + # TODO: make a gradle/java module + xdg.dataFile = { + ".gradle/gradle.properties".text = '' + org.gradle.java.home = ${javaSdk} + ''; + }; + programs = { java = { enable = true; - package = pkgs.temurin-bin-17; + package = javaSdk; + }; + + # I love doing typos + bash.shellAliases = { + nivm = "nvim"; + nivim = "nvim"; }; neovim = { @@ -113,7 +122,7 @@ in { # Java java.jdt.ls = { - java.home = "${pkgs.temurin-bin-17}"; + java.home = "${javaSdk}"; statusIcons = { "busy" = "Busy"; "ready" = "OK"; diff --git a/common/home/tmux/default.nix b/common/home/tmux/default.nix index 782dfd1d..2b2ab2e2 100644 --- a/common/home/tmux/default.nix +++ b/common/home/tmux/default.nix @@ -1,5 +1,8 @@ {pkgs, ...}: { programs = { + # Make sure we have color support + bash.shellAliases.tmux = "tmux -2"; + tmux = { enable = true; mouse = true; @@ -8,9 +11,7 @@ newSession = true; historyLimit = 30000; - plugins = with pkgs.tmuxPlugins; [ - dracula - ]; + plugins = with pkgs.tmuxPlugins; [dracula]; extraConfig = '' bind-key -n Home send Escape "OH" diff --git a/modules/tailscale.nix b/modules/tailscale.nix index 13539439..687cf235 100644 --- a/modules/tailscale.nix +++ b/modules/tailscale.nix @@ -1,4 +1,6 @@ -{...}: { +{config, ...}: let + vars = config.services.device-vars; +in { services = { tailscale = { enable = true; @@ -8,4 +10,17 @@ ]; }; }; + + home-manager.users.${vars.username}.programs.bash.shellAliases = { + tup = "tailscale up --login-server https://headscale.nelim.org"; + + pc = "mosh matt@binto -- tmux -2u new -At laptop"; + oksys = "mosh matt@oksys -- tmux -2u new -At laptop"; + pve = "mosh matt@pve -- tmux -2u new -At laptop"; + + mc = "mosh mc@mc -- tmux -2u new -At laptop"; + pod = "mosh matt@pve -- ssh -t -p 6768 matt@10.0.0.122 'tmux -2u new -At laptop'"; + jelly = "mosh matt@pve -- ssh -t matt@10.0.0.123 'tmux -2u new -At laptop'"; + qbit = "mosh matt@pve -- ssh -t matt@10.0.0.128 'tmux -2u new -At laptop'"; + }; }