Compare commits

..

No commits in common. "563c7e8da5536bc1edb4e7e5ba285e2871cd10a5" and "7ec3d37e605c41feffa4ad509a7769f679a01344" have entirely different histories.

3 changed files with 117 additions and 15 deletions

View File

@ -836,7 +836,6 @@ key_bindings:
# (Windows, Linux, and BSD only) # (Windows, Linux, and BSD only)
- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } - { key: V, mods: Control|Shift, mode: ~Vi, action: Paste }
- { key: C, mods: Control|Shift, action: Copy } - { key: C, mods: Control|Shift, action: Copy }
- { key: Return, mods: Alt, action: ToggleFullscreen }
#- { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward } #- { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward }
#- { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward } #- { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward }
#- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection } #- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection }
@ -848,6 +847,9 @@ key_bindings:
#- { key: Minus, mods: Control, action: DecreaseFontSize } #- { key: Minus, mods: Control, action: DecreaseFontSize }
#- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize } #- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize }
# (Windows only)
#- { key: Return, mods: Alt, action: ToggleFullscreen }
# (macOS only) # (macOS only)
#- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" } #- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" }
#- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory } #- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory }

View File

@ -365,14 +365,12 @@ require('guess-indent').setup {
} }
-- harpoon: mark significant files & switch between them -- harpoon: mark significant files & switch between them
remap('n', '<leader>m', function() require('harpoon.mark').add_file() end, { desc = "[H]arpoon [M]ark" }) remap('n', '<leader>m', function() require('harpoon.mark').add_file() end)
local function harpoon_nav(key, nav_file_index, lead_keybind) local function harpoon_nav(key, nav_file_index, lead_keybind)
lead_keybind = lead_keybind or '<leader>h' lead_keybind = lead_keybind or '<leader>h'
assert(type(key) == "string", "expect key to be string(keybind)") assert(type(key) == "string", "expect key to be string(keybind)")
assert(type(nav_file_index) == "number" and nav_file_index >= 1, "expect 1-indexed number for file index") assert(type(nav_file_index) == "number" and nav_file_index >= 1, "expect 1-indexed number for file index")
return remap('n', lead_keybind .. key, return remap('n', lead_keybind .. key, function() require('harpoon.ui').nav_file(nav_file_index) end)
function() require('harpoon.ui').nav_file(nav_file_index) end,
{ desc = "[H]arpoon navigate " .. tostring(nav_file_index) })
end end
-- remap letters to index. Inspired by alternating number of Dvorak programmer -- remap letters to index. Inspired by alternating number of Dvorak programmer
@ -382,18 +380,21 @@ harpoon_nav('j', 2)
harpoon_nav('d', 3) harpoon_nav('d', 3)
harpoon_nav('k', 4) harpoon_nav('k', 4)
remap('n', '<leader>hh', function() require('harpoon.ui').toggle_quick_menu() end) remap('n', '<leader>hh', function() require('harpoon.ui').toggle_quick_menu() end)
for i = 1, 10 do -- harpoon: navigate by numbers
-- harpoon: navigate files by numbers harpoon_nav('1', 1)
harpoon_nav(tostring(i % 10), i) harpoon_nav('2', 2)
-- harpoon: navigate terms by numbers harpoon_nav('3', 3)
remap('n', '<leader>t' .. tostring(i % 10), function() harpoon_nav('4', 4)
require('harpoon.term').gotoTerminal(i) harpoon_nav('5', 5)
end) harpoon_nav('6', 6)
end harpoon_nav('7', 7)
harpoon_nav('8', 8)
harpoon_nav('9', 9)
harpoon_nav('0', 10)
-- neogit: easy-to-see git status. Provides only productivity on staging/unstage -- neogit: easy-to-see git status. Provides only productivity on staging/unstage
require('neogit').setup {} require('neogit').setup {}
remap('n', '<leader>gs', function() require('neogit').open({}) end, { desc = "[G]it [S]tatus" }); remap('n', '<leader>gs', function() require('neogit').open({}) end);
-- LSP settings -- LSP settings
-- This function gets run when an LSP connects to a particular buffer. -- This function gets run when an LSP connects to a particular buffer.

View File

@ -209,7 +209,106 @@
specialArgs.hostname = "bao"; specialArgs.hostname = "bao";
modules = base_modules ++ [ modules = base_modules ++ [
./configuration.nix ./configuration.nix
./../../modules/storage.perso.sys.nix # automount using s3fs
({config, pkgs, lib, ...}: {
environment.systemPackages = [
pkgs.s3fs pkgs.cifs-utils pkgs.lm_sensors pkgs.hddtemp
]; # s3fs-fuse
# Sadly, autofs uses systemd, so we can't put it in home-manager
# HACK: need to store secret somewhere so that root can access this
# because autofs may run as root for now, we enforce putting the secret in this monorepo
# services.rpcbind.enable = true;
services.autofs = let
# confToBackendArg {lol="what"; empty=""; name_only=null;} -> "lol=what,empty=,name_only"
# TODO: change null -> true/false. This allows overriding & better self-documentation
confToBackendArg = conf: (lib.concatStringsSep ","
(lib.mapAttrsToList (name: value: "${name}${lib.optionalString (value != null) "=${value}"}") conf));
# mount_dest: path ("wow")
# backend_args: nix attrs representing the arguments to be passed to s3fs
# ({"-fstype" = "fuse"; "use_cache" = "/tmp";})
# bucket: bucket name (hungtr-hot)
# NOTE: s3 custom provider will be provided inside
# backend_args, so just put the bucket name here
#
#-> "${mount_dest} ${formatted_args} ${s3fs-bin}#${bucket}"
autofs-s3fs_entry = {
mount_dest,
backend_args? {"-fstype" = "fuse";},
bucket
}@inputs: let
s3fs-exec = "${pkgs.s3fs}/bin/s3fs";
in "${mount_dest} ${confToBackendArg backend_args} :${s3fs-exec}\#${bucket}";
personalStorage = [
# hungtr-hot @ phoenix is broken :)
# (autofs-s3fs_entry {
# mount_dest = "hot";
# backend_args = {
# "-fstype" = "fuse";
# use_cache = "/tmp";
# del_cache = null;
# allow_other = null;
# url = ''"https://f5i0.ph.idrivee2-32.com"'';
# # TODO: builtins.readFile requires a Git-controlled file
# passwd_file = config.age.secrets.s3fs.path;
# dbglevel = "debug"; # enable this for better debugging info in journalctl
# uid = "1000"; # default user
# gid = "100"; # users
# umask="003"; # others read only, fully shared for users group
# # _netdev = null; # ignored by s3fs (https://github.com/s3fs-fuse/s3fs-fuse/blob/master/src/s3fs.cpp#L4910)
# };
# bucket = "hungtr-hot";
# })
(autofs-s3fs_entry {
mount_dest = "garden";
backend_args = {
"-fstype" = "fuse";
use_cache = "/tmp";
del_cache = null;
allow_other = null;
url = "https://v5h5.la11.idrivee2-14.com";
passwd_file = config.age.secrets."s3fs.digital-garden".path;
dbglevel = "debug"; # enable this for better debugging info in journalctl
uid = "1000"; # default user
gid = "100"; # users
umask="003"; # others read only, fully shared for users group
};
bucket = "digital-garden";
})
(let args = {
"-fstype" = "cifs";
credentials = config.age.secrets._nhitrl_cred.path;
user = null;
uid = "1001";
gid = "100";
dir_mode = "0777";
file_mode = "0777";
};
in "felia_d ${confToBackendArg args} ://felia.coati-celsius.ts.net/d")
(let args = {
"-fstype" = "cifs";
credentials = config.age.secrets._nhitrl_cred.path;
user = null;
uid = "1001";
gid = "100";
dir_mode = "0777";
file_mode = "0777";
};
in "felia_f ${confToBackendArg args} ://felia.coati-celsius.ts.net/f")
];
persoConf = pkgs.writeText "auto.personal" (builtins.concatStringsSep "\n" personalStorage);
in {
enable = true;
# Creates /perso directory with every subdirectory declared by ${personalStorage}
# as of now (might be stale), /perso/hot is the only mount accessible
# that is also managed by s3fs
autoMaster = ''
/perso file:${persoConf}
'';
timeout = 30; # default: 600, 600 seconds (10 mins) of inactivity => unmount
# debug = true; # writes to more to journalctl
};
})
# GPU, sound, networking stuffs # GPU, sound, networking stuffs
({ config, pkgs, lib, ... }: ({ config, pkgs, lib, ... }:
let let