stuff
This commit is contained in:
@@ -225,6 +225,7 @@
|
||||
inp = [
|
||||
"nixos-hardware"
|
||||
"sops-nix"
|
||||
"tf2-nix"
|
||||
];
|
||||
};
|
||||
legtop = mkNixosConfig {
|
||||
|
@@ -1,7 +1,13 @@
|
||||
{ inputs, pkgs, ... }:
|
||||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
vacuModules,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
inputs.nixos-hardware.nixosModules.framework-16-7040-amd
|
||||
../tf2
|
||||
./apex.nix
|
||||
./android.nix
|
||||
./thunderbolt.nix
|
||||
|
@@ -2,10 +2,13 @@
|
||||
inputs,
|
||||
pkgs,
|
||||
lib,
|
||||
vaculib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
cfg = config.tf2;
|
||||
tf2Pkgs = inputs.tf2-nix.lib.mkTf2Pkgs { inherit pkgs; };
|
||||
classes = [
|
||||
"scout"
|
||||
@@ -18,13 +21,252 @@ let
|
||||
"sniper"
|
||||
"spy"
|
||||
];
|
||||
attrsOfClasses = f: builtins.listToAttrs (map (classname:
|
||||
lib.nameValuePair classname (f classname)
|
||||
) classes);
|
||||
# key: what tf2 calls the key
|
||||
# value: other things you might want to call that key
|
||||
keyAliases = {
|
||||
# from https://developer.valvesoftware.com/wiki/Bind#Special_Keys
|
||||
escape = [ "esc" ];
|
||||
capslock = [ "caps_lock" ];
|
||||
shift = [ "lshift" "left_shift" ];
|
||||
rshift = [ "right_shfit" ];
|
||||
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" ];
|
||||
apps = [ "menu" ];
|
||||
numlock = [ "num_lock" "number_lock" ];
|
||||
scrolllock = [ "scroll_lock" "scrlk" ];
|
||||
uparrow = [ "up" ];
|
||||
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" ];
|
||||
kp_end = [ "kp1" ];
|
||||
kp_downarrow = [ "kp2" ];
|
||||
kp_pgdn = [ "kp3" ];
|
||||
kp_leftarrow = [ "kp4" ];
|
||||
kp_5 = [ "kp5" ];
|
||||
kp_rightarrow = [ "kp6" ];
|
||||
kp_home = [ "kp7" ];
|
||||
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 = [];
|
||||
#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" ];
|
||||
|
||||
# keys named by their character
|
||||
"`" = [ "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" ];
|
||||
"," = [ "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 = (lib.pipe keys [
|
||||
(map (key: lib.nameValuePair key (lib.mkOption {
|
||||
type = types.nullOr bindCommandType;
|
||||
default = null;
|
||||
})))
|
||||
builtins.listToAttrs
|
||||
]) // {
|
||||
_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.tf2Pkgs = mkOption {
|
||||
options.tf2 = {
|
||||
tf2Pkgs = mkOption {
|
||||
default = tf2Pkgs;
|
||||
readOnly = true;
|
||||
};
|
||||
binds = {
|
||||
clear = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
default = mkOption {
|
||||
type = types.submodule bindsModule;
|
||||
default = {};
|
||||
};
|
||||
} // lib.pipe classes [
|
||||
(map (classname:
|
||||
lib.nameValuePair classname (mkOption {
|
||||
type = types.submodule bindsModule;
|
||||
default = cfg.binds.default;
|
||||
})
|
||||
))
|
||||
builtins.listToAttrs
|
||||
];
|
||||
autoexecLines = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
};
|
||||
classLines = lib.pipe classes [
|
||||
(map (classname:
|
||||
lib.nameValuePair classname (mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
})
|
||||
))
|
||||
builtins.listToAttrs
|
||||
];
|
||||
build.autoexec = pkgs.writeFile "autoexec.cfg" cfg.cfg;
|
||||
build.classes = lib.pipe classes [
|
||||
(map (classname:
|
||||
lib.nameValuePair classname (pkgs.writeText "${classname}.cfg" cfg.classLines.${classname})
|
||||
))
|
||||
builtins.listToAttrs
|
||||
];
|
||||
};
|
||||
|
||||
config.tf2 = {
|
||||
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 = lib.pipe classes [
|
||||
(map (classname:
|
||||
lib.nameValuePair classname ''
|
||||
// START keybinds from config.tf2.binds.${classname}
|
||||
${cfg.binds.${classname}._out}
|
||||
// END keybinds from config.tf2.binds.${classname}
|
||||
''
|
||||
))
|
||||
builtins.listToAttrs
|
||||
];
|
||||
};
|
||||
}
|
||||
|
85
tf2/default.nix
Normal file
85
tf2/default.nix
Normal file
@@ -0,0 +1,85 @@
|
||||
{
|
||||
vacuModules,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ vacuModules.tf2 ];
|
||||
|
||||
tf2.binds.clear = true;
|
||||
tf2.binds.default = {
|
||||
"2" = "voicemenu 1 1"; # call spy
|
||||
|
||||
w = "+forward";
|
||||
a = "+moveleft";
|
||||
s = "+back";
|
||||
d = "+moveright";
|
||||
"'" = "+moveup";
|
||||
"/" = "+movedown";
|
||||
space = "+jump";
|
||||
shift = "+duck";
|
||||
alt = "+strafe";
|
||||
|
||||
mouse1 = "+attack";
|
||||
mouse2 = "+attack2";
|
||||
|
||||
q = "slot1";
|
||||
f = "slot2";
|
||||
mouse4 = "slot3";
|
||||
"3" = "slot3";
|
||||
"4" = "slot4";
|
||||
"5" = "slot5";
|
||||
scroll_up = "invprev";
|
||||
scroll_dn = "invnext";
|
||||
|
||||
z = "voice_menu_1";
|
||||
x = "voice_menu_2";
|
||||
c = "voice_menu_3";
|
||||
|
||||
g = "+taunt";
|
||||
h = "reload";
|
||||
j = "cl_trigger_first_notification";
|
||||
k = "kill";
|
||||
l = "explode";
|
||||
";" = "cl_decline_first_notification";
|
||||
tab = "+showscores";
|
||||
esc = "cancelselect";
|
||||
|
||||
m = "open_charinfo_direct";
|
||||
n = "open_charinfo_backpack";
|
||||
o = "dropitem";
|
||||
|
||||
r = "+helpme";
|
||||
v = "+voicerecord";
|
||||
p = "say_party";
|
||||
y = "say_team";
|
||||
t = "say";
|
||||
|
||||
kp0 = "load_itempreset 0";
|
||||
kp1 = "load_itempreset 1";
|
||||
kp2 = "load_itempreset 2";
|
||||
kp3 = "load_itempreset 3";
|
||||
|
||||
"`" = "toggleconsole";
|
||||
"," = "changeclass";
|
||||
"." = "changeteam";
|
||||
|
||||
backslash = "show_matchmaking";
|
||||
f1 = "+showroundinfo";
|
||||
f2 = "show_quest_log";
|
||||
f3 = "askconnect_accept";
|
||||
f5 = "screenshot";
|
||||
f6 = "save_replay";
|
||||
f7 = "abuse_report_queue";
|
||||
f9 = "vr_toggle";
|
||||
f10 = "quit prompt";
|
||||
f11 = "vr_reset_home_pos";
|
||||
f12 = "replay_togglereplaytips";
|
||||
};
|
||||
tf2.binds.engineer = {
|
||||
"4" = "destroy 1 0; build 1 0"; # build teleporter entrance
|
||||
"5" = "destroy 1 1; build 1 1"; # build teleporter exit
|
||||
};
|
||||
tf2.binds.spy = {
|
||||
"-" = "disguiseteam";
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user