From 897e6c5c155d035a25ab748efc64c0bbefa30f48 Mon Sep 17 00:00:00 2001 From: LarsZauberer Date: Wed, 17 Apr 2024 23:10:24 +0200 Subject: [PATCH] Minecraft wayland patch try --- hosts/lars/kronos/programs.nix | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/hosts/lars/kronos/programs.nix b/hosts/lars/kronos/programs.nix index 631e805..8877ef2 100644 --- a/hosts/lars/kronos/programs.nix +++ b/hosts/lars/kronos/programs.nix @@ -1,6 +1,30 @@ -{ config, inputs, pkgs, ... }: +{ config, inputs, pkgs, lib, ... }: let username = config.modules.other.system.username; + + # Fetch the GLFW with Wayland patches for Minecraft + customGLFW = let + mcWaylandPatchRepo = pkgs.fetchFromGitHub { + owner = "Admicos"; + repo = "minecraft-wayland"; + rev = "370ce5b95e3ae9bc4618fb45113bc641fbb13867"; + sha256 = "sha256-RPRg6Gd7N8yyb305V607NTC1kUzvyKiWsh6QlfHW+JE="; + }; + mcWaylandPatches = map (name: "${mcWaylandPatchRepo}/${name}") + (lib.naturalSort (builtins.attrNames (lib.filterAttrs + (name: type: + type == "regular" && lib.hasSuffix ".patch" name) + (builtins.readDir mcWaylandPatchRepo)))); + in pkgs.glfw.overrideAttrs (previousAttrs: { + patches = previousAttrs.patches ++ mcWaylandPatches; + buildInputs = previousAttrs.buildInputs ++ [ pkgs.wayland ]; + }); + + # Minecraft launcher with the custom GLFW + minecraftPrismLauncher = pkgs.prismlauncher.override { + glfw = customGLFW; + }; + in { home-manager.users.${username} = { home.packages = let @@ -9,4 +33,9 @@ in { in with pkgs; [ ]; }; + + # System-wide installation of Minecraft PrismLauncher + environment.systemPackages = [ + minecraftPrismLauncher + ]; }