diff --git a/TODO.md b/TODO.md index 023c781..d370575 100644 --- a/TODO.md +++ b/TODO.md @@ -1,9 +1,13 @@ - [ ] Update the README.md - [ ] switch ssh keys to ECC (fuck RSA) -- [ ] forgejo not post-quantum (fix that) -- [X] migrate forge.dobutterfliescry.net -> tearforge.net -- [X] rename forgejo user to git - [ ] setup my own VPN - [ ] connect matcha to my VPN - [ ] use matcha to build stuff instead of using my laptop + +- [X] update bat config +- [ ] switch to zsh? or maybe elvish? +- [ ] switch to neovim +- [ ] switch to mangowc + +- [ ] fix my fuck ass emojis diff --git a/groups/cryos/default.nix b/groups/cryos/default.nix index 236930f..d00bae3 100644 --- a/groups/cryos/default.nix +++ b/groups/cryos/default.nix @@ -1,6 +1,7 @@ -{lib, ...}: { +{...}: { imports = [ ./programs.nix + ./keybinds.nix ]; boot.loader = { diff --git a/groups/cryos/keybinds.nix b/groups/cryos/keybinds.nix new file mode 100644 index 0000000..25a3f19 --- /dev/null +++ b/groups/cryos/keybinds.nix @@ -0,0 +1,19 @@ +{...}: { + services.keyd = { + enable = true; + keyboards.default = { + ids = ["*"]; + settings = { + main = { + capslock = "meta"; + + # NOTE: unsure whether or not i like oneshot... + # shift = "oneshot(shift)"; + # control = "oneshot(control)"; + # leftalt = "oneshot(alt)"; + # rightalt = "oneshot(rightalt)"; + }; + }; + }; + }; +} diff --git a/groups/cryos/programs.nix b/groups/cryos/programs.nix index ee38f86..6b2fd55 100644 --- a/groups/cryos/programs.nix +++ b/groups/cryos/programs.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + pkgs, + upkgs, + ... +}: { environment.systemPackages = with pkgs; [ # Shell bash @@ -45,6 +49,7 @@ nix-prefetch-git nix-index nix-unit + upkgs.nix-search-tv # Python python312 # I use 3.12 since it's in a pretty stable state now diff --git a/homes/me/default.nix b/homes/me/default.nix index 89d16b5..6380ca2 100755 --- a/homes/me/default.nix +++ b/homes/me/default.nix @@ -26,11 +26,15 @@ home = { shellAliases = { + # nix nd = "nix develop"; + ntv = "nix-search-tv"; rebuild = "nh os switch ~/flake"; trybuild = "nh os test ~/flake"; - brip = "batgrep"; # bat + ripgrep - man = "batman"; # bat + man + + # shell utilities + rgf = "rg --files | rg"; + watch = "viddy"; }; pointerCursor = { @@ -43,14 +47,13 @@ packages = with pkgs; [ # for services.gnome-keyring - pkgs.gcr # provides org.gnome.keyring.SystemPrompter + gcr # provides org.gnome.keyring.SystemPrompter seahorse # gui - krita + krita tor-browser fuzzel - speedtest-cli ]; }; diff --git a/homes/modules/bat.nix b/homes/modules/bat.nix index fca2231..70268f5 100755 --- a/homes/modules/bat.nix +++ b/homes/modules/bat.nix @@ -1,24 +1,109 @@ -{ - config, - pkgs, - ... -}: { - # like `/bin/cat` but with syntax highlighting - # TODO: change the pager (maybe use Github:sachaos/viddy instead) - programs.bat = { - enable = true; - config = { - pager = "less -FR"; - theme = "Dracula"; - }; - }; +let + # Module Meta Configuration + setShellAliases = true; + supportBash = true; + supportZsh = true; + supportFish = true; +in + { + osConfig, + config, + pkgs, + lib, + username, + ... + }: let + inherit + (builtins) + elemAt + ; - # other commands that make normal utils prettier - home.packages = with pkgs.bat-extras; [ - batdiff - batgrep - batman - batwatch - prettybat - ]; -} + inherit + (lib) + flip + mkIf + optional + splitString + ; + + cfg = config.programs.bat; + + # NOTE: `.pname` can be used instead of `.meta.mainProgram` + # NOTE: but then `pkgs.bash` would return `"bash-interactive"` which is annoying... + shellPkg = osConfig.users.users.${username}.shell; + shell = shellPkg.meta.mainProgram; + + pager = + cfg.config.pager + |> splitString " " + |> flip elemAt 0; + in { + programs.bat = { + enable = true; + config = { + # WARNING: pager must be set for this module to function + # NOTE: not sure whether to use ov/moor/viddy as my pager? + pager = "less -FR"; + # theme = "Dracula"; + }; + }; + + home = { + shellAliases = mkIf setShellAliases { + bat = "prettybat"; + cat = "prettybat"; + diff = "batdiff"; + brg = "batgrep"; + man = "batman"; + # watch = "batwatch"; # NOTE: using viddy instead atm + }; + + sessionVariables = { + PAGER = pager; + + # REF: https://github.com/eth-p/bat-extras/blob/master/doc/batpipe.md + BATPIPE_ENABLE_COLOR = "true"; + BATPIPE_INSIDE_LESS = "true"; + BATPIPE_TERM_WIDTH = "-"; # hyphone -> auto detect + }; + + packages = with pkgs.bat-extras; + [ + batdiff + batgrep + batman + batpipe + batwatch + prettybat + ] + ++ (with pkgs; [ + bat + entr # required by pkgs.bat-extras.batwatch + ripgrep # required by pkgs.bat-extras.batgrep + delta # required by pkgs.bat-extras.batdiff + ]) + ++ optional (pkgs?${pager}) pkgs.${pager}; + }; + + # Configure the user's shell to source batpipe + # WARNING: only currently supports bash, zsh, & fish + programs = { + bash = mkIf (supportBash || shell == "bash") { + initExtra = '' + eval "$(batpipe)" + ''; + }; + + zsh = mkIf (supportZsh || shell == "zsh") { + initContent = '' + eval "$(batpipe)" + ''; + }; + + fish = mkIf (supportFish || shell == "fish") { + interactiveShellInit = '' + eval (batpipe) + ''; + }; + }; + } diff --git a/homes/modules/fish.nix b/homes/modules/fish.nix index ddfbcf7..dd14c45 100755 --- a/homes/modules/fish.nix +++ b/homes/modules/fish.nix @@ -1,5 +1,4 @@ { - config, lib, pkgs, ... @@ -60,14 +59,13 @@ curl -sL "https://www.gitignore.io/api/$type" end - # ripgrep on files - function rgf - rg --files | rg $args + end + + function decompile + objdump --disassemble --demangle --debugging --debugging-tags $argv | bat --language asm end set -g fish_greeting (rand_greet) - - ''; shellAliases = {