1
Fork 0

Improve setup in many small ways

- ircgay command for catgirl
- fish keybinds for launching $EDITOR
- uptimes script
- fix neovide launch flags
This commit is contained in:
Matei Adriel 2024-02-09 19:18:33 +01:00
parent 21b6215dee
commit 424a1db3a7
No known key found for this signature in database
7 changed files with 80 additions and 38 deletions

View file

@ -1,5 +1,5 @@
# Catgirl is a terminal based irc client # Catgirl is a terminal based irc client
{ config, pkgs, hostname ? "hermes", ... }: { config, pkgs, lib, hostname ? "hermes", ... }:
let let
mkCatgirlNetwork = network: '' mkCatgirlNetwork = network: ''
host = ${network}.irc.moonythm.dev host = ${network}.irc.moonythm.dev
@ -7,9 +7,14 @@ let
user = ${hostname} user = ${hostname}
port = 6697 port = 6697
''; '';
# prints an irc message in rainbow text
ircgay = pkgs.writeShellScriptBin "ircgay" ''
${lib.getExe pkgs.toilet} -f term --irc --gay "$*"
'';
in in
{ {
satellite.persistence.at.state.apps.catgirl.directories = [ "${config.xdg.dataHome}/catgirl" ]; home.packages = [ ircgay pkgs.catgirl ];
home.packages = [ pkgs.catgirl ];
xdg.configFile."catgirl/tilde".text = mkCatgirlNetwork "tilde"; xdg.configFile."catgirl/tilde".text = mkCatgirlNetwork "tilde";
satellite.persistence.at.state.apps.catgirl.directories = [ "${config.xdg.dataHome}/catgirl" ];
} }

View file

@ -1,5 +1,6 @@
{ pkgs, inputs, ... }: { { pkgs, inputs, ... }: {
imports = [ imports = [
./scripts
./eza.nix ./eza.nix
./bat.nix ./bat.nix
./ssh.nix ./ssh.nix

View file

@ -43,6 +43,14 @@ function fish_user_key_bindings
bind -M default \cg "nvim +Neogit" bind -M default \cg "nvim +Neogit"
bind -M insert \cg "nvim +Neogit" bind -M insert \cg "nvim +Neogit"
# }}} # }}}
# {{{ C-e to open $EDITOR
bind -M default \ce "$EDITOR"
bind -M insert \ce "$EDITOR"
# }}}
# {{{ C-S-e to open commandline in $EDITOR
bind -M default \e\[69\;5u "commandline -f edit_command_buffer"
bind -M insert \e\[69\;5u "commandline -f edit_command_buffer"
# }}}
end end
# }}} # }}}
# {{{ Helpers # {{{ Helpers

View file

@ -0,0 +1,6 @@
{ pkgs, ... }:
let uptimes = pkgs.writeShellScriptBin "uptimes" (builtins.readFile ./uptimes.sh);
in
{
home.packages = [ uptimes ];
}

View file

@ -0,0 +1,21 @@
print_uptime() {
local HOST=$1
local EMOJI=$2
# -n: do not echo a newline
echo -n "$EMOJI $HOST: "
# The output of `uptime` looks like this:
# `18:40:54 up 1 day 0:51, 0 users, load average: 0.79, 0.68, 0.69`,
# so we use awk to trim it down to the parts we care about.
#
# For awk:
# -F: splits the input by a string
ssh adrielus@$HOST uptime \
| awk -F "up" '{print $2}' \
| awk -F " " '{print $1, $2}'
}
echo "Uptimes:"
print_uptime "tethys" "🔥"
print_uptime "lapetus" "⛵"

View file

@ -1447,8 +1447,9 @@ let
# - NVIM_EXTRA_RUNTIME provides extra directories to add to the runtimepath. # - NVIM_EXTRA_RUNTIME provides extra directories to add to the runtimepath.
# I cannot just install those dirs using the builtin package support because # I cannot just install those dirs using the builtin package support because
# my package manager (lazy.nvim) disables those. # my package manager (lazy.nvim) disables those.
wrapClient = { base, name, binName ? name, extraArgs ? "" }: wrapClient = { base, name, binName ? name, extraArgs ? "", wrapFlags ? lib.id }:
let startupScript = config.satellite.lib.lua.writeFile let
startupScript = config.satellite.lib.lua.writeFile
"." "startup" /* lua */ '' "." "startup" /* lua */ ''
vim.g.nix_extra_runtime = ${nlib.encode extraRuntime} vim.g.nix_extra_runtime = ${nlib.encode extraRuntime}
vim.g.nix_projects_dir = ${nlib.encode config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR} vim.g.nix_projects_dir = ${nlib.encode config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR}
@ -1457,6 +1458,8 @@ let
-- (Useful because neovide does not provide the info itself right away) -- (Useful because neovide does not provide the info itself right away)
vim.g.nix_neovim_app = ${nlib.encode name} vim.g.nix_neovim_app = ${nlib.encode name}
''; '';
extraFlags = lib.escapeShellArg (wrapFlags
''--cmd "lua dofile('${startupScript}/startup.lua')"'');
in in
pkgs.symlinkJoin { pkgs.symlinkJoin {
inherit (base) name meta; inherit (base) name meta;
@ -1465,14 +1468,13 @@ let
postBuild = '' postBuild = ''
wrapProgram $out/bin/${binName} \ wrapProgram $out/bin/${binName} \
--prefix PATH : ${lib.makeBinPath extraPackages} \ --prefix PATH : ${lib.makeBinPath extraPackages} \
--add-flags ${lib.escapeShellArg ''--cmd "lua dofile('${startupScript}/startup.lua')"''} \ --add-flags ${extraFlags} \
${extraArgs} ${extraArgs}
''; '';
}; };
# }}} # }}}
# {{{ Clients # {{{ Clients
neovim = wrapClient neovim = wrapClient {
{
base = base =
if config.satellite.toggles.neovim-nightly.enable if config.satellite.toggles.neovim-nightly.enable
then pkgs.neovim-nightly then pkgs.neovim-nightly
@ -1480,15 +1482,14 @@ let
name = "nvim"; name = "nvim";
}; };
neovide = wrapClient neovide = wrapClient {
{
base = pkgs.neovide; base = pkgs.neovide;
name = "neovide"; name = "neovide";
extraArgs = "--set NEOVIDE_MULTIGRID true"; extraArgs = "--set NEOVIDE_MULTIGRID true";
wrapFlags = flags: "-- ${flags}";
}; };
firenvim = wrapClient firenvim = wrapClient {
{
base = pkgs.neovim; base = pkgs.neovim;
name = "firenvim"; name = "firenvim";
binName = "nvim"; binName = "nvim";

View file

@ -1,4 +1,4 @@
wireless: ENC[AES256_GCM,data:QKM3llNba24/3Hfjph9JFpOF+G4aGuGDfhlwE/bfvvAX7G/dYRZ5GMZtUIifREviacCywtqYcmLe+IIA9/NtLom3JkgXV5VEoaNym78fMaY5fVvsjqOgzp1O0XXu70UYvHgtA1pDZrCQEv/q7slkBS7mYP+g8NaRff9eIzs6zMWIl3HzqQbdwb5TOzsKzPNZgNp8f9nTmxm6EVdEHx0fhBLepXw6uDGA2Op12XDvR9UDkzwOkyy7oxEhKiPhqi5in8OqfhBGmQ73WV+g38pUNobp5cGL0YjjxHIWKEbX0N6ov2DH4QkeQhJgWNtEsTuGugjWkPvoAgfARMirt+PFZotFPBib1/xZHB7H,iv:TruRRS9fAGjkQU4zs2cOs1olxUYkOOypMmpxOIw9N9o=,tag:Yd4t0DKVpaUul4CrA8hYPA==,type:str] wireless: ENC[AES256_GCM,data:Ib0PdBd2r/DPyE6Ah9NffT8Tw8c2y+seGFrE0e9GkyRaStdYMiiIlWCiaBO0u1HHaVV+2MQ33MnMdqyCGRlqGk45kl0GIwVR5iAiSYnobj/6wcse+kx/+5mzNOHXD1kJRGJBm5+SN9ntiGABNkQXJdn/Qoc/ukY1uaGe2nBeFKmGdD9JL7KfgdI5jYjQYyDbCL9JUszxkXNcplIRBAAy8JDaBVeo9HgI0QDIZToPKwuEeQoA9XzdimrjbCazlZy3ZvjAuoQXmrc1nIRHF5GabSRGTFTnTfcBeW2fGpUxmIhLyucn2DIQBXLm+RDdMLWoqcGbKiLVqKyUXck3ZZyoHMf2b9N52xMUwcS7,iv:ozkDwWmurWTD8TZHGvWL9Yh8cOrP1PzSBkz+1bBZybo=,tag:iGPjRaOoGRcOWJMweTL2yA==,type:str]
adrielus_password: ENC[AES256_GCM,data:lREgbcKwzAJQ3PPTWt7LXmgAsrKFCN+baQx4Q2YrHlu16yvKpmaZzPHJ/C5IjucUNbdceTs6Ef99IWzju0d8Hl5Z5UTMspYIhQ==,iv:JqnL3zfCd/xMRqTciA/Q6nYmFKzJkBqda4zucsE5KFw=,tag:RGZ/0/NEpdchj9h/l3Z7Ig==,type:str] adrielus_password: ENC[AES256_GCM,data:lREgbcKwzAJQ3PPTWt7LXmgAsrKFCN+baQx4Q2YrHlu16yvKpmaZzPHJ/C5IjucUNbdceTs6Ef99IWzju0d8Hl5Z5UTMspYIhQ==,iv:JqnL3zfCd/xMRqTciA/Q6nYmFKzJkBqda4zucsE5KFw=,tag:RGZ/0/NEpdchj9h/l3Z7Ig==,type:str]
sops: sops:
kms: [] kms: []
@ -33,8 +33,8 @@ sops:
WFd4ZFNHWG5Cakw5cU9MRE9HWHQ4THMKr/S7v1Oj3zQziMtI/NuFVm6AaJF5JV5U WFd4ZFNHWG5Cakw5cU9MRE9HWHQ4THMKr/S7v1Oj3zQziMtI/NuFVm6AaJF5JV5U
sEr2nEptYFz4G6YL5psQGXHaKzQKBg+crgKRbYL4akhqT7pfYPC0bQ== sEr2nEptYFz4G6YL5psQGXHaKzQKBg+crgKRbYL4akhqT7pfYPC0bQ==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2024-01-31T18:18:48Z" lastmodified: "2024-02-07T14:49:34Z"
mac: ENC[AES256_GCM,data:9kYBMib8MuIdcJK0Lxh3sYP4OrlFCn3DZP8X82mSvnK15l8rVXFu2xfIbt1nviDj9IFhsZ3+2qzUnPq650erG6JpuHdzdmxIE49nU8BqmqtiQ4SAFAdC7zEbWaWk3SKmm1ouarBuHWtfvN3uw/ULpdExxt8Or8kvgvoVPX2L85E=,iv:wDWg/ba89AqW5bwqVydLZdfhPFgkNLRTKx1caER6SmI=,tag:1JY/HsipandxtmCmYXuavQ==,type:str] mac: ENC[AES256_GCM,data:ZLMz0YRnEdq8jjlKPPrpudD8RVtr+ayfjGP7lXEiNUbHxhDClo/WjVpCd6HKdjy/76TZvb5Jq7+e3GTbBGm7CJjt7gS7b10gKAfqB+DwXrtO5PD9TeZOP0HCK5TwEKGjFDoPadKmQQyeBciLLZmKKmW3rtvL/G+U5ZkoPcedG1I=,iv:s7zaPCcYQFHEyNl99HAw3Ds2SUEhgAO5n4X0gODHMUY=,tag:VhqQnQv1wE7/k5GkzYNN3A==,type:str]
pgp: [] pgp: []
unencrypted_suffix: _unencrypted unencrypted_suffix: _unencrypted
version: 3.8.1 version: 3.8.1