From 732008db203d1ff6cc7c5d4957cb394d016eaf79 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 19 Sep 2024 16:27:06 -0400 Subject: [PATCH 1/7] ci: drop garnix Signed-off-by: seth --- garnix.yaml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 garnix.yaml diff --git a/garnix.yaml b/garnix.yaml deleted file mode 100644 index a7c1b48a9..000000000 --- a/garnix.yaml +++ /dev/null @@ -1,10 +0,0 @@ -builds: - exclude: - # Currently broken on Garnix's end - - "*.x86_64-darwin.*" - include: - - "checks.x86_64-linux.*" - - "packages.x86_64-linux.*" - - "packages.aarch64-linux.*" - - "packages.x86_64-darwin.*" - - "packages.aarch64-darwin.*" From 2663ac5405cbfc3c29a38b32a755b7c7ebda0779 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 19 Sep 2024 16:34:59 -0400 Subject: [PATCH 2/7] build(nix): add debug builds This will lead to build times on par with our other CI jobs, as now we're not always building for release Signed-off-by: seth --- flake.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/flake.nix b/flake.nix index 987fc0eda..d07834b4c 100644 --- a/flake.nix +++ b/flake.nix @@ -118,5 +118,24 @@ # Only output them if they're available on the current system lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages ); + + # We put these under legacyPackages as they are meant for CI, not end user consumption + legacyPackages = forAllSystems ( + system: + let + prismPackages = self.packages.${system}; + legacyPackages = self.legacyPackages.${system}; + in + { + prismlauncher-debug = prismPackages.prismlauncher.override { + prismlauncher-unwrapped = legacyPackages.prismlauncher-unwrapped-debug; + }; + + prismlauncher-unwrapped-debug = prismPackages.prismlauncher-unwrapped.overrideAttrs { + cmakeBuildType = "Debug"; + dontStrip = true; + }; + } + ); }; } From 5adca58337e9fe2a71f7bdd0951494ceddb34659 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 19 Sep 2024 16:44:19 -0400 Subject: [PATCH 3/7] ci: add nix job Signed-off-by: seth --- .github/workflows/build.yml | 53 +++++++++++++++++++++++++++ .github/workflows/trigger_builds.yml | 1 + .github/workflows/trigger_release.yml | 1 + 3 files changed, 55 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ccba62541..f26884c2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,6 +39,9 @@ on: APPLE_NOTARIZE_PASSWORD: description: Password used for notarizing macOS builds required: false + CACHIX_AUTH_TOKEN: + description: Private token for authenticating against Cachix cache + required: false GPG_PRIVATE_KEY: description: Private key for AppImage signing required: false @@ -631,3 +634,53 @@ jobs: with: bundle: "Prism Launcher.flatpak" manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml + + nix: + name: Nix (${{ matrix.system }}) + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + system: x86_64-linux + + - os: macos-13 + system: x86_64-darwin + + - os: macos-14 + system: aarch64-darwin + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v27 + + # For PRs + - name: Setup Nix Magic Cache + uses: DeterminateSystems/magic-nix-cache-action@v8 + + # For in-tree builds + - name: Setup Cachix + uses: cachix/cachix-action@v15 + with: + name: prismlauncher + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + + - name: Run flake checks + run: | + nix flake check --print-build-logs --show-trace + + - name: Build debug package + if: ${{ inputs.build_type == 'Debug' }} + run: | + nix build --print-build-logs .#prismlauncher-debug + + - name: Build release package + if: ${{ inputs.build_type != 'Debug' }} + run: | + nix build --print-build-logs .#prismlauncher diff --git a/.github/workflows/trigger_builds.yml b/.github/workflows/trigger_builds.yml index 9efafc8cc..0b8386d69 100644 --- a/.github/workflows/trigger_builds.yml +++ b/.github/workflows/trigger_builds.yml @@ -38,5 +38,6 @@ jobs: APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }} APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }} APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }} + CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }} diff --git a/.github/workflows/trigger_release.yml b/.github/workflows/trigger_release.yml index 134281b2c..e800653e3 100644 --- a/.github/workflows/trigger_release.yml +++ b/.github/workflows/trigger_release.yml @@ -22,6 +22,7 @@ jobs: APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }} APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }} APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }} + CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }} From 68bf500f7ee48f17abf2a27e942d953a9962ef55 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 19 Sep 2024 16:50:45 -0400 Subject: [PATCH 4/7] chore: add nix reformat to .git-blame-ignore-revs Signed-off-by: seth --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 2163db45b..528b128b1 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -2,3 +2,6 @@ # tabs -> spaces bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9 + +# (nix) alejandra -> nixfmt +4c81d8c53d09196426568c4a31a4e752ed05397a From bf432b5514d7c9c90761a285d17afbd736e4a687 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 30 Sep 2024 16:21:07 -0400 Subject: [PATCH 5/7] chore(nix): use cachix for binary cache Signed-off-by: seth --- flake.nix | 6 ++++-- nix/README.md | 20 ++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/flake.nix b/flake.nix index d07834b4c..f4ca782ec 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,10 @@ description = "A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once (Fork of MultiMC)"; nixConfig = { - extra-substituters = [ "https://cache.garnix.io" ]; - extra-trusted-public-keys = [ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ]; + extra-substituters = [ "https://prismlauncher.cachix.org" ]; + extra-trusted-public-keys = [ + "prismlauncher.cachix.org-1:9/n/FGyABA2jLUVfY+DEp4hKds/rwO+SCOtbOkDzd+c=" + ]; }; inputs = { diff --git a/nix/README.md b/nix/README.md index 76cb8bf27..8bb658477 100644 --- a/nix/README.md +++ b/nix/README.md @@ -8,8 +8,8 @@ See [Package variants](#package-variants) for a list of available packages. ## Installing a development release (flake) -We use [garnix](https://garnix.io/) to build and cache our development builds. -If you want to avoid rebuilds you may add the garnix cache to your substitutors, or use `--accept-flake-config` +We use [cachix](https://cachix.org/) to cache our development and release builds. +If you want to avoid rebuilds you may add the Cachix bucket to your substitutors, or use `--accept-flake-config` to temporarily enable it when using `nix` commands. Example (NixOS): @@ -17,12 +17,10 @@ Example (NixOS): ```nix { nix.settings = { - trusted-substituters = [ - "https://cache.garnix.io" - ]; + trusted-substituters = [ "https://prismlauncher.cachix.org" ]; trusted-public-keys = [ - "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" + "prismlauncher.cachix.org-1:9/n/FGyABA2jLUVfY+DEp4hKds/rwO+SCOtbOkDzd+c=" ]; }; } @@ -137,20 +135,18 @@ nix profile install github:PrismLauncher/PrismLauncher ## Installing a development release (without flakes) -We use [garnix](https://garnix.io/) to build and cache our development builds. -If you want to avoid rebuilds you may add the garnix cache to your substitutors. +We use [Cachix](https://cachix.org/) to cache our development and release builds. +If you want to avoid rebuilds you may add the Cachix bucket to your substitutors. Example (NixOS): ```nix { nix.settings = { - trusted-substituters = [ - "https://cache.garnix.io" - ]; + trusted-substituters = [ "https://prismlauncher.cachix.org" ]; trusted-public-keys = [ - "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" + "prismlauncher.cachix.org-1:9/n/FGyABA2jLUVfY+DEp4hKds/rwO+SCOtbOkDzd+c=" ]; }; } From 988ef320193e5bfb7de600bc38f99f9ba122c379 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 30 Sep 2024 16:30:22 -0400 Subject: [PATCH 6/7] fix(nix): don't write to files in formatting check Signed-off-by: seth --- nix/checks.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/checks.nix b/nix/checks.nix index 40a2e272f..ec219d6f8 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -23,7 +23,7 @@ cd ${self} echo "Running clang-format...." - clang-format -i --style='file' --Werror */**.{c,cc,cpp,h,hh,hpp} + clang-format --dry-run --style='file' --Werror */**.{c,cc,cpp,h,hh,hpp} echo "Running deadnix..." deadnix --fail From 38fa2e0cd494d400110496a35c7f112b2b801d97 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 30 Sep 2024 16:32:35 -0400 Subject: [PATCH 7/7] style: format with clang-format Signed-off-by: seth --- launcher/Application.cpp | 2 +- launcher/ui/MainWindow.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 4a66271a3..b8dcc1099 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -1026,7 +1026,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) // notify user if /tmp is mounted with `noexec` (#1693) QString jvmArgs = m_settings->get("JvmArgs").toString(); - if(jvmArgs.indexOf("java.io.tmpdir") == -1) { /* java.io.tmpdir is a valid workaround, so don't annoy */ + if (jvmArgs.indexOf("java.io.tmpdir") == -1) { /* java.io.tmpdir is a valid workaround, so don't annoy */ bool is_tmp_noexec = false; #if defined(Q_OS_LINUX) diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 3f0bb3281..09c47b609 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -235,7 +235,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi } ui->actionViewJavaFolder->setEnabled(BuildConfig.JAVA_DOWNLOADER_ENABLED); - } // add the toolbar toggles to the view menu