forked from foxora/nix
minecraft speedrunning stuff
This commit is contained in:
parent
7f11df87df
commit
01912eb428
7 changed files with 401 additions and 2 deletions
43
flake.lock
generated
43
flake.lock
generated
|
|
@ -386,6 +386,27 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-parts_4": {
|
"flake-parts_4": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": [
|
||||||
|
"mcsr",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1772408722,
|
||||||
|
"narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-parts_5": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": "nixpkgs-lib_3"
|
"nixpkgs-lib": "nixpkgs-lib_3"
|
||||||
},
|
},
|
||||||
|
|
@ -996,6 +1017,25 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mcsr": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-parts": "flake-parts_4",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs-unstable"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1777411535,
|
||||||
|
"narHash": "sha256-6oMlfP8QdXadFVzSOdh8TOxHbZi64r4/j0k19fVj8mw=",
|
||||||
|
"rev": "cf54c03940bb73853cad234d04ffc0ac96a1b441",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://git.uku3lig.net/api/v1/repos/uku/mcsr-nixos/archive/cf54c03940bb73853cad234d04ffc0ac96a1b441.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://git.uku3lig.net/uku/mcsr-nixos/archive/main.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
"microvm": {
|
"microvm": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
|
@ -1211,7 +1251,7 @@
|
||||||
"nixcord": {
|
"nixcord": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat_5",
|
"flake-compat": "flake-compat_5",
|
||||||
"flake-parts": "flake-parts_4",
|
"flake-parts": "flake-parts_5",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
|
|
@ -1458,6 +1498,7 @@
|
||||||
"hyprland-git": "hyprland-git",
|
"hyprland-git": "hyprland-git",
|
||||||
"iamb": "iamb",
|
"iamb": "iamb",
|
||||||
"mango": "mango",
|
"mango": "mango",
|
||||||
|
"mcsr": "mcsr",
|
||||||
"microvm": "microvm_2",
|
"microvm": "microvm_2",
|
||||||
"millennium": "millennium",
|
"millennium": "millennium",
|
||||||
"nixcats": "nixcats",
|
"nixcats": "nixcats",
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,11 @@
|
||||||
url = "github:uiriansan/SilentSDDM";
|
url = "github:uiriansan/SilentSDDM";
|
||||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mcsr = {
|
||||||
|
url = "https://git.uku3lig.net/uku/mcsr-nixos/archive/main.tar.gz";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@
|
||||||
|
|
||||||
# games
|
# games
|
||||||
r2modman # mod manager for lots of games!!
|
r2modman # mod manager for lots of games!!
|
||||||
prismlauncher # minecraft launcher
|
# prismlauncher # minecraft launcher
|
||||||
# bottles # wineprefix manager
|
# bottles # wineprefix manager
|
||||||
|
|
||||||
# vr
|
# vr
|
||||||
|
|
|
||||||
88
hosts/modules/programs/mcsr/default.nix
Normal file
88
hosts/modules/programs/mcsr/default.nix
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
upkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.programs.waywall;
|
||||||
|
|
||||||
|
mcsrPkgs = inputs.mcsr.packages.${pkgs.stdenv.hostPlatform.system};
|
||||||
|
# thin = pkgs.fetchurl {
|
||||||
|
# url = "https://v.uku.moe/u/thin.png";
|
||||||
|
# hash = "sha256-VzT9a0/+JMG+To80+xuQSo4x2w6+zavCvUJ6irBkpVg=";
|
||||||
|
# };
|
||||||
|
# wide = pkgs.fetchurl {
|
||||||
|
# url = "https://v.uku.moe/u/wide.png";
|
||||||
|
# hash = "sha256-xJX+QladHQiQYBdKZEB9kuEaxBWVZuuStf4r4gIv5uo=";
|
||||||
|
# };
|
||||||
|
# tall = pkgs.fetchurl {
|
||||||
|
# url = "https://v.uku.moe/u/tall.png";
|
||||||
|
# hash = "sha256-RLyV6iFVDlJKKEdA3CBAQR/sIj2WnhZVBAmLzVmS7JA=";
|
||||||
|
# };
|
||||||
|
in {
|
||||||
|
imports = [inputs.mcsr.nixosModules.waywall];
|
||||||
|
|
||||||
|
options = {
|
||||||
|
programs.waywall = {
|
||||||
|
width = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = 1920;
|
||||||
|
};
|
||||||
|
|
||||||
|
height = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = 1080;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(final: prev: {
|
||||||
|
prismlauncher = prev.prismlauncher.override {
|
||||||
|
jdks = [
|
||||||
|
mcsrPkgs.graalvm-21
|
||||||
|
upkgs.openjdk8
|
||||||
|
];
|
||||||
|
|
||||||
|
additionalLibs = with pkgs; [
|
||||||
|
libx11
|
||||||
|
libxt
|
||||||
|
libxtst
|
||||||
|
libxcb
|
||||||
|
libxkbcommon
|
||||||
|
libxinerama
|
||||||
|
];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
prismlauncher
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.waywall = {
|
||||||
|
enable = true;
|
||||||
|
config = {
|
||||||
|
enableWaywork = true;
|
||||||
|
programs = [mcsrPkgs.ninjabrain-bot];
|
||||||
|
|
||||||
|
files = {
|
||||||
|
eye_overlay = ./eye-overlay-trans.png;
|
||||||
|
# inherit thin wide tall;
|
||||||
|
};
|
||||||
|
|
||||||
|
text =
|
||||||
|
''
|
||||||
|
local resolution = { w = ${toString cfg.width}, h = ${toString cfg.height} }
|
||||||
|
-- end globals
|
||||||
|
''
|
||||||
|
+ (builtins.readFile ./waywall.lua);
|
||||||
|
|
||||||
|
# linkWithSystemd = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
BIN
hosts/modules/programs/mcsr/eye-overlay-trans.png
Normal file
BIN
hosts/modules/programs/mcsr/eye-overlay-trans.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
263
hosts/modules/programs/mcsr/waywall.lua
Normal file
263
hosts/modules/programs/mcsr/waywall.lua
Normal file
|
|
@ -0,0 +1,263 @@
|
||||||
|
-- vim: foldmethod=marker
|
||||||
|
local waywall = require("waywall")
|
||||||
|
local helpers = require("waywall.helpers")
|
||||||
|
|
||||||
|
local Scene = require("waywork.scene")
|
||||||
|
local Modes = require("waywork.modes")
|
||||||
|
local Keys = require("waywork.keys")
|
||||||
|
local Processes = require("waywork.processes")
|
||||||
|
|
||||||
|
local scene = Scene.SceneManager.new(waywall)
|
||||||
|
local ModeManager = Modes.ModeManager.new(waywall)
|
||||||
|
|
||||||
|
-- config --
|
||||||
|
-- https://arjuncgore.github.io/waywall-boat-eye-calc/
|
||||||
|
local normal_sens = 12.8000006
|
||||||
|
local tall_sens = 0.86348038
|
||||||
|
|
||||||
|
local pie_colors = {
|
||||||
|
{ input = "#e145c2", output = "#a000a0" },
|
||||||
|
{ input = "#e96d4d", output = "#aa3310" },
|
||||||
|
{ input = "#45cb65", output = "#00a000" },
|
||||||
|
{ input = "#4de1ca", output = "#1a7286" },
|
||||||
|
{ input = "#c46de1", output = "#ff55ff" },
|
||||||
|
}
|
||||||
|
-- config --
|
||||||
|
|
||||||
|
-- utils {{{
|
||||||
|
_G["WAYWORK_GLOBAL_GUARD"] = false
|
||||||
|
|
||||||
|
local function toggle_global_guard()
|
||||||
|
_G["WAYWORK_GLOBAL_GUARD"] = not _G["WAYWORK_GLOBAL_GUARD"]
|
||||||
|
return _G["WAYWORK_GLOBAL_GUARD"]
|
||||||
|
end
|
||||||
|
|
||||||
|
local function mode_guard()
|
||||||
|
return not _G["WAYWORK_GLOBAL_GUARD"] and not waywall.get_key("F3")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function smart_enable_group(mode, status)
|
||||||
|
scene:enable_group(mode, status)
|
||||||
|
scene:enable_group("normal", not status)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function piechart_src(res)
|
||||||
|
return { x = res.w - 93, y = res.h - 221, w = 33, h = 42 }
|
||||||
|
end
|
||||||
|
|
||||||
|
local function piechart_dst(res)
|
||||||
|
---@diagnostic disable: undefined-global
|
||||||
|
-- x = right_of_thin - 11 (gap between edge and pie) - 160 (pie width / 2) - 99 (mirror width / 2)
|
||||||
|
if res.w == resolution.w and res.h == resolution.h then
|
||||||
|
return { x = res.w - 270, y = res.h - 390, w = 33 * 6, h = 42 * 6 }
|
||||||
|
else
|
||||||
|
return { x = (resolution.w + res.w) / 2 - 270, y = (resolution.h + res.h) / 2 - 390, w = 33 * 6, h = 42 * 6 }
|
||||||
|
end
|
||||||
|
---@diagnostic enable: undefined-global
|
||||||
|
end
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: undefined-global
|
||||||
|
local ensure_ninjabrain = Processes.ensure_application(waywall, programs.ninjabrain_bot)("ninjabrain.*\\.jar")
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- background images {{{
|
||||||
|
-- for _, name in ipairs({ "wide", "thin", "tall" }) do
|
||||||
|
-- scene:register(name .. "_bg", {
|
||||||
|
-- kind = "image",
|
||||||
|
-- ---@diagnostic disable-next-line: undefined-global
|
||||||
|
-- path = files[name],
|
||||||
|
-- options = {
|
||||||
|
|
||||||
|
-- ---@diagnostic disable: undefined-global
|
||||||
|
-- dst = { x = 0, y = 0, w = resolution.w, h = resolution.h },
|
||||||
|
-- ---@diagnostic enable: undefined-global
|
||||||
|
|
||||||
|
-- depth = -1,
|
||||||
|
-- },
|
||||||
|
-- groups = { name },
|
||||||
|
-- })
|
||||||
|
-- end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- thin {{{
|
||||||
|
---@diagnostic disable: undefined-global
|
||||||
|
local thin_res = { w = resolution.h * 0.28, h = resolution.h }
|
||||||
|
local e_scale = resolution.w > 2560 and 20 or 10
|
||||||
|
local left_middle = (resolution.w - thin_res.w) / 4
|
||||||
|
---@diagnostic enable: undefined-global
|
||||||
|
|
||||||
|
scene:register("e_counter", {
|
||||||
|
kind = "mirror",
|
||||||
|
options = {
|
||||||
|
src = { x = 1, y = 37, w = 49, h = 9 },
|
||||||
|
---@diagnostic disable-next-line: undefined-global
|
||||||
|
dst = { x = left_middle - (49 * e_scale / 2), y = resolution.h / 10.8, w = 49 * e_scale, h = 9 * e_scale },
|
||||||
|
depth = 0,
|
||||||
|
},
|
||||||
|
groups = { "thin" },
|
||||||
|
})
|
||||||
|
|
||||||
|
for _, ck in ipairs(pie_colors) do
|
||||||
|
scene:register("prct_mirror_" .. ck.input, {
|
||||||
|
kind = "mirror",
|
||||||
|
options = {
|
||||||
|
src = piechart_src(thin_res),
|
||||||
|
dst = piechart_dst(thin_res),
|
||||||
|
depth = 1,
|
||||||
|
color_key = ck,
|
||||||
|
},
|
||||||
|
groups = { "thin" },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
ModeManager:define("thin", {
|
||||||
|
width = thin_res.w,
|
||||||
|
height = thin_res.h,
|
||||||
|
on_enter = function()
|
||||||
|
smart_enable_group("thin", true)
|
||||||
|
end,
|
||||||
|
on_exit = function()
|
||||||
|
smart_enable_group("thin", false)
|
||||||
|
end,
|
||||||
|
toggle_guard = mode_guard,
|
||||||
|
})
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- wide {{{
|
||||||
|
---@diagnostic disable: undefined-global
|
||||||
|
local wide_res = { w = resolution.w, h = resolution.h / 3.6 }
|
||||||
|
---@diagnostic enable: undefined-global
|
||||||
|
|
||||||
|
ModeManager:define("wide", {
|
||||||
|
width = wide_res.w,
|
||||||
|
height = wide_res.h,
|
||||||
|
on_enter = function()
|
||||||
|
smart_enable_group("wide", true)
|
||||||
|
end,
|
||||||
|
on_exit = function()
|
||||||
|
smart_enable_group("wide", false)
|
||||||
|
end,
|
||||||
|
toggle_guard = mode_guard,
|
||||||
|
})
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- tall {{{
|
||||||
|
---@diagnostic disable: undefined-global
|
||||||
|
local tall_res = { w = 384, h = 16384 }
|
||||||
|
local measure_w = (resolution.w - tall_res.w) / 2
|
||||||
|
local measure_h = (resolution.h * measure_w) / resolution.w
|
||||||
|
local measure_dst = { x = 0, y = (resolution.h - measure_h) / 2, w = measure_w, h = measure_h }
|
||||||
|
---@diagnostic enable: undefined-global
|
||||||
|
|
||||||
|
scene:register("eye_measure", {
|
||||||
|
kind = "mirror",
|
||||||
|
options = {
|
||||||
|
src = { x = (tall_res.w - 60) / 2, y = (tall_res.h - 580) / 2, w = 60, h = 580 },
|
||||||
|
dst = measure_dst,
|
||||||
|
depth = 0,
|
||||||
|
},
|
||||||
|
groups = { "tall" },
|
||||||
|
})
|
||||||
|
|
||||||
|
scene:register("eye_overlay", {
|
||||||
|
kind = "image",
|
||||||
|
---@diagnostic disable-next-line: undefined-global
|
||||||
|
path = files.eye_overlay,
|
||||||
|
options = { dst = measure_dst, depth = 1 },
|
||||||
|
groups = { "tall" },
|
||||||
|
})
|
||||||
|
|
||||||
|
ModeManager:define("tall", {
|
||||||
|
width = tall_res.w,
|
||||||
|
height = tall_res.h,
|
||||||
|
on_enter = function()
|
||||||
|
smart_enable_group("tall", true)
|
||||||
|
waywall.set_sensitivity(tall_sens)
|
||||||
|
end,
|
||||||
|
on_exit = function()
|
||||||
|
smart_enable_group("tall", false)
|
||||||
|
waywall.set_sensitivity(0)
|
||||||
|
end,
|
||||||
|
toggle_guard = mode_guard,
|
||||||
|
})
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- normal res mirrors {{{
|
||||||
|
for _, ck in ipairs(pie_colors) do
|
||||||
|
scene:register("prct_mirror_normal_" .. ck.input, {
|
||||||
|
kind = "mirror",
|
||||||
|
options = {
|
||||||
|
---@diagnostic disable: undefined-global
|
||||||
|
src = piechart_src(resolution),
|
||||||
|
dst = piechart_dst(resolution),
|
||||||
|
---@diagnostic enable: undefined-global
|
||||||
|
depth = 1,
|
||||||
|
color_key = ck,
|
||||||
|
},
|
||||||
|
groups = { "normal" },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- startup actions
|
||||||
|
waywall.listen("load", function()
|
||||||
|
-- wait for title screen
|
||||||
|
repeat
|
||||||
|
local error, state = pcall(waywall.state)
|
||||||
|
waywall.sleep(1000)
|
||||||
|
until error == true and state.screen == "title"
|
||||||
|
|
||||||
|
-- actual actions
|
||||||
|
ensure_ninjabrain()
|
||||||
|
scene:enable_group("normal", true)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local config = {
|
||||||
|
input = {
|
||||||
|
layout = "us",
|
||||||
|
repeat_rate = 40,
|
||||||
|
repeat_delay = 300,
|
||||||
|
|
||||||
|
sensitivity = normal_sens,
|
||||||
|
confine_pointer = true,
|
||||||
|
|
||||||
|
remaps = {
|
||||||
|
["MB4"] = "F5",
|
||||||
|
["MB5"] = "F3",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
theme = {
|
||||||
|
background = "#00000000",
|
||||||
|
-- https://github.com/Smithay/smithay/issues/1894
|
||||||
|
ninb_anchor = "right",
|
||||||
|
},
|
||||||
|
|
||||||
|
---@diagnostic disable: undefined-global
|
||||||
|
window = {
|
||||||
|
fullscreen_width = resolution.w,
|
||||||
|
fullscreen_height = resolution.h,
|
||||||
|
},
|
||||||
|
---@diagnostic enable: undefined-global
|
||||||
|
|
||||||
|
actions = Keys.actions({
|
||||||
|
["*-F2"] = function()
|
||||||
|
toggle_global_guard()
|
||||||
|
end,
|
||||||
|
["*-V"] = function()
|
||||||
|
return ModeManager:toggle("thin")
|
||||||
|
end,
|
||||||
|
["*-B"] = function()
|
||||||
|
return ModeManager:toggle("tall")
|
||||||
|
end,
|
||||||
|
["*-G"] = function()
|
||||||
|
return ModeManager:toggle("wide")
|
||||||
|
end,
|
||||||
|
["Ctrl-Shift-L"] = function()
|
||||||
|
ensure_ninjabrain()
|
||||||
|
helpers.toggle_floating()
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
|
||||||
./modules/amdgpu-ignore-ctx-privileges.nix
|
./modules/amdgpu-ignore-ctx-privileges.nix
|
||||||
|
|
||||||
|
../modules/programs/mcsr
|
||||||
];
|
];
|
||||||
|
|
||||||
# Use the systemd-boot EFI boot loader.
|
# Use the systemd-boot EFI boot loader.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue