diff --git a/common/shell/not-aliases.nix b/common/shell/not-aliases.nix index 467bd33..15d4751 100644 --- a/common/shell/not-aliases.nix +++ b/common/shell/not-aliases.nix @@ -30,18 +30,23 @@ let _comp_command_offset 0 ''; in - pkgs.runCommandLocal "vacu-notalias-simple-${name}" { pname = name; meta.mainProgram = name; } '' - mkdir -p "$out"/bin - printf '%s' ${lib.escapeShellArg binContents} > "$out"/bin/${name} - chmod a+x "$out"/bin/${name} - out_base="$(dirname -- "$out")" - 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" - ''; + pkgs.runCommandLocal "vacu-notalias-simple-${name}" + { + pname = name; + meta.mainProgram = name; + } + '' + mkdir -p "$out"/bin + printf '%s' ${lib.escapeShellArg binContents} > "$out"/bin/${name} + chmod a+x "$out"/bin/${name} + out_base="$(dirname -- "$out")" + 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: '' svl_minmax_args $# 1 3 host="$1" @@ -53,11 +58,7 @@ let journalctl = "${pkgs.systemd}/bin/journalctl"; in { - imports = [ - { - vacu.packages.copy-altcaps.enable = config.vacu.isGui; - } - ]; + imports = [ { vacu.packages.copy-altcaps.enable = config.vacu.isGui; } ]; vacu.packages = [ (script "ms" (ms_text false)) (script "mss" (ms_text true)) @@ -122,8 +123,14 @@ in "$view_cmd" "$l" rm -r "$d" '') - (simple "nixcat" [ "nixview" "cat" ]) - (simple "nixless" [ "nixview" "less" ]) + (simple "nixcat" [ + "nixview" + "cat" + ]) + (simple "nixless" [ + "nixview" + "less" + ]) (simple "sc" [ systemctl ]) (simple "scs" [ systemctl @@ -148,7 +155,10 @@ in "--pager-end" "-u" ]) - (simple "gs" [ "git" "status" ]) + (simple "gs" [ + "git" + "status" + ]) (script "list-auto-roots" '' auto_roots="/nix/var/nix/gcroots/auto" svl_exact_args $# 0 diff --git a/fw/default.nix b/fw/default.nix index 748d982..2208f97 100644 --- a/fw/default.nix +++ b/fw/default.nix @@ -27,9 +27,7 @@ vacu.verifySystem.expectedMac = "e8:65:38:52:5c:59"; vacu.systemKind = "laptop"; - boot.binfmt.emulatedSystems = [ - "aarch64-linux" - ]; + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; boot.kernelPackages = pkgs.linuxKernel.packages.linux_lqx; networking.networkmanager.enable = true; services.irqbalance.enable = true; diff --git a/fw/podman.nix b/fw/podman.nix index 19af019..0124be6 100644 --- a/fw/podman.nix +++ b/fw/podman.nix @@ -1,6 +1,4 @@ -{ - ... -}: +{ ... }: { virtualisation.containers.enable = true; virtualisation.podman = { @@ -10,6 +8,6 @@ # Required for containers under podman-compose to be able to talk to each other. defaultNetwork.settings.dns_enabled = true; }; - + users.users.shelvacu.extraGroups = [ "podman" ]; } diff --git a/liam/sieve.nix b/liam/sieve.nix index b0fe55c..0e10d2e 100644 --- a/liam/sieve.nix +++ b/liam/sieve.nix @@ -142,7 +142,7 @@ let else assert "dunno what to do with this"; null; - is_flagish = + is_flagish = flag_name: let # escape_all = map lib.escapeRegex; @@ -263,7 +263,7 @@ let has_flag = 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}''; set_with_interp = var_name: new_val: @@ -354,7 +354,7 @@ let } ''; # trimmed down from https://pages.ebay.com/securitycenter/security_researchers_eligible_domains.html - ebay_domains = vaculib.listOfLines {} '' + ebay_domains = vaculib.listOfLines { } '' ebay.com ebay.co.uk ebay.com.au @@ -467,105 +467,142 @@ let removeflag "D"; ${pure_flags [ "wells-fargo" "banking" ] (envelope_is "wf-primary@shelvacu.com")} - ${pure_flags [ "wells-fargo-transactions" "banking-transactions" "B" ] [ - (has_flag "wells-fargo") - (subject_matches [ - "You just got paid!" - "Wells Fargo card purchase exceeded preset amount" - "You made a payment" - "You made a credit card purchase of *" - "Your card wasn't present for a purchase" - "Account update" - "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 ") - (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-transactions" "banking-transactions" "B" ] + [ + (has_flag "wells-fargo") + (subject_matches [ + "You just got paid!" + "Wells Fargo card purchase exceeded preset amount" + "You made a payment" + "You made a credit card purchase of *" + "Your card wasn't present for a purchase" + "Account update" + "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 ") + (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-spam" "D" ] [ - (has_flag "experian") - (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 [ - "*@paypal.com" - "*@*.paypal.com" - ]) - ]} - ${pure_flags [ "paypal-transactions" "banking-transactions" "B" ] [ - (has_flag "paypal") - (subject_matches [ - "Receipt for your payment to *" - "*: $* USD" - "*: $* CAD" - "*: kr * SEK" - "You authorized a payment to *" - "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 + [ "experian-spam" "D" ] + [ + (has_flag "experian") + (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 [ + "*@paypal.com" + "*@*.paypal.com" + ]) + ] + } + ${pure_flags + [ "paypal-transactions" "banking-transactions" "B" ] + [ + (has_flag "paypal") + (subject_matches [ + "Receipt for your payment to *" + "*: $* USD" + "*: $* CAD" + "*: kr * SEK" + "You authorized a payment to *" + "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-expected-delivery" "C" ] [ - (has_flag "usps-id") - (subject_matches "USPS* Expected Delivery *") - ]} + ${pure_flags + [ "usps-expected-delivery" "C" ] + [ + (has_flag "usps-id") + (subject_matches "USPS* Expected Delivery *") + ] + } ${pure_flags [ "amazon-ignore" "C" ] [ @@ -660,73 +697,101 @@ let ${pure_flags "gmail-fwd" (envelope_is "gmailfwd-fc2e10bec8b2@shelvacu.com")} ${pure_flags [ "ebay" "orders" ] (envelope_is "ebay@shelvacu.com")} - ${pure_flags [ "ebay-delivered" "B" ] [ - (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 [ "ebay-offer" "B" ] [ - (has_flag "ebay") - (subject_matches [ - "You have an offer from the seller, *" - "You saw it at *, but the seller is now offering *" - ]) - ]} - ${pure_flags [ "ebay-order-update" "C" ] [ - (has_flag "ebay") - (subject_matches [ - "Out for delivery: *" - "*DELIVERY UPDATE: *" - "*Order update: *" - "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: *" - "Your order is confirmed" - "Your order is in!" - "*An update on your order" - ]) - ]} - ${pure_flags [ "ebay-bid-ongoing-notification" "C" ] [ - (has_flag "ebay") - (subject_matches [ - "Michael, your bid for * is winning" - "* just got a new bid." - ]) - ]} - ${pure_flags [ "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 + [ "ebay-delivered" "B" ] + [ + (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 + [ "ebay-offer" "B" ] + [ + (has_flag "ebay") + (subject_matches [ + "You have an offer from the seller, *" + "You saw it at *, but the seller is now offering *" + ]) + ] + } + ${pure_flags + [ "ebay-order-update" "C" ] + [ + (has_flag "ebay") + (subject_matches [ + "Out for delivery: *" + "*DELIVERY UPDATE: *" + "*Order update: *" + "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: *" + "Your order is confirmed" + "Your order is in!" + "*An update on your order" + ]) + ] + } + ${pure_flags + [ "ebay-bid-ongoing-notification" "C" ] + [ + (has_flag "ebay") + (subject_matches [ + "Michael, your bid for * is winning" + "* just got a new bid." + ]) + ] + } + ${pure_flags + [ "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 [ "cpapsupplies" "D" ] (envelope_is "cpapsupplies@shelvacu.com")} ${pure_flags [ "genshin" "D" ] (envelope_is "genshin@shelvacu.com")} @@ -759,14 +824,23 @@ let (subject_is "Your authentication code") ])} ${pure_flags "itch-io" (from_is "postmaster@itch.io")} - ${pure_flags [ "itch-io-update" "B.subscriptions" ] [ - (has_flag "itch-io") - (subject_matches "[itch.io] * update *") - ]} - ${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 + [ "itch-io-update" "B.subscriptions" ] + [ + (has_flag "itch-io") + (subject_matches "[itch.io] * update *") + ] + } + ${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 [ "spamish-by-headers" "C" ] diff --git a/modules/hath/module.nix b/modules/hath/module.nix index 5a0e6b2..efcba75 100644 --- a/modules/hath/module.nix +++ b/modules/hath/module.nix @@ -9,12 +9,13 @@ let inherit (lib) mkOption types; cfg = config.vacu.hath; - flags = [ - "--cache-dir=${cfg.cacheDir}" - "--data-dir=${cfg.dataDir}" - "--download-dir=${cfg.downloadDir}" - "--log-dir=${cfg.logDir}" - ] + flags = + [ + "--cache-dir=${cfg.cacheDir}" + "--data-dir=${cfg.dataDir}" + "--download-dir=${cfg.downloadDir}" + "--log-dir=${cfg.logDir}" + ] ++ lib.optional (!cfg.bandwidthMonitor) "--disable_bwm" ++ lib.optional (!cfg.logging) "--disable_logging" ++ lib.optional cfg.flushLogs "--flush-logs" @@ -22,8 +23,7 @@ let ++ lib.optional (cfg.port != null) "--port=${toString cfg.port}" ++ lib.optional (!cfg.freeSpaceCheck) "--skip_free_space_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; dirs = [ cfg.cacheDir @@ -31,17 +31,14 @@ let cfg.downloadDir cfg.logDir ]; - capabilities = [] - ++ lib.optional cfg.allowPrivilegedPort "CAP_NET_BIND_SERVICE" - ; - credentialsType = types.submodule ({ ... }: { - options.clientId = mkOption { - type = types.ints.unsigned; - }; - options.clientKeyPath = mkOption { - type = types.path; - }; - }); + capabilities = [ ] ++ lib.optional cfg.allowPrivilegedPort "CAP_NET_BIND_SERVICE"; + credentialsType = types.submodule ( + { ... }: + { + options.clientId = mkOption { type = types.ints.unsigned; }; + options.clientKeyPath = mkOption { type = types.path; }; + } + ); in { options.vacu.hath = { @@ -149,7 +146,7 @@ in isSystemUser = true; group = cfg.group; }; - users.groups.${cfg.group} = {}; + users.groups.${cfg.group} = { }; systemd.services.hath = { wantedBy = lib.mkIf cfg.autoStart [ "multi-user.target" ]; description = "Hentai@Home client"; diff --git a/modules/tf2/module.nix b/modules/tf2/module.nix index 2978388..3e388c7 100644 --- a/modules/tf2/module.nix +++ b/modules/tf2/module.nix @@ -21,9 +21,7 @@ let "sniper" "spy" ]; - mkAttrsOf = f: list: builtins.listToAttrs (map (v: - lib.nameValuePair v (f v) - ) list); + mkAttrsOf = f: list: builtins.listToAttrs (map (v: lib.nameValuePair v (f v)) list); mkAttrsOfClasses = f: mkAttrsOf f classes; # key: what tf2 calls the 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 escape = [ "esc" ]; capslock = [ "caps_lock" ]; - shift = [ "lshift" "left_shift" ]; + shift = [ + "lshift" + "left_shift" + ]; rshift = [ "right_shfit" ]; - ctrl = [ "lctrl" "control" "lcontrol" "left_control" ]; - rctrl = [ "rcontrol" "right_control" ]; - alt = [ "lalt" "left_alt" ]; + ctrl = [ + "lctrl" + "control" + "lcontrol" + "left_control" + ]; + rctrl = [ + "rcontrol" + "right_control" + ]; + alt = [ + "lalt" + "left_alt" + ]; ralt = [ "right_alt" ]; space = [ "spacebar" ]; backspace = [ "bksp" ]; enter = [ "return" ]; semicolon = [ ";" ]; - lwin = [ "win" "left_win" "meta" "lmeta" "left_meta" "super" "lsuper" "left_super" ]; - rwin = [ "right_win" "rmeta" "right_meta" "rsuper" "right_super" ]; + lwin = [ + "win" + "left_win" + "meta" + "lmeta" + "left_meta" + "super" + "lsuper" + "left_super" + ]; + rwin = [ + "right_win" + "rmeta" + "right_meta" + "rsuper" + "right_super" + ]; apps = [ "menu" ]; - numlock = [ "num_lock" "number_lock" ]; - scrolllock = [ "scroll_lock" "scrlk" ]; + numlock = [ + "num_lock" + "number_lock" + ]; + scrolllock = [ + "scroll_lock" + "scrlk" + ]; uparrow = [ "up" ]; - downarrow = [ "dn" "down" ]; - leftarrow = [ "le" "left" ]; - rightarrow = [ "ri" "right" ]; + downarrow = [ + "dn" + "down" + ]; + leftarrow = [ + "le" + "left" + ]; + rightarrow = [ + "ri" + "right" + ]; ins = [ "insert" ]; del = [ "delete" ]; - pgdn = [ "pagedown" "page_down" ]; - pgup = [ "pageup" "page_up" ]; - pause = [ "pausebreak" "pause_break" "break" ]; + pgdn = [ + "pagedown" + "page_down" + ]; + pgup = [ + "pageup" + "page_up" + ]; + pause = [ + "pausebreak" + "pause_break" + "break" + ]; kp_end = [ "kp1" ]; kp_downarrow = [ "kp2" ]; kp_pgdn = [ "kp3" ]; @@ -65,139 +117,310 @@ let kp_uparrow = [ "kp8" ]; kp_pgup = [ "kp9" ]; kp_enter = [ "kpent" ]; - kp_ins = [ "kp0" "kp_insert" ]; - kp_del = [ "kp." "kp_dot" "kpdot" "kp_decimal" "kpdecimal" "kp_point" "kppoint" ]; - 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 = []; + kp_ins = [ + "kp0" + "kp_insert" + ]; + kp_del = [ + "kp." + "kp_dot" + "kpdot" + "kp_decimal" + "kpdecimal" + "kp_point" + "kppoint" + ]; + 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 - joy1 = [ "a_button" "xbox_a" "playstation_x" "playstation_cross" ]; - joy2 = [ "b_button" "xbox_b" "playstation_o" "playstation_circle" ]; - joy3 = [ "x_button" "xbox_x" "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" ]; + joy1 = [ + "a_button" + "xbox_a" + "playstation_x" + "playstation_cross" + ]; + joy2 = [ + "b_button" + "xbox_b" + "playstation_o" + "playstation_circle" + ]; + joy3 = [ + "x_button" + "xbox_x" + "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 - "`" = [ "tilde" "~" "accent" "grave" "backtick" ]; - "-" = [ "minus" "dash" ]; - "=" = [ "plus" "equals" ]; - "[" = [ "left_bracket" "le_bracket" ]; - "]" = [ "right_bracket" "ri_bracket" ]; - "\\" = [ "backslash" "back_slash" ]; + "`" = [ + "tilde" + "~" + "accent" + "grave" + "backtick" + ]; + "-" = [ + "minus" + "dash" + ]; + "=" = [ + "plus" + "equals" + ]; + "[" = [ + "left_bracket" + "le_bracket" + ]; + "]" = [ + "right_bracket" + "ri_bracket" + ]; + "\\" = [ + "backslash" + "back_slash" + ]; # semicolon is above - "'" = [ "quote" "tick" "single_quote" ]; + "'" = [ + "quote" + "tick" + "single_quote" + ]; "," = [ "comma" ]; - "." = [ "dot" "period" ]; - "/" = [ "slash" "forwardslash" "forward_slash" ]; - }; - 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 + "." = [ + "dot" + "period" + ]; + "/" = [ + "slash" + "forwardslash" + "forward_slash" ]; }; + 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 { options.tf2 = { @@ -205,45 +428,53 @@ in default = tf2Pkgs; readOnly = true; }; - binds = { - clear = mkOption { - type = types.bool; - default = true; - description = "Whether to run unbindall at the beginning of autoexec"; - }; - default = mkOption { - type = types.submodule bindsModule; - default = {}; - }; - } // mkAttrsOfClasses (classname: mkOption { - type = types.submodule bindsModule; - default = {}; - }); + binds = + { + clear = mkOption { + type = types.bool; + default = true; + description = "Whether to run unbindall at the beginning of autoexec"; + }; + default = mkOption { + type = types.submodule bindsModule; + default = { }; + }; + } + // mkAttrsOfClasses ( + classname: + mkOption { + type = types.submodule bindsModule; + default = { }; + } + ); autoexecLines = mkOption { type = types.lines; default = ""; }; - classLines = mkAttrsOfClasses (classname: mkOption { - type = types.lines; - default = ""; - }); + classLines = mkAttrsOfClasses ( + classname: + mkOption { + type = types.lines; + default = ""; + } + ); build.autoexec = vaculib.mkOutOption (pkgs.writeFile "autoexec.cfg" cfg.autoexecLines); - build.classes = vaculib.mkOutOption (mkAttrsOfClasses (classname: - pkgs.writeText "${classname}.cfg" cfg.classLines.${classname} - )); + build.classes = vaculib.mkOutOption ( + mkAttrsOfClasses (classname: pkgs.writeText "${classname}.cfg" cfg.classLines.${classname}) + ); }; config.tf2 = { - autoexecLines = lib.mkMerge ([ - '' - // START keybinds from config.tf2.binds.default - ${cfg.binds.default._out} - // END keybinds from config.tf2.binds.default - '' - ] + autoexecLines = lib.mkMerge ( + [ + '' + // START 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'') - ) - ; + ); classLines = mkAttrsOfClasses (classname: '' // START keybinds from config.tf2.binds.${classname} ${cfg.binds.${classname}._out} diff --git a/nixvim/default.nix b/nixvim/default.nix index 8abf5f4..23154d3 100644 --- a/nixvim/default.nix +++ b/nixvim/default.nix @@ -38,6 +38,6 @@ 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; } diff --git a/packages/ensure-secrets/ensure-secrets.bash b/packages/ensure-secrets/ensure-secrets.bash index 958da8c..db2c738 100644 --- a/packages/ensure-secrets/ensure-secrets.bash +++ b/packages/ensure-secrets/ensure-secrets.bash @@ -25,16 +25,16 @@ for configName in "${configs[@]}"; do format="$(jq '.format' -r <<<"$thisSecretInfo")" sopsFile="$(jq '.sopsFile' -r <<<"$thisSecretInfo")" case "$format" in - yaml|json|binary) - # we know how to deal with this - : - ;; - *) - svl_throw "dunno what to do with format $format for $thisSecretNixPath" - ;; + yaml | json | binary) + # we know how to deal with this + : + ;; + *) + svl_throw "dunno what to do with format $format for $thisSecretNixPath" + ;; esac declare key - if [[ "$format" == binary ]]; then + if [[ $format == binary ]]; then key="" else key="$(jq '.key' -r <<<"$thisSecretInfo")" @@ -50,7 +50,7 @@ for configName in "${configs[@]}"; do exitCode=1 continue fi - if [[ "$format" != binary ]]; then + if [[ $format != binary ]]; then # now try to read the specific key we're interested in if ! "${sopsCmd[@]}" --extract "[\"$key\"]" -- "$sopsFile" >/dev/null; then svl_err "${thisSecretNixPath}: sops file $sopsFile does not contain key $key" diff --git a/packages/ensure-secrets/package.nix b/packages/ensure-secrets/package.nix index d47a87e..d2f02f7 100644 --- a/packages/ensure-secrets/package.nix +++ b/packages/ensure-secrets/package.nix @@ -1,4 +1 @@ -{ - writers, -}: -writers.writeBashBin "ensure-secrets" { } (builtins.readFile ./ensure-secrets.bash) +{ writers }: writers.writeBashBin "ensure-secrets" { } (builtins.readFile ./ensure-secrets.bash) diff --git a/prophecy/hath.nix b/prophecy/hath.nix index 1e0c884..7d8d009 100644 --- a/prophecy/hath.nix +++ b/prophecy/hath.nix @@ -1,8 +1,4 @@ -{ - vacuModules, - config, - ... -}: +{ vacuModules, config, ... }: let port = 62622; in diff --git a/prophecy/propdata.nix b/prophecy/propdata.nix index 7b17972..3ba0ff8 100644 --- a/prophecy/propdata.nix +++ b/prophecy/propdata.nix @@ -11,22 +11,33 @@ let g = m * 1000; t = g * 1000; ki = 1024; - safe_size = size: + safe_size = + size: lib.pipe size [ (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 - (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 slabsMin = { - slabA = { idx = 0; sizeT = 8; }; - slabB = { idx = 1; sizeT = 2; }; - slabC = { idx = 2; sizeT = 4; }; + slabA = { + idx = 0; + sizeT = 8; + }; + slabB = { + idx = 1; + sizeT = 2; + }; + slabC = { + idx = 2; + sizeT = 4; + }; }; - slabs = lib.mapAttrs (name: value: - value // rec { + slabs = lib.mapAttrs ( + name: value: + value + // rec { inherit name; sizeBytes = safe_size (value.sizeT * t); sizeKi = sizeBytes / ki; @@ -89,70 +100,68 @@ let poolname = "propdata"; diskName = groupName: id: "${groupName}_${lib.last (lib.splitString "_" id)}"; - mk_configs = { groupName, diskIds, partitions }: - builtins.listToAttrs (map (id: { - name = diskName groupName id; - value = { - type = "disk"; - device = path_prefix + id; - content = { - type = "gpt"; - inherit partitions; + mk_configs = + { + groupName, + diskIds, + partitions, + }: + builtins.listToAttrs ( + map (id: { + name = diskName groupName id; + value = { + type = "disk"; + device = path_prefix + id; + content = { + type = "gpt"; + inherit partitions; + }; }; - }; - }) diskIds) - ; + }) diskIds + ); groupAttrs = { es14a = { groupName = "es14a"; diskIds = easystores_14_active; - partitions = { - inherit (slabParts) slabA slabB slabC; - }; + partitions = { inherit (slabParts) slabA slabB slabC; }; }; es14s = { groupName = "es14s"; diskIds = easystores_14_spare; - partitions = { - inherit (slabParts) slabA slabB slabC; - }; + partitions = { inherit (slabParts) slabA slabB slabC; }; }; es10 = { groupName = "es10"; diskIds = easystores_10; - partitions = { - inherit (slabParts) slabA slabB; - }; + partitions = { inherit (slabParts) slabA slabB; }; }; sg8 = { groupName = "sg8"; diskIds = seagates; - partitions = { - inherit (slabParts) slabA; - }; + partitions = { 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 { imports = [ inputs.disko.nixosModules.default ]; options.vacu.prophecy = lib.mapAttrs (_: vaculib.mkOutOption) { - inherit - easystores_10 - easystores_14 - seagates - ; + inherit easystores_10 easystores_14 seagates; }; config.disko = { enableConfig = false; checkScripts = true; rootMountPoint = "/"; - devices.disk = {} + devices.disk = + { } // mk_configs groupAttrs.es14a // mk_configs groupAttrs.es14s // mk_configs groupAttrs.es10 - // mk_configs groupAttrs.sg8 - ; + // mk_configs groupAttrs.sg8; devices.zpool."${poolname}" = { type = "zpool"; options = { @@ -180,12 +189,19 @@ in # slabA { mode = "raidz3"; - members = lib.concatMap (a: partNames a "slabA") [ "sg8" "es10" "es14a" ]; + members = lib.concatMap (a: partNames a "slabA") [ + "sg8" + "es10" + "es14a" + ]; } # slabB { mode = "raidz3"; - members = lib.concatMap (a: partNames a "slabB") [ "es10" "es14a" ]; + members = lib.concatMap (a: partNames a "slabB") [ + "es10" + "es14a" + ]; } # slabC { diff --git a/prophecy/silence.nix b/prophecy/silence.nix index 8409c4d..74c12b1 100644 --- a/prophecy/silence.nix +++ b/prophecy/silence.nix @@ -1,7 +1,4 @@ -{ - pkgs, - ... -}: +{ pkgs, ... }: let serialNode = "/dev/ttyUSB0"; in diff --git a/tf2/default.nix b/tf2/default.nix index 36868ce..13c7e70 100644 --- a/tf2/default.nix +++ b/tf2/default.nix @@ -1,7 +1,4 @@ -{ - vacuModules, - ... -}: +{ vacuModules, ... }: { imports = [ vacuModules.tf2 ]; diff --git a/tf2/notes.md b/tf2/notes.md index 7b96dc5..09182e1 100644 --- a/tf2/notes.md +++ b/tf2/notes.md @@ -80,5 +80,3 @@ "MWHEELUP" = "invprev" "MWHEELDOWN" = "invnext" ``` - - diff --git a/triple-dezert/default.nix b/triple-dezert/default.nix index 89af929..1dec965 100644 --- a/triple-dezert/default.nix +++ b/triple-dezert/default.nix @@ -86,9 +86,9 @@ boot.kernelPackages = pkgs.linuxPackages_6_12; # zfs can break with hibernate but takes no steps to warn/prevent this >:( - boot.kernelParams = [ + boot.kernelParams = [ "nohibernate" - "panic=10" #on panic, reboot after 10s + "panic=10" # on panic, reboot after 10s ]; boot.supportedFilesystems = [ "zfs" # needed to mount trip zfs pool