#./apps/lightforge.nix { pkgs, lib, config, ... }: let lightforge-unwrapped = pkgs.rustPlatform.buildRustPackage (finalAttrs: { pname = "lightforge-unwrapped"; version = "1.0.0-beta.8"; src = pkgs.fetchFromGitHub { owner = "LightforgeProject"; repo = "lightforge"; tag = "v${finalAttrs.version}"; hash = "sha256-iVuHYDtMPi0kaV5hK0wsCOYaBMWbqikPbOTw6M/AbfM="; }; cargoHash = "sha256-mqePVSoavA34Q7XbPqFXbc71z+85mvCTN4J6dfPUTR0="; # Its updater sees a Nix store path as "unknown" and offers the curl # installer; this makes it say "Nix updates this" instead. patches = [ ../patches/lightforge-nix-origin.patch ]; # These write under a fixed /games and watch stand-in processes; the # build sandbox allows neither. checkFlags = map (t: "--skip=preflight::tests::${t}") [ "a_pass_beside_the_client_leaves_it_running_and_touches_nothing" "a_game_served_by_another_build_refuses_a_launch_beside_it" "a_second_launch_goes_beside_a_running_game" "quitting_the_client_beside_a_game_leaves_the_game_running" ]; nativeBuildInputs = [ pkgs.pkg-config ]; buildInputs = with pkgs; [ udev fontconfig ]; postInstall = '' install -Dm644 packaging/pro.tuxcore.Lightforge.desktop -t $out/share/applications install -Dm644 packaging/pro.tuxcore.Lightforge.metainfo.xml -t $out/share/metainfo cp -r packaging/icons $out/share/icons ''; meta = { description = "Native Linux launcher for World of Warcraft and Battle.net"; homepage = "https://github.com/LightforgeProject/lightforge"; license = lib.licenses.gpl3Plus; mainProgram = "lightforge-gui"; platforms = [ "x86_64-linux" ]; }; }); # Lightforge downloads its own GE-Proton and runs it outside Steam's # runtime, so Proton's Wine needs a regular FHS with a 32-bit side # (Battle.net is 32-bit). Steam's env plus the WINE libraries Lutris lists. fhs = pname: runScript: extraInstallCommands: pkgs.steam.buildRuntimeEnv { inherit pname runScript extraInstallCommands; inherit (lightforge-unwrapped) version meta; extraPkgs = p: [ lightforge-unwrapped p.mangohud ]; extraLibraries = p: with p; [ fontconfig freetype gnutls p11-kit libkrb5 libgcrypt libunwind libpulseaudio alsa-lib dbus SDL2 libusb1 libxkbcommon wayland libx11 libxext libxrandr libxrender libxi libxcursor libxcomposite libxfixes libxinerama libxxf86vm libxcb gst_all_1.gstreamer gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good ]; privateTmp = false; }; in { config = lib.mkIf (config.networking.hostName == "FredOS-Gaming") { environment.systemPackages = [ (fhs "lightforge-gui" "lightforge-gui" '' mkdir -p $out/share ln -s ${lightforge-unwrapped}/share/applications $out/share ln -s ${lightforge-unwrapped}/share/icons $out/share '') # The CLI: `lightforge doctor`, `lightforge status`, … (fhs "lightforge" "lightforge" "") ]; }; }