diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4dfb45d4..f07a86e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,9 @@ on: SPARKLE_ED25519_KEY: description: Private key for signing Sparkle updates required: false + CACHIX_AUTH_TOKEN: + description: Private token for authenticating against Cachix cache + required: false jobs: build: @@ -526,3 +529,33 @@ jobs: bundle: "Prism Launcher.flatpak" manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml cache-key: flatpak-${{ github.sha }}-x86_64 + + nix: + runs-on: ubuntu-latest + strategy: + matrix: + package: + - prismlauncher + - prismlauncher-qt5 + steps: + - name: Clone repository + if: inputs.build_type == 'Debug' + uses: actions/checkout@v3 + with: + submodules: 'true' + - name: Install nix + if: inputs.build_type == 'Debug' + uses: cachix/install-nix-action@v18 + with: + install_url: https://nixos.org/nix/install + extra_nix_config: | + auto-optimise-store = true + experimental-features = nix-command flakes + - uses: cachix/cachix-action@v12 + if: inputs.build_type == 'Debug' + with: + name: prismlauncher + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Build + if: inputs.build_type == 'Debug' + run: nix build .#${{ matrix.package }} --print-build-logs diff --git a/.github/workflows/trigger_builds.yml b/.github/workflows/trigger_builds.yml index 44751fbc..a08193a0 100644 --- a/.github/workflows/trigger_builds.yml +++ b/.github/workflows/trigger_builds.yml @@ -8,7 +8,6 @@ on: - '**.md' - '**/LICENSE' - 'flake.lock' - - '**.nix' - 'packages/**' - '.github/ISSUE_TEMPLATE/**' - '.markdownlint**' @@ -17,7 +16,6 @@ on: - '**.md' - '**/LICENSE' - 'flake.lock' - - '**.nix' - 'packages/**' - '.github/ISSUE_TEMPLATE/**' - '.markdownlint**' @@ -33,3 +31,4 @@ jobs: is_qt_cached: true secrets: SPARKLE_ED25519_KEY: ${{ secrets.SPARKLE_ED25519_KEY }} + CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} diff --git a/flake.nix b/flake.nix index d4a25338..b1e07c91 100644 --- a/flake.nix +++ b/flake.nix @@ -23,8 +23,8 @@ pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); packagesFn = pkgs: rec { - prismlauncher = pkgs.libsForQt5.callPackage ./nix { inherit version self libnbtplusplus tomlplusplus; }; - prismlauncher-qt6 = pkgs.qt6Packages.callPackage ./nix { inherit version self libnbtplusplus tomlplusplus; }; + prismlauncher-qt5 = pkgs.libsForQt5.callPackage ./nix { inherit version self libnbtplusplus tomlplusplus; }; + prismlauncher = pkgs.qt6Packages.callPackage ./nix { inherit version self libnbtplusplus tomlplusplus; }; }; in { diff --git a/launcher/resources/breeze_dark/breeze_dark.qrc b/launcher/resources/breeze_dark/breeze_dark.qrc index 4d7a69b2..97434abc 100644 --- a/launcher/resources/breeze_dark/breeze_dark.qrc +++ b/launcher/resources/breeze_dark/breeze_dark.qrc @@ -27,6 +27,7 @@ scalable/refresh.svg scalable/resourcepacks.svg scalable/shaderpacks.svg + scalable/shortcut.svg scalable/screenshots.svg scalable/settings.svg scalable/status-bad.svg diff --git a/launcher/resources/breeze_dark/scalable/shortcut.svg b/launcher/resources/breeze_dark/scalable/shortcut.svg new file mode 100644 index 00000000..5559be1d --- /dev/null +++ b/launcher/resources/breeze_dark/scalable/shortcut.svg @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/launcher/resources/breeze_light/breeze_light.qrc b/launcher/resources/breeze_light/breeze_light.qrc index 7d9d99f5..6d868b18 100644 --- a/launcher/resources/breeze_light/breeze_light.qrc +++ b/launcher/resources/breeze_light/breeze_light.qrc @@ -27,6 +27,7 @@ scalable/refresh.svg scalable/resourcepacks.svg scalable/shaderpacks.svg + scalable/shortcut.svg scalable/screenshots.svg scalable/settings.svg scalable/status-bad.svg diff --git a/launcher/resources/breeze_light/scalable/shortcut.svg b/launcher/resources/breeze_light/scalable/shortcut.svg new file mode 100644 index 00000000..426769d1 --- /dev/null +++ b/launcher/resources/breeze_light/scalable/shortcut.svg @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/launcher/resources/flat/flat.qrc b/launcher/resources/flat/flat.qrc index 508e0a9f..a846bd2d 100644 --- a/launcher/resources/flat/flat.qrc +++ b/launcher/resources/flat/flat.qrc @@ -35,6 +35,7 @@ scalable/screenshot-placeholder.svg scalable/screenshots.svg scalable/settings.svg + scalable/shortcut.svg scalable/star.svg scalable/status-bad.svg scalable/status-good.svg diff --git a/launcher/resources/flat/scalable/shortcut.svg b/launcher/resources/flat/scalable/shortcut.svg new file mode 100644 index 00000000..83878d19 --- /dev/null +++ b/launcher/resources/flat/scalable/shortcut.svg @@ -0,0 +1,3 @@ + + + diff --git a/launcher/resources/flat_white/flat_white.qrc b/launcher/resources/flat_white/flat_white.qrc index e11d6316..b0759d8f 100644 --- a/launcher/resources/flat_white/flat_white.qrc +++ b/launcher/resources/flat_white/flat_white.qrc @@ -35,6 +35,7 @@ scalable/screenshot-placeholder.svg scalable/screenshots.svg scalable/settings.svg + scalable/shortcut.svg scalable/star.svg scalable/status-bad.svg scalable/status-good.svg diff --git a/launcher/resources/flat_white/scalable/shortcut.svg b/launcher/resources/flat_white/scalable/shortcut.svg new file mode 100644 index 00000000..b419a77d --- /dev/null +++ b/launcher/resources/flat_white/scalable/shortcut.svg @@ -0,0 +1,3 @@ + + + diff --git a/launcher/resources/multimc/multimc.qrc b/launcher/resources/multimc/multimc.qrc index 08b86406..42b496da 100644 --- a/launcher/resources/multimc/multimc.qrc +++ b/launcher/resources/multimc/multimc.qrc @@ -337,11 +337,12 @@ scalable/instances/prismlauncher.svg scalable/instances/fox_legacy.svg scalable/instances/bee_legacy.svg - - + + scalable/delete.svg scalable/tag.svg scalable/rename.svg + scalable/shortcut.svg scalable/export.svg scalable/launch.svg diff --git a/launcher/resources/multimc/scalable/shortcut.svg b/launcher/resources/multimc/scalable/shortcut.svg new file mode 100644 index 00000000..549c3724 --- /dev/null +++ b/launcher/resources/multimc/scalable/shortcut.svg @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/nix/default.nix b/nix/default.nix index c7fc7576..6050fd37 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,100 +1,99 @@ -{ stdenv -, lib -, fetchFromGitHub +{ lib +, stdenv , cmake -, ninja , jdk8 , jdk -, ghc_filesystem , zlib , file , wrapQtAppsHook , xorg , libpulseaudio , qtbase -, quazip +, qtsvg +, qtwayland , libGL -, msaClientID ? "" -, extraJDKs ? [ ] +, quazip +, glfw +, openal , extra-cmake-modules +, ghc_filesystem +, msaClientID ? "" +, jdks ? [ jdk jdk8 ] # flake , self , version , libnbtplusplus , tomlplusplus -, enableLTO ? false }: -let - # Libraries required to run Minecraft - libpath = with xorg; lib.makeLibraryPath [ - libX11 - libXext - libXcursor - libXrandr - libXxf86vm - libpulseaudio - libGL - ]; - - # This variable will be passed to Minecraft by Prism Launcher - gameLibraryPath = libpath + ":/run/opengl-driver/lib"; - - javaPaths = lib.makeSearchPath "bin/java" ([ jdk jdk8 ] ++ extraJDKs); -in - stdenv.mkDerivation rec { pname = "prismlauncher"; inherit version; src = lib.cleanSource self; - nativeBuildInputs = [ cmake extra-cmake-modules ninja jdk ghc_filesystem file wrapQtAppsHook ]; - buildInputs = [ qtbase quazip zlib ]; + nativeBuildInputs = [ extra-cmake-modules cmake file jdk wrapQtAppsHook ]; + buildInputs = [ + qtbase + qtsvg + zlib + quazip + ghc_filesystem + ] ++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland; + cmakeFlags = lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ] + ++ lib.optionals (lib.versionAtLeast qtbase.version "6") [ "-DLauncher_QT_VERSION_MAJOR=6" ]; dontWrapQtApps = true; postUnpack = '' - # Copy libnbtplusplus rm -rf source/libraries/libnbtplusplus mkdir source/libraries/libnbtplusplus ln -s ${libnbtplusplus}/* source/libraries/libnbtplusplus chmod -R +r+w source/libraries/libnbtplusplus - # Copy tomlplusplus + chown -R $USER: source/libraries/libnbtplusplus rm -rf source/libraries/tomlplusplus mkdir source/libraries/tomlplusplus ln -s ${tomlplusplus}/* source/libraries/tomlplusplus chmod -R +r+w source/libraries/tomlplusplus + chown -R $USER: source/libraries/tomlplusplus ''; - cmakeFlags = [ - "-GNinja" - "-DLauncher_QT_VERSION_MAJOR=${lib.versions.major qtbase.version}" - ] ++ lib.optionals enableLTO [ "-DENABLE_LTO=on" ] - ++ lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ]; + postInstall = + let + libpath = with xorg; + lib.makeLibraryPath [ + libX11 + libXext + libXcursor + libXrandr + libXxf86vm + libpulseaudio + libGL + glfw + openal + stdenv.cc.cc.lib + ]; + in + '' + # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 + wrapQtApp $out/bin/prismlauncher \ + --set LD_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \ + --prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks} \ + --prefix PATH : ${lib.makeBinPath [xorg.xrandr]} + ''; - # we have to check if the system is NixOS before adding stdenv.cc.cc.lib (#923) - postInstall = '' - # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 - wrapQtApp $out/bin/prismlauncher \ - --run '[ -f /etc/NIXOS ] && export LD_LIBRARY_PATH="${stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH"' \ - --prefix LD_LIBRARY_PATH : ${gameLibraryPath} \ - --prefix PRISMLAUNCHER_JAVA_PATHS : ${javaPaths} \ - --prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]} - ''; meta = with lib; { homepage = "https://prismlauncher.org/"; - downloadPage = "https://prismlauncher.org/download/"; - changelog = "https://github.com/PrismLauncher/PrismLauncher/releases"; description = "A free, open source launcher for Minecraft"; longDescription = '' Allows you to have multiple, separate instances of Minecraft (each with their own mods, texture packs, saves, etc) and helps you manage them and their associated options with a simple interface. ''; - platforms = platforms.unix; + platforms = platforms.linux; + changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${version}"; license = licenses.gpl3Only; maintainers = with maintainers; [ minion3665 Scrumplex ]; };