This commit is contained in:
Shelvacu
2025-07-11 11:08:00 -07:00
committed by Shelvacu on prophecy
parent 4a046013f5
commit 59d5ef53a4
15 changed files with 777 additions and 468 deletions

View File

@@ -30,18 +30,23 @@ let
_comp_command_offset 0 _comp_command_offset 0
''; '';
in in
pkgs.runCommandLocal "vacu-notalias-simple-${name}" { pname = name; meta.mainProgram = name; } '' pkgs.runCommandLocal "vacu-notalias-simple-${name}"
mkdir -p "$out"/bin {
printf '%s' ${lib.escapeShellArg binContents} > "$out"/bin/${name} pname = name;
chmod a+x "$out"/bin/${name} meta.mainProgram = name;
out_base="$(dirname -- "$out")" }
LC_ALL=C ''
completion_function_name="_completion_''${out_base//[^a-zA-Z0-9_]/_}" mkdir -p "$out"/bin
completion_file="$out"/share/bash-completion/completions/${name} printf '%s' ${lib.escapeShellArg binContents} > "$out"/bin/${name}
mkdir -p "$(dirname -- "$completion_file")" chmod a+x "$out"/bin/${name}
printf '%s() {\n%s\n}\n' "$completion_function_name" ${lib.escapeShellArg funcContents} > "$completion_file" out_base="$(dirname -- "$out")"
printf 'complete -F %s %s\n' "$completion_function_name" ${lib.escapeShellArg name} >> "$completion_file" LC_ALL=C
''; completion_function_name="_completion_''${out_base//[^a-zA-Z0-9_]/_}"
completion_file="$out"/share/bash-completion/completions/${name}
mkdir -p "$(dirname -- "$completion_file")"
printf '%s() {\n%s\n}\n' "$completion_function_name" ${lib.escapeShellArg funcContents} > "$completion_file"
printf 'complete -F %s %s\n' "$completion_function_name" ${lib.escapeShellArg name} >> "$completion_file"
'';
ms_text = with_sudo: '' ms_text = with_sudo: ''
svl_minmax_args $# 1 3 svl_minmax_args $# 1 3
host="$1" host="$1"
@@ -53,11 +58,7 @@ let
journalctl = "${pkgs.systemd}/bin/journalctl"; journalctl = "${pkgs.systemd}/bin/journalctl";
in in
{ {
imports = [ imports = [ { vacu.packages.copy-altcaps.enable = config.vacu.isGui; } ];
{
vacu.packages.copy-altcaps.enable = config.vacu.isGui;
}
];
vacu.packages = [ vacu.packages = [
(script "ms" (ms_text false)) (script "ms" (ms_text false))
(script "mss" (ms_text true)) (script "mss" (ms_text true))
@@ -122,8 +123,14 @@ in
"$view_cmd" "$l" "$view_cmd" "$l"
rm -r "$d" rm -r "$d"
'') '')
(simple "nixcat" [ "nixview" "cat" ]) (simple "nixcat" [
(simple "nixless" [ "nixview" "less" ]) "nixview"
"cat"
])
(simple "nixless" [
"nixview"
"less"
])
(simple "sc" [ systemctl ]) (simple "sc" [ systemctl ])
(simple "scs" [ (simple "scs" [
systemctl systemctl
@@ -148,7 +155,10 @@ in
"--pager-end" "--pager-end"
"-u" "-u"
]) ])
(simple "gs" [ "git" "status" ]) (simple "gs" [
"git"
"status"
])
(script "list-auto-roots" '' (script "list-auto-roots" ''
auto_roots="/nix/var/nix/gcroots/auto" auto_roots="/nix/var/nix/gcroots/auto"
svl_exact_args $# 0 svl_exact_args $# 0

View File

@@ -27,9 +27,7 @@
vacu.verifySystem.expectedMac = "e8:65:38:52:5c:59"; vacu.verifySystem.expectedMac = "e8:65:38:52:5c:59";
vacu.systemKind = "laptop"; vacu.systemKind = "laptop";
boot.binfmt.emulatedSystems = [ boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
"aarch64-linux"
];
boot.kernelPackages = pkgs.linuxKernel.packages.linux_lqx; boot.kernelPackages = pkgs.linuxKernel.packages.linux_lqx;
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
services.irqbalance.enable = true; services.irqbalance.enable = true;

View File

@@ -1,6 +1,4 @@
{ { ... }:
...
}:
{ {
virtualisation.containers.enable = true; virtualisation.containers.enable = true;
virtualisation.podman = { virtualisation.podman = {

View File

@@ -263,7 +263,7 @@ let
has_flag = has_flag =
flag_name: flag_name:
assert isString flag_name; assert isString flag_name;
assert is_flagish flag_name; #no spaces allowed in flag names assert is_flagish flag_name; # no spaces allowed in flag names
''hasflag :is ${sieve_encode flag_name}''; ''hasflag :is ${sieve_encode flag_name}'';
set_with_interp = set_with_interp =
var_name: new_val: var_name: new_val:
@@ -354,7 +354,7 @@ let
} }
''; '';
# trimmed down from https://pages.ebay.com/securitycenter/security_researchers_eligible_domains.html # trimmed down from https://pages.ebay.com/securitycenter/security_researchers_eligible_domains.html
ebay_domains = vaculib.listOfLines {} '' ebay_domains = vaculib.listOfLines { } ''
ebay.com ebay.com
ebay.co.uk ebay.co.uk
ebay.com.au ebay.com.au
@@ -467,105 +467,142 @@ let
removeflag "D"; removeflag "D";
${pure_flags [ "wells-fargo" "banking" ] (envelope_is "wf-primary@shelvacu.com")} ${pure_flags [ "wells-fargo" "banking" ] (envelope_is "wf-primary@shelvacu.com")}
${pure_flags [ "wells-fargo-transactions" "banking-transactions" "B" ] [ ${pure_flags
(has_flag "wells-fargo") [ "wells-fargo-transactions" "banking-transactions" "B" ]
(subject_matches [ [
"You just got paid!" (has_flag "wells-fargo")
"Wells Fargo card purchase exceeded preset amount" (subject_matches [
"You made a payment" "You just got paid!"
"You made a credit card purchase of *" "Wells Fargo card purchase exceeded preset amount"
"Your card wasn't present for a purchase" "You made a payment"
"Account update" "You made a credit card purchase of *"
"You've earned cash back from My Wells Fargo Deals" "Your card wasn't present for a purchase"
"Confirmation of your Wells Fargo Rewards redemption" "Account update"
"You sent money with Zelle(R)" "You've earned cash back from My Wells Fargo Deals"
]) "Confirmation of your Wells Fargo Rewards redemption"
]} "You sent money with Zelle(R)"
${pure_flags [ "wells-fargo-statements" "banking-statements" "C" ] [
(has_flag "wells-fargo")
(subject_matches [
"Your statement for credit card account *"
"Your statement for account *"
])
]}
${pure_flags [ "wells-fargo-action-required" "A" ] [ #wf is actually careful about saying action required
(has_flag "wells-fargo")
(subject_matches "Action Required: *")
]}
${pure_flags [ "wells-fargo-misc" "A" ] [
(has_flag "wells-fargo")
(not (has_flag "wells-fargo-transactions"))
(not (has_flag "wells-fargo-statements"))
(not (has_flag "wells-fargo-action-required"))
]}
${pure_flags [ "chase" "banking" ] (envelope_is "chase@shelvacu.com")}
${pure_flags [ "chase-transactions" "banking-transactions" "B" ] [
(has_flag "chase")
(subject_matches [
"Your * payment is scheduled"
"You made a * transaction with *"
"Your * transaction with *"
"Chase security alert: You signed in with a new device"
])
]}
${pure_flags [ "chase-statements" "banking-statements" "C" ] [
(has_flag "chase")
(subject_matches [
"Your credit card statement is available"
])
]}
${pure_flags [ "chase-spam" "D" ] [
(has_flag "chase")
(anyof [
(header_is "From" "Chase Credit Journey <no.reply.alerts@chase.com>")
(subject_is [
"Review your recent activity"
"Good news: You may qualify for a credit line increase!"
"Your Chase card is available to use with Paze - Activate now!"
]) ])
]) ]
]} }
${pure_flags
[ "wells-fargo-statements" "banking-statements" "C" ]
[
(has_flag "wells-fargo")
(subject_matches [
"Your statement for credit card account *"
"Your statement for account *"
])
]
}
${pure_flags
[ "wells-fargo-action-required" "A" ]
[
# wf is actually careful about saying action required
(has_flag "wells-fargo")
(subject_matches "Action Required: *")
]
}
${pure_flags
[ "wells-fargo-misc" "A" ]
[
(has_flag "wells-fargo")
(not (has_flag "wells-fargo-transactions"))
(not (has_flag "wells-fargo-statements"))
(not (has_flag "wells-fargo-action-required"))
]
}
${pure_flags [ "chase" "banking" ] (envelope_is "chase@shelvacu.com")}
${pure_flags
[ "chase-transactions" "banking-transactions" "B" ]
[
(has_flag "chase")
(subject_matches [
"Your * payment is scheduled"
"You made a * transaction with *"
"Your * transaction with *"
"Chase security alert: You signed in with a new device"
])
]
}
${pure_flags
[ "chase-statements" "banking-statements" "C" ]
[
(has_flag "chase")
(subject_matches [
"Your credit card statement is available"
])
]
}
${pure_flags
[ "chase-spam" "D" ]
[
(has_flag "chase")
(anyof [
(header_is "From" "Chase Credit Journey <no.reply.alerts@chase.com>")
(subject_is [
"Review your recent activity"
"Good news: You may qualify for a credit line increase!"
"Your Chase card is available to use with Paze - Activate now!"
])
])
]
}
${pure_flags [ "experian" ] (envelope_is "fbyjemby@shelvacu.com")} ${pure_flags [ "experian" ] (envelope_is "fbyjemby@shelvacu.com")}
${pure_flags [ "experian-spam" "D" ] [ ${pure_flags
(has_flag "experian") [ "experian-spam" "D" ]
(subject_matches [ [
"*, your FICO* Score has been updated" (has_flag "experian")
"Your monthly account statement is here, *" (subject_matches [
]) "*, your FICO* Score has been updated"
]} "Your monthly account statement is here, *"
${pure_flags [ "paypal" "banking" ] [ ])
# can't go purely on envelope, because paypal loves to give my email to every merchant I interact with ]
(envelope_is "paypal@shelvacu.com") }
(from_matches [ ${pure_flags
"*@paypal.com" [ "paypal" "banking" ]
"*@*.paypal.com" [
]) # can't go purely on envelope, because paypal loves to give my email to every merchant I interact with
]} (envelope_is "paypal@shelvacu.com")
${pure_flags [ "paypal-transactions" "banking-transactions" "B" ] [ (from_matches [
(has_flag "paypal") "*@paypal.com"
(subject_matches [ "*@*.paypal.com"
"Receipt for your payment to *" ])
"*: $* USD" ]
"*: $* CAD" }
"*: kr * SEK" ${pure_flags
"You authorized a payment to *" [ "paypal-transactions" "banking-transactions" "B" ]
"You sent an automatic payment to *" [
"Review your new automatic payment setup for *" (has_flag "paypal")
"You have a refund from *" (subject_matches [
]) "Receipt for your payment to *"
]} "*: $* USD"
${pure_flags [ "paypal-statements" "banking-statements" "C" ] [ "*: $* CAD"
(has_flag "paypal") "*: kr * SEK"
(subject_matches [ "You authorized a payment to *"
"*, your * account statement is available." "You sent an automatic payment to *"
]) "Review your new automatic payment setup for *"
]} "You have a refund from *"
])
]
}
${pure_flags
[ "paypal-statements" "banking-statements" "C" ]
[
(has_flag "paypal")
(subject_matches [
"*, your * account statement is available."
])
]
}
${pure_flags [ "usps-id" ] (envelope_is "usps-id@shelvacu.com")} ${pure_flags [ "usps-id" ] (envelope_is "usps-id@shelvacu.com")}
${pure_flags [ "usps-expected-delivery" "C" ] [ ${pure_flags
(has_flag "usps-id") [ "usps-expected-delivery" "C" ]
(subject_matches "USPS* Expected Delivery *") [
]} (has_flag "usps-id")
(subject_matches "USPS* Expected Delivery *")
]
}
${pure_flags ${pure_flags
[ "amazon-ignore" "C" ] [ "amazon-ignore" "C" ]
[ [
@@ -660,73 +697,101 @@ let
${pure_flags "gmail-fwd" (envelope_is "gmailfwd-fc2e10bec8b2@shelvacu.com")} ${pure_flags "gmail-fwd" (envelope_is "gmailfwd-fc2e10bec8b2@shelvacu.com")}
${pure_flags [ "ebay" "orders" ] (envelope_is "ebay@shelvacu.com")} ${pure_flags [ "ebay" "orders" ] (envelope_is "ebay@shelvacu.com")}
${pure_flags [ "ebay-delivered" "B" ] [ ${pure_flags
(has_flag "ebay") [ "ebay-delivered" "B" ]
(subject_matches [ [
"*ORDER DELIVERED: *" (has_flag "ebay")
]) (subject_matches [
]} "*ORDER DELIVERED: *"
${pure_flags [ "ebay-message" "B" ] [ ])
(has_flag "ebay") ]
(from_matches (map (domain: "*@members.${domain}") ebay_domains)) }
]} ${pure_flags
${pure_flags [ "ebay-offer" "B" ] [ [ "ebay-message" "B" ]
(has_flag "ebay") [
(subject_matches [ (has_flag "ebay")
"You have an offer from the seller, *" (from_matches (map (domain: "*@members.${domain}") ebay_domains))
"You saw it at *, but the seller is now offering *" ]
]) }
]} ${pure_flags
${pure_flags [ "ebay-order-update" "C" ] [ [ "ebay-offer" "B" ]
(has_flag "ebay") [
(subject_matches [ (has_flag "ebay")
"Out for delivery: *" (subject_matches [
"*DELIVERY UPDATE: *" "You have an offer from the seller, *"
"*Order update: *" "You saw it at *, but the seller is now offering *"
"EARLY DELIVERY UPDATE: *" ])
"Important information regarding your Global Shipping Program transaction *" #ebay: "important information! your order is being shipped." why did you say this was ""important""??? ]
"Your package is now with *" }
"*Order confirmed: *" ${pure_flags
"Your order is confirmed" [ "ebay-order-update" "C" ]
"Your order is in!" [
"*An update on your order" (has_flag "ebay")
]) (subject_matches [
]} "Out for delivery: *"
${pure_flags [ "ebay-bid-ongoing-notification" "C" ] [ "*DELIVERY UPDATE: *"
(has_flag "ebay") "*Order update: *"
(subject_matches [ "EARLY DELIVERY UPDATE: *"
"Michael, your bid for * is winning" "Important information regarding your Global Shipping Program transaction *" # ebay: "important information! your order is being shipped." why did you say this was ""important""???
"* just got a new bid." "Your package is now with *"
]) "*Order confirmed: *"
]} "Your order is confirmed"
${pure_flags [ "ebay-feedback" "D" ] [ "Your order is in!"
(has_flag "ebay") "*An update on your order"
(subject_matches "Please provide feedback for your eBay items") ])
]} ]
${pure_flags [ "royal-mail" "orders" ] (from_is "no-reply@royalmail.com")} }
${pure_flags [ "royal-mail-delivered" "B" ] [ ${pure_flags
(has_flag "royal-mail") [ "ebay-bid-ongoing-notification" "C" ]
(subject_matches "Your Royal Mail parcel has been delivered") [
]} (has_flag "ebay")
${pure_flags [ "royal-mail-on-the-way" "D" ] [ (subject_matches [
(has_flag "royal-mail") "Michael, your bid for * is winning"
(subject_matches "Your Royal Mail parcel is on its way") "* just got a new bid."
]} ])
${pure_flags [ "aliexpress" "orders" ] ]
(from_is [ }
"transaction@notice.aliexpress.com" ${pure_flags
"aliexpress@notice.aliexpress.com" [ "ebay-feedback" "D" ]
]) [
(has_flag "ebay")
(subject_matches "Please provide feedback for your eBay items")
]
}
${pure_flags [ "royal-mail" "orders" ] (from_is "no-reply@royalmail.com")}
${pure_flags
[ "royal-mail-delivered" "B" ]
[
(has_flag "royal-mail")
(subject_matches "Your Royal Mail parcel has been delivered")
]
}
${pure_flags
[ "royal-mail-on-the-way" "D" ]
[
(has_flag "royal-mail")
(subject_matches "Your Royal Mail parcel is on its way")
]
}
${pure_flags [ "aliexpress" "orders" ] (from_is [
"transaction@notice.aliexpress.com"
"aliexpress@notice.aliexpress.com"
])}
${pure_flags
[ "aliexpress-delivered" "B" ]
[
(has_flag "aliexpress")
(from_is "transaction@notice.aliexpress.com")
(subject_matches "Order * has been signed for")
]
}
${pure_flags
[ "aliexpress" "orders" "C" ]
[
(has_flag "aliexpress")
(not (has_flag "aliexpress-delivered"))
]
} }
${pure_flags [ "aliexpress-delivered" "B" ] [
(has_flag "aliexpress")
(from_is "transaction@notice.aliexpress.com")
(subject_matches "Order * has been signed for")
]}
${pure_flags [ "aliexpress" "orders" "C" ] [
(has_flag "aliexpress")
(not (has_flag "aliexpress-delivered"))
]}
${pure_flags [ "brandcrowd" "D" ] (envelope_is "brandcrowd@shelvacu.com")} ${pure_flags [ "brandcrowd" "D" ] (envelope_is "brandcrowd@shelvacu.com")}
${pure_flags [ "cpapsupplies" "D" ] (envelope_is "cpapsupplies@shelvacu.com")} ${pure_flags [ "cpapsupplies" "D" ] (envelope_is "cpapsupplies@shelvacu.com")}
${pure_flags [ "genshin" "D" ] (envelope_is "genshin@shelvacu.com")} ${pure_flags [ "genshin" "D" ] (envelope_is "genshin@shelvacu.com")}
@@ -759,14 +824,23 @@ let
(subject_is "Your authentication code") (subject_is "Your authentication code")
])} ])}
${pure_flags "itch-io" (from_is "postmaster@itch.io")} ${pure_flags "itch-io" (from_is "postmaster@itch.io")}
${pure_flags [ "itch-io-update" "B.subscriptions" ] [ ${pure_flags
(has_flag "itch-io") [ "itch-io-update" "B.subscriptions" ]
(subject_matches "[itch.io] * update *") [
]} (has_flag "itch-io")
${pure_flags [ "lowering-the-bar" "B.subscriptions" ] [ (subject_matches "[itch.io] * update *")
(envelope_is "ltb@shelvacu.com") ]
]} }
${pure_flags [ "hotels-com" "D" ] (from_matches [ "hotels.com" "*.hotels.com" ])} ${pure_flags
[ "lowering-the-bar" "B.subscriptions" ]
[
(envelope_is "ltb@shelvacu.com")
]
}
${pure_flags [ "hotels-com" "D" ] (from_matches [
"hotels.com"
"*.hotels.com"
])}
${pure_flags ${pure_flags
[ "spamish-by-headers" "C" ] [ "spamish-by-headers" "C" ]

View File

@@ -9,12 +9,13 @@
let let
inherit (lib) mkOption types; inherit (lib) mkOption types;
cfg = config.vacu.hath; cfg = config.vacu.hath;
flags = [ flags =
"--cache-dir=${cfg.cacheDir}" [
"--data-dir=${cfg.dataDir}" "--cache-dir=${cfg.cacheDir}"
"--download-dir=${cfg.downloadDir}" "--data-dir=${cfg.dataDir}"
"--log-dir=${cfg.logDir}" "--download-dir=${cfg.downloadDir}"
] "--log-dir=${cfg.logDir}"
]
++ lib.optional (!cfg.bandwidthMonitor) "--disable_bwm" ++ lib.optional (!cfg.bandwidthMonitor) "--disable_bwm"
++ lib.optional (!cfg.logging) "--disable_logging" ++ lib.optional (!cfg.logging) "--disable_logging"
++ lib.optional cfg.flushLogs "--flush-logs" ++ lib.optional cfg.flushLogs "--flush-logs"
@@ -22,8 +23,7 @@ let
++ lib.optional (cfg.port != null) "--port=${toString cfg.port}" ++ lib.optional (cfg.port != null) "--port=${toString cfg.port}"
++ lib.optional (!cfg.freeSpaceCheck) "--skip_free_space_check" ++ lib.optional (!cfg.freeSpaceCheck) "--skip_free_space_check"
++ lib.optional (!cfg.ipOriginCheck) "--disable-ip-origin-check" ++ lib.optional (!cfg.ipOriginCheck) "--disable-ip-origin-check"
++ lib.optional (!cfg.floodControl) "--disable-flood-control" ++ lib.optional (!cfg.floodControl) "--disable-flood-control";
;
fullCommand = lib.singleton (lib.getExe cfg.package) ++ flags; fullCommand = lib.singleton (lib.getExe cfg.package) ++ flags;
dirs = [ dirs = [
cfg.cacheDir cfg.cacheDir
@@ -31,17 +31,14 @@ let
cfg.downloadDir cfg.downloadDir
cfg.logDir cfg.logDir
]; ];
capabilities = [] capabilities = [ ] ++ lib.optional cfg.allowPrivilegedPort "CAP_NET_BIND_SERVICE";
++ lib.optional cfg.allowPrivilegedPort "CAP_NET_BIND_SERVICE" credentialsType = types.submodule (
; { ... }:
credentialsType = types.submodule ({ ... }: { {
options.clientId = mkOption { options.clientId = mkOption { type = types.ints.unsigned; };
type = types.ints.unsigned; options.clientKeyPath = mkOption { type = types.path; };
}; }
options.clientKeyPath = mkOption { );
type = types.path;
};
});
in in
{ {
options.vacu.hath = { options.vacu.hath = {
@@ -149,7 +146,7 @@ in
isSystemUser = true; isSystemUser = true;
group = cfg.group; group = cfg.group;
}; };
users.groups.${cfg.group} = {}; users.groups.${cfg.group} = { };
systemd.services.hath = { systemd.services.hath = {
wantedBy = lib.mkIf cfg.autoStart [ "multi-user.target" ]; wantedBy = lib.mkIf cfg.autoStart [ "multi-user.target" ];
description = "Hentai@Home client"; description = "Hentai@Home client";

View File

@@ -21,9 +21,7 @@ let
"sniper" "sniper"
"spy" "spy"
]; ];
mkAttrsOf = f: list: builtins.listToAttrs (map (v: mkAttrsOf = f: list: builtins.listToAttrs (map (v: lib.nameValuePair v (f v)) list);
lib.nameValuePair v (f v)
) list);
mkAttrsOfClasses = f: mkAttrsOf f classes; mkAttrsOfClasses = f: mkAttrsOf f classes;
# key: what tf2 calls the key # key: what tf2 calls the key
# value: other things you might want to call that key # value: other things you might want to call that key
@@ -31,30 +29,84 @@ let
# from https://developer.valvesoftware.com/wiki/Bind#Special_Keys # from https://developer.valvesoftware.com/wiki/Bind#Special_Keys
escape = [ "esc" ]; escape = [ "esc" ];
capslock = [ "caps_lock" ]; capslock = [ "caps_lock" ];
shift = [ "lshift" "left_shift" ]; shift = [
"lshift"
"left_shift"
];
rshift = [ "right_shfit" ]; rshift = [ "right_shfit" ];
ctrl = [ "lctrl" "control" "lcontrol" "left_control" ]; ctrl = [
rctrl = [ "rcontrol" "right_control" ]; "lctrl"
alt = [ "lalt" "left_alt" ]; "control"
"lcontrol"
"left_control"
];
rctrl = [
"rcontrol"
"right_control"
];
alt = [
"lalt"
"left_alt"
];
ralt = [ "right_alt" ]; ralt = [ "right_alt" ];
space = [ "spacebar" ]; space = [ "spacebar" ];
backspace = [ "bksp" ]; backspace = [ "bksp" ];
enter = [ "return" ]; enter = [ "return" ];
semicolon = [ ";" ]; semicolon = [ ";" ];
lwin = [ "win" "left_win" "meta" "lmeta" "left_meta" "super" "lsuper" "left_super" ]; lwin = [
rwin = [ "right_win" "rmeta" "right_meta" "rsuper" "right_super" ]; "win"
"left_win"
"meta"
"lmeta"
"left_meta"
"super"
"lsuper"
"left_super"
];
rwin = [
"right_win"
"rmeta"
"right_meta"
"rsuper"
"right_super"
];
apps = [ "menu" ]; apps = [ "menu" ];
numlock = [ "num_lock" "number_lock" ]; numlock = [
scrolllock = [ "scroll_lock" "scrlk" ]; "num_lock"
"number_lock"
];
scrolllock = [
"scroll_lock"
"scrlk"
];
uparrow = [ "up" ]; uparrow = [ "up" ];
downarrow = [ "dn" "down" ]; downarrow = [
leftarrow = [ "le" "left" ]; "dn"
rightarrow = [ "ri" "right" ]; "down"
];
leftarrow = [
"le"
"left"
];
rightarrow = [
"ri"
"right"
];
ins = [ "insert" ]; ins = [ "insert" ];
del = [ "delete" ]; del = [ "delete" ];
pgdn = [ "pagedown" "page_down" ]; pgdn = [
pgup = [ "pageup" "page_up" ]; "pagedown"
pause = [ "pausebreak" "pause_break" "break" ]; "page_down"
];
pgup = [
"pageup"
"page_up"
];
pause = [
"pausebreak"
"pause_break"
"break"
];
kp_end = [ "kp1" ]; kp_end = [ "kp1" ];
kp_downarrow = [ "kp2" ]; kp_downarrow = [ "kp2" ];
kp_pgdn = [ "kp3" ]; kp_pgdn = [ "kp3" ];
@@ -65,139 +117,310 @@ let
kp_uparrow = [ "kp8" ]; kp_uparrow = [ "kp8" ];
kp_pgup = [ "kp9" ]; kp_pgup = [ "kp9" ];
kp_enter = [ "kpent" ]; kp_enter = [ "kpent" ];
kp_ins = [ "kp0" "kp_insert" ]; kp_ins = [
kp_del = [ "kp." "kp_dot" "kpdot" "kp_decimal" "kpdecimal" "kp_point" "kppoint" ]; "kp0"
kp_slash = [ "kp/" "kp_divide" "kpdivide" ]; "kp_insert"
kp_multiply = [ "kp*" "kp_star" "kpstar" "kpmultiply" ]; ];
kp_minus = [ "kp-" "kpminus" "kp_dash" "kpdash" ]; kp_del = [
kp_plus = [ "kp+" "kpplus" ]; "kp."
mwheeldown = [ "scroll_down" "scrolldown" "scrolldn" "scroll_dn" ]; "kp_dot"
mwheelup = [ "scroll_up" "scrollup" ]; "kpdot"
mouse1 = [ "left_click" "leftclick" "primary_click" "primaryclick" ]; "kp_decimal"
mouse2 = [ "right_click" "rightclick" "secondary_click" "secondaryclick" ]; "kpdecimal"
mouse3 = [ "middle_click" "middleclick" ]; "kp_point"
mouse4 = []; "kppoint"
mouse5 = []; ];
kp_slash = [
"kp/"
"kp_divide"
"kpdivide"
];
kp_multiply = [
"kp*"
"kp_star"
"kpstar"
"kpmultiply"
];
kp_minus = [
"kp-"
"kpminus"
"kp_dash"
"kpdash"
];
kp_plus = [
"kp+"
"kpplus"
];
mwheeldown = [
"scroll_down"
"scrolldown"
"scrolldn"
"scroll_dn"
];
mwheelup = [
"scroll_up"
"scrollup"
];
mouse1 = [
"left_click"
"leftclick"
"primary_click"
"primaryclick"
];
mouse2 = [
"right_click"
"rightclick"
"secondary_click"
"secondaryclick"
];
mouse3 = [
"middle_click"
"middleclick"
];
mouse4 = [ ];
mouse5 = [ ];
#gamepad #gamepad
joy1 = [ "a_button" "xbox_a" "playstation_x" "playstation_cross" ]; joy1 = [
joy2 = [ "b_button" "xbox_b" "playstation_o" "playstation_circle" ]; "a_button"
joy3 = [ "x_button" "xbox_x" "playstation_[]" "playstation_square" ]; "xbox_a"
joy4 = [ "y_button" "xbox_y" "playstation_^" "playstation_triangle" ]; "playstation_x"
joy5 = [ "l_shoulder" "xbox_left_bumper" "xbox_lb" "left_bumper" "lb" "playstation_l1" "l1" ]; "playstation_cross"
joy6 = [ "r_shoulder" "xbox_right_bumper" "xbox_rb" "right_bumper" "rb" "playstation_r1" "r1" ]; ];
joy7 = [ "back" "xbox_back" "view" "xbox_view" "playstation_l2" "l2" ]; joy2 = [
joy8 = [ "start" "xbox_start" "xbox_menu" "playstation_r2" "r2" ]; "b_button"
joy9 = [ "stick1" "lstick" "xbox_lstick" "xbox_left_stick" "playstation_select" "playstation_share" "playstation_create" ]; "xbox_b"
joy10= [ "stick2" "rstick" "xbox_rstick" "xbox_right_stick" "playstation_start" "playstation_options" ]; "playstation_o"
joy11= [ "playstation_l3" "l3" ]; "playstation_circle"
joy12= [ "playstation_r3" "r3" ]; ];
pov_up = [ "dpad_up" ]; joy3 = [
pov_right = [ "dpad_ri" "dpad_right" ]; "x_button"
pov_left = [ "dpad_le" "dpad_left" ]; "xbox_x"
pov_down = [ "dpad_dn" "dpad_down" ]; "playstation_[]"
"playstation_square"
];
joy4 = [
"y_button"
"xbox_y"
"playstation_^"
"playstation_triangle"
];
joy5 = [
"l_shoulder"
"xbox_left_bumper"
"xbox_lb"
"left_bumper"
"lb"
"playstation_l1"
"l1"
];
joy6 = [
"r_shoulder"
"xbox_right_bumper"
"xbox_rb"
"right_bumper"
"rb"
"playstation_r1"
"r1"
];
joy7 = [
"back"
"xbox_back"
"view"
"xbox_view"
"playstation_l2"
"l2"
];
joy8 = [
"start"
"xbox_start"
"xbox_menu"
"playstation_r2"
"r2"
];
joy9 = [
"stick1"
"lstick"
"xbox_lstick"
"xbox_left_stick"
"playstation_select"
"playstation_share"
"playstation_create"
];
joy10 = [
"stick2"
"rstick"
"xbox_rstick"
"xbox_right_stick"
"playstation_start"
"playstation_options"
];
joy11 = [
"playstation_l3"
"l3"
];
joy12 = [
"playstation_r3"
"r3"
];
pov_up = [ "dpad_up" ];
pov_right = [
"dpad_ri"
"dpad_right"
];
pov_left = [
"dpad_le"
"dpad_left"
];
pov_down = [
"dpad_dn"
"dpad_down"
];
# keys named by their character # keys named by their character
"`" = [ "tilde" "~" "accent" "grave" "backtick" ]; "`" = [
"-" = [ "minus" "dash" ]; "tilde"
"=" = [ "plus" "equals" ]; "~"
"[" = [ "left_bracket" "le_bracket" ]; "accent"
"]" = [ "right_bracket" "ri_bracket" ]; "grave"
"\\" = [ "backslash" "back_slash" ]; "backtick"
];
"-" = [
"minus"
"dash"
];
"=" = [
"plus"
"equals"
];
"[" = [
"left_bracket"
"le_bracket"
];
"]" = [
"right_bracket"
"ri_bracket"
];
"\\" = [
"backslash"
"back_slash"
];
# semicolon is above # semicolon is above
"'" = [ "quote" "tick" "single_quote" ]; "'" = [
"quote"
"tick"
"single_quote"
];
"," = [ "comma" ]; "," = [ "comma" ];
"." = [ "dot" "period" ]; "." = [
"/" = [ "slash" "forwardslash" "forward_slash" ]; "dot"
}; "period"
keys = (vaculib.listOfLines {} '' ];
f1 "/" = [
f2 "slash"
f3 "forwardslash"
f4 "forward_slash"
f5
f6
f7
f8
f9
f10
f11
f12
tab
home
end
1
2
3
4
5
6
7
8
9
0
q
w
e
r
t
y
u
i
o
p
a
s
d
f
g
h
j
k
l
z
x
c
v
b
n
m
'')++ builtins.attrNames keyAliases;
bindCommandType = types.strMatching ''[a-zA-Z0-9'; +_-]+'';
bindsModule = { config, ... }: {
options = (mkAttrsOf (key: mkOption {
type = types.nullOr bindCommandType;
default = null;
}) keys) // {
_out = mkOption {
internal = true;
readOnly = true;
default = lib.pipe keys [
(lib.filter (key: config.${key} != null))
(map (key: ''bind "${key}" "${config.${key}}"''))
(lib.concatStringsSep "\n")
];
};
};
imports = lib.pipe keyAliases [
(lib.mapAttrsToList (key: aliases:
lib.flip map aliases (alias:
lib.doRename {
from = [ alias ];
to = [ key ];
warn = false;
use = lib.id;
visible = true;
withPriority = true;
}
)
))
lib.flatten
]; ];
}; };
keys =
(vaculib.listOfLines { } ''
f1
f2
f3
f4
f5
f6
f7
f8
f9
f10
f11
f12
tab
home
end
1
2
3
4
5
6
7
8
9
0
q
w
e
r
t
y
u
i
o
p
a
s
d
f
g
h
j
k
l
z
x
c
v
b
n
m
'')
++ builtins.attrNames keyAliases;
bindCommandType = types.strMatching ''[a-zA-Z0-9'; +_-]+'';
bindsModule =
{ config, ... }:
{
options =
(mkAttrsOf (
key:
mkOption {
type = types.nullOr bindCommandType;
default = null;
}
) keys)
// {
_out = mkOption {
internal = true;
readOnly = true;
default = lib.pipe keys [
(lib.filter (key: config.${key} != null))
(map (key: ''bind "${key}" "${config.${key}}"''))
(lib.concatStringsSep "\n")
];
};
};
imports = lib.pipe keyAliases [
(lib.mapAttrsToList (
key: aliases:
lib.flip map aliases (
alias:
lib.doRename {
from = [ alias ];
to = [ key ];
warn = false;
use = lib.id;
visible = true;
withPriority = true;
}
)
))
lib.flatten
];
};
in in
{ {
options.tf2 = { options.tf2 = {
@@ -205,45 +428,53 @@ in
default = tf2Pkgs; default = tf2Pkgs;
readOnly = true; readOnly = true;
}; };
binds = { binds =
clear = mkOption { {
type = types.bool; clear = mkOption {
default = true; type = types.bool;
description = "Whether to run unbindall at the beginning of autoexec"; default = true;
}; description = "Whether to run unbindall at the beginning of autoexec";
default = mkOption { };
type = types.submodule bindsModule; default = mkOption {
default = {}; type = types.submodule bindsModule;
}; default = { };
} // mkAttrsOfClasses (classname: mkOption { };
type = types.submodule bindsModule; }
default = {}; // mkAttrsOfClasses (
}); classname:
mkOption {
type = types.submodule bindsModule;
default = { };
}
);
autoexecLines = mkOption { autoexecLines = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
}; };
classLines = mkAttrsOfClasses (classname: mkOption { classLines = mkAttrsOfClasses (
type = types.lines; classname:
default = ""; mkOption {
}); type = types.lines;
default = "";
}
);
build.autoexec = vaculib.mkOutOption (pkgs.writeFile "autoexec.cfg" cfg.autoexecLines); build.autoexec = vaculib.mkOutOption (pkgs.writeFile "autoexec.cfg" cfg.autoexecLines);
build.classes = vaculib.mkOutOption (mkAttrsOfClasses (classname: build.classes = vaculib.mkOutOption (
pkgs.writeText "${classname}.cfg" cfg.classLines.${classname} mkAttrsOfClasses (classname: pkgs.writeText "${classname}.cfg" cfg.classLines.${classname})
)); );
}; };
config.tf2 = { config.tf2 = {
autoexecLines = lib.mkMerge ([ autoexecLines = lib.mkMerge (
'' [
// START keybinds from config.tf2.binds.default ''
${cfg.binds.default._out} // START keybinds from config.tf2.binds.default
// END keybinds from config.tf2.binds.default ${cfg.binds.default._out}
'' // END keybinds from config.tf2.binds.default
] ''
]
++ lib.optional cfg.binds.clear (lib.mkBefore ''unbindall'') ++ lib.optional cfg.binds.clear (lib.mkBefore ''unbindall'')
) );
;
classLines = mkAttrsOfClasses (classname: '' classLines = mkAttrsOfClasses (classname: ''
// START keybinds from config.tf2.binds.${classname} // START keybinds from config.tf2.binds.${classname}
${cfg.binds.${classname}._out} ${cfg.binds.${classname}._out}

View File

@@ -38,6 +38,6 @@
yamlls.enable = true; yamlls.enable = true;
}; };
}; };
plugins.lean.enable = false; #lean build is broken, previously !minimal; plugins.lean.enable = false; # lean build is broken, previously !minimal;
plugins.lean.settings.mappings = true; plugins.lean.settings.mappings = true;
} }

View File

@@ -25,16 +25,16 @@ for configName in "${configs[@]}"; do
format="$(jq '.format' -r <<<"$thisSecretInfo")" format="$(jq '.format' -r <<<"$thisSecretInfo")"
sopsFile="$(jq '.sopsFile' -r <<<"$thisSecretInfo")" sopsFile="$(jq '.sopsFile' -r <<<"$thisSecretInfo")"
case "$format" in case "$format" in
yaml|json|binary) yaml | json | binary)
# we know how to deal with this # we know how to deal with this
: :
;; ;;
*) *)
svl_throw "dunno what to do with format $format for $thisSecretNixPath" svl_throw "dunno what to do with format $format for $thisSecretNixPath"
;; ;;
esac esac
declare key declare key
if [[ "$format" == binary ]]; then if [[ $format == binary ]]; then
key="" key=""
else else
key="$(jq '.key' -r <<<"$thisSecretInfo")" key="$(jq '.key' -r <<<"$thisSecretInfo")"
@@ -50,7 +50,7 @@ for configName in "${configs[@]}"; do
exitCode=1 exitCode=1
continue continue
fi fi
if [[ "$format" != binary ]]; then if [[ $format != binary ]]; then
# now try to read the specific key we're interested in # now try to read the specific key we're interested in
if ! "${sopsCmd[@]}" --extract "[\"$key\"]" -- "$sopsFile" >/dev/null; then if ! "${sopsCmd[@]}" --extract "[\"$key\"]" -- "$sopsFile" >/dev/null; then
svl_err "${thisSecretNixPath}: sops file $sopsFile does not contain key $key" svl_err "${thisSecretNixPath}: sops file $sopsFile does not contain key $key"

View File

@@ -1,4 +1 @@
{ { writers }: writers.writeBashBin "ensure-secrets" { } (builtins.readFile ./ensure-secrets.bash)
writers,
}:
writers.writeBashBin "ensure-secrets" { } (builtins.readFile ./ensure-secrets.bash)

View File

@@ -1,8 +1,4 @@
{ { vacuModules, config, ... }:
vacuModules,
config,
...
}:
let let
port = 62622; port = 62622;
in in

View File

@@ -11,22 +11,33 @@ let
g = m * 1000; g = m * 1000;
t = g * 1000; t = g * 1000;
ki = 1024; ki = 1024;
safe_size = size: safe_size =
size:
lib.pipe size [ lib.pipe size [
(n: n * 0.99) # leave 1% unused (n: n * 0.99) # leave 1% unused
(n: n / (4*ki)) # convert to sectors (n: n / (4 * ki)) # convert to sectors
builtins.floor # integer number of sectors builtins.floor # integer number of sectors
(n: n * (4*ki)) # convert to bytes (n: n * (4 * ki)) # convert to bytes
] ];
;
# I have drives that are 8TB, 10TB, and 14TB. By partitioning the 14TB into 8 + 2 + 4 and the 10TB into 8 + 2, I can create a vdevs across a bunch of 8TB, 2TB, and 4TB partitions # I have drives that are 8TB, 10TB, and 14TB. By partitioning the 14TB into 8 + 2 + 4 and the 10TB into 8 + 2, I can create a vdevs across a bunch of 8TB, 2TB, and 4TB partitions
slabsMin = { slabsMin = {
slabA = { idx = 0; sizeT = 8; }; slabA = {
slabB = { idx = 1; sizeT = 2; }; idx = 0;
slabC = { idx = 2; sizeT = 4; }; sizeT = 8;
};
slabB = {
idx = 1;
sizeT = 2;
};
slabC = {
idx = 2;
sizeT = 4;
};
}; };
slabs = lib.mapAttrs (name: value: slabs = lib.mapAttrs (
value // rec { name: value:
value
// rec {
inherit name; inherit name;
sizeBytes = safe_size (value.sizeT * t); sizeBytes = safe_size (value.sizeT * t);
sizeKi = sizeBytes / ki; sizeKi = sizeBytes / ki;
@@ -89,70 +100,68 @@ let
poolname = "propdata"; poolname = "propdata";
diskName = groupName: id: "${groupName}_${lib.last (lib.splitString "_" id)}"; diskName = groupName: id: "${groupName}_${lib.last (lib.splitString "_" id)}";
mk_configs = { groupName, diskIds, partitions }: mk_configs =
builtins.listToAttrs (map (id: { {
name = diskName groupName id; groupName,
value = { diskIds,
type = "disk"; partitions,
device = path_prefix + id; }:
content = { builtins.listToAttrs (
type = "gpt"; map (id: {
inherit partitions; name = diskName groupName id;
value = {
type = "disk";
device = path_prefix + id;
content = {
type = "gpt";
inherit partitions;
};
}; };
}; }) diskIds
}) diskIds) );
;
groupAttrs = { groupAttrs = {
es14a = { es14a = {
groupName = "es14a"; groupName = "es14a";
diskIds = easystores_14_active; diskIds = easystores_14_active;
partitions = { partitions = { inherit (slabParts) slabA slabB slabC; };
inherit (slabParts) slabA slabB slabC;
};
}; };
es14s = { es14s = {
groupName = "es14s"; groupName = "es14s";
diskIds = easystores_14_spare; diskIds = easystores_14_spare;
partitions = { partitions = { inherit (slabParts) slabA slabB slabC; };
inherit (slabParts) slabA slabB slabC;
};
}; };
es10 = { es10 = {
groupName = "es10"; groupName = "es10";
diskIds = easystores_10; diskIds = easystores_10;
partitions = { partitions = { inherit (slabParts) slabA slabB; };
inherit (slabParts) slabA slabB;
};
}; };
sg8 = { sg8 = {
groupName = "sg8"; groupName = "sg8";
diskIds = seagates; diskIds = seagates;
partitions = { partitions = { inherit (slabParts) slabA; };
inherit (slabParts) slabA;
};
}; };
}; };
partNames = groupName: partName: map (id: config.disko.devices.disk.${diskName groupName id}.content.partitions.${partName}.device) groupAttrs.${groupName}.diskIds; partNames =
groupName: partName:
map (
id: config.disko.devices.disk.${diskName groupName id}.content.partitions.${partName}.device
) groupAttrs.${groupName}.diskIds;
in in
{ {
imports = [ inputs.disko.nixosModules.default ]; imports = [ inputs.disko.nixosModules.default ];
options.vacu.prophecy = lib.mapAttrs (_: vaculib.mkOutOption) { options.vacu.prophecy = lib.mapAttrs (_: vaculib.mkOutOption) {
inherit inherit easystores_10 easystores_14 seagates;
easystores_10
easystores_14
seagates
;
}; };
config.disko = { config.disko = {
enableConfig = false; enableConfig = false;
checkScripts = true; checkScripts = true;
rootMountPoint = "/"; rootMountPoint = "/";
devices.disk = {} devices.disk =
{ }
// mk_configs groupAttrs.es14a // mk_configs groupAttrs.es14a
// mk_configs groupAttrs.es14s // mk_configs groupAttrs.es14s
// mk_configs groupAttrs.es10 // mk_configs groupAttrs.es10
// mk_configs groupAttrs.sg8 // mk_configs groupAttrs.sg8;
;
devices.zpool."${poolname}" = { devices.zpool."${poolname}" = {
type = "zpool"; type = "zpool";
options = { options = {
@@ -180,12 +189,19 @@ in
# slabA # slabA
{ {
mode = "raidz3"; mode = "raidz3";
members = lib.concatMap (a: partNames a "slabA") [ "sg8" "es10" "es14a" ]; members = lib.concatMap (a: partNames a "slabA") [
"sg8"
"es10"
"es14a"
];
} }
# slabB # slabB
{ {
mode = "raidz3"; mode = "raidz3";
members = lib.concatMap (a: partNames a "slabB") [ "es10" "es14a" ]; members = lib.concatMap (a: partNames a "slabB") [
"es10"
"es14a"
];
} }
# slabC # slabC
{ {

View File

@@ -1,7 +1,4 @@
{ { pkgs, ... }:
pkgs,
...
}:
let let
serialNode = "/dev/ttyUSB0"; serialNode = "/dev/ttyUSB0";
in in

View File

@@ -1,7 +1,4 @@
{ { vacuModules, ... }:
vacuModules,
...
}:
{ {
imports = [ vacuModules.tf2 ]; imports = [ vacuModules.tf2 ];

View File

@@ -80,5 +80,3 @@
"MWHEELUP" = "invprev" "MWHEELUP" = "invprev"
"MWHEELDOWN" = "invnext" "MWHEELDOWN" = "invnext"
``` ```

View File

@@ -88,7 +88,7 @@
# zfs can break with hibernate but takes no steps to warn/prevent this >:( # zfs can break with hibernate but takes no steps to warn/prevent this >:(
boot.kernelParams = [ boot.kernelParams = [
"nohibernate" "nohibernate"
"panic=10" #on panic, reboot after 10s "panic=10" # on panic, reboot after 10s
]; ];
boot.supportedFilesystems = [ boot.supportedFilesystems = [
"zfs" # needed to mount trip zfs pool "zfs" # needed to mount trip zfs pool