From 1a61ae4ac4352ac0a4a62195c4da049465901e87 Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Sun, 3 Nov 2024 21:38:42 +0100 Subject: [PATCH] treewide: add bolt-launcher until it's merged in nixpkgs --- home/programs/games/default.nix | 32 +++--- pkgs/bolt-launcher.nix | 171 ++++++++++++++++++++++++++++++++ pkgs/default.nix | 1 + system/nix/nixpkgs.nix | 4 +- 4 files changed, 194 insertions(+), 14 deletions(-) create mode 100644 pkgs/bolt-launcher.nix diff --git a/home/programs/games/default.nix b/home/programs/games/default.nix index 7835a78..0803c0c 100644 --- a/home/programs/games/default.nix +++ b/home/programs/games/default.nix @@ -1,15 +1,23 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - bottles - lutris - mangohud - path-of-building - protonplus - r2modman +{ + inputs, + pkgs, + ... +}: { + home.packages = [ + pkgs.bottles + pkgs.lutris + pkgs.mangohud + pkgs.path-of-building + pkgs.protonplus + pkgs.r2modman - # steamtinkerlaunch dependencies - xdotool - xorg.xwininfo - yad + pkgs + . # steamtinkerlaunch dependencies + pkgs + .xdotool + pkgs.xorg.xwininfo + pkgs.yad + + inputs.self.packages.${pkgs.system}.bolt-launcher ]; } diff --git a/pkgs/bolt-launcher.nix b/pkgs/bolt-launcher.nix new file mode 100644 index 0000000..63a086b --- /dev/null +++ b/pkgs/bolt-launcher.nix @@ -0,0 +1,171 @@ +{ + lib, + stdenv, + fetchFromGitHub, + makeWrapper, + cmake, + ninja, + libarchive, + libz, + jdk17, + libcef, + luajit, + xorg, + mesa, + glib, + nss, + nspr, + atk, + at-spi2-atk, + libdrm, + expat, + libxkbcommon, + gtk3, + pango, + cairo, + alsa-lib, + dbus, + at-spi2-core, + cups, + systemd, + buildFHSEnv, +}: let + cef = libcef.overrideAttrs (_: { + installPhase = let + gl_rpath = lib.makeLibraryPath [ + stdenv.cc.cc.lib + ]; + rpath = lib.makeLibraryPath [ + glib + nss + nspr + atk + at-spi2-atk + libdrm + expat + xorg.libxcb + libxkbcommon + xorg.libX11 + xorg.libXcomposite + xorg.libXdamage + xorg.libXext + xorg.libXfixes + xorg.libXrandr + mesa + gtk3 + pango + cairo + alsa-lib + dbus + at-spi2-core + cups + xorg.libxshmfence + systemd + ]; + in '' + mkdir -p $out/lib/ $out/share/cef/ + cp libcef_dll_wrapper/libcef_dll_wrapper.a $out/lib/ + cp -r ../Resources/* $out/lib/ + cp -r ../Release/* $out/lib/ + patchelf --set-rpath "${rpath}" $out/lib/libcef.so + patchelf --set-rpath "${gl_rpath}" $out/lib/libEGL.so + patchelf --set-rpath "${gl_rpath}" $out/lib/libGLESv2.so + cp ../Release/*.bin $out/share/cef/ + cp -r ../Resources/* $out/share/cef/ + cp -r ../include $out + cp -r ../libcef_dll $out + cp -r ../cmake $out + ''; + }); + bolt = stdenv.mkDerivation (finalAttrs: { + pname = "bolt-launcher"; + version = "0.9.0"; + + src = fetchFromGitHub { + owner = "AdamCake"; + repo = "bolt"; + rev = finalAttrs.version; + fetchSubmodules = true; + hash = "sha256-LIlRDcUWbQwIhFjtqYF+oVpTOPZ7IT0vMgysEVyJ1k8="; + }; + + nativeBuildInputs = [ + cmake + ninja + luajit + makeWrapper + ]; + + buildInputs = [ + mesa + xorg.libX11 + xorg.libxcb + libarchive + libz + cef + jdk17 + ]; + + cmakeFlags = [ + "-D CMAKE_BUILD_TYPE=Release" + "-D BOLT_LUAJIT_INCLUDE_DIR=${luajit}/include" + "-G Ninja" + ]; + + preConfigure = '' + mkdir -p cef/dist/Release cef/dist/Resources cef/dist/include + + ln -s ${cef}/lib/* cef/dist/Release + + ln -s ${cef}/share/cef/*.pak cef/dist/Resources + ln -s ${cef}/share/cef/icudtl.dat cef/dist/Resources + ln -s ${cef}/share/cef/locales cef/dist/Resources + + ln -s ${cef}/include/* cef/dist/include + ln -s ${cef}/libcef_dll cef/dist/libcef_dll + + ln -s ${cef}/cmake cef/dist/cmake + ln -s ${cef}/CMakeLists.txt cef/dist + ''; + + postFixup = '' + makeWrapper "$out/opt/bolt-launcher/bolt" "$out/bin/${finalAttrs.pname}-${finalAttrs.version}" \ + --set JAVA_HOME "${jdk17}" + ls -al $out/bin + mkdir -p $out/lib + cp $out/usr/local/lib/libbolt-plugin.so $out/lib + ''; + }); +in + buildFHSEnv { + inherit (bolt) name version; + + targetPkgs = pkgs: + [bolt] + ++ (with pkgs; [ + xorg.libSM + xorg.libXxf86vm + xorg.libX11 + glib + pango + cairo + gdk-pixbuf + gtk2-x11 + libz + libcap + libsecret + openssl_1_1 + SDL2 + libGL + ]); + + runScript = "${bolt.name}"; + meta = { + homepage = "https://github.com/Adamcake/Bolt"; + description = "An alternative launcher for RuneScape"; + license = lib.licenses.agpl3Plus; + maintainers = with lib.maintainers; [nezia]; + platforms = lib.platforms.linux; + mainProgram = "${bolt.name}"; + }; + } diff --git a/pkgs/default.nix b/pkgs/default.nix index 452e07d..876d93b 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,3 +1,4 @@ pkgs: { mcuxpresso = import ./mcuxpresso pkgs; + bolt-launcher = pkgs.callPackage ./bolt-launcher.nix {}; } diff --git a/system/nix/nixpkgs.nix b/system/nix/nixpkgs.nix index ccc951d..da6bc52 100644 --- a/system/nix/nixpkgs.nix +++ b/system/nix/nixpkgs.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +_: { nixpkgs = { overlays = [ (_: prev: { @@ -12,7 +12,7 @@ config = { allowUnfree = true; - permittedInsecurePackages = ["cinny-4.2.2" "cinny-unwrapped-4.2.2" "segger-jlink-qt4-796s"]; + permittedInsecurePackages = ["cinny-4.2.2" "cinny-unwrapped-4.2.2" "segger-jlink-qt4-796s" "openssl-1.1.1w"]; segger-jlink.acceptLicense = true; }; };