From 37cf4ca563036b5435fb35ceada7ddf3af2561f1 Mon Sep 17 00:00:00 2001 From: kaeeraa Date: Fri, 15 May 2026 23:06:29 +0300 Subject: [PATCH 1/3] fix(nix): fix darwin build, remove extra dependency with modern and cool freesmlauncher nix code Signed-off-by: kaeeraa --- flake.lock | 16 ----- flake.nix | 6 +- nix/unwrapped.nix | 151 ++++++++++++++++++++++------------------------ nix/wrapper.nix | 15 +++-- 4 files changed, 83 insertions(+), 105 deletions(-) diff --git a/flake.lock b/flake.lock index 1ee1006ff..0b58b8351 100644 --- a/flake.lock +++ b/flake.lock @@ -16,21 +16,6 @@ "type": "github" } }, - "nix-filter": { - "locked": { - "lastModified": 1757882181, - "narHash": "sha256-+cCxYIh2UNalTz364p+QYmWHs0P+6wDhiWR4jDIKQIU=", - "owner": "numtide", - "repo": "nix-filter", - "rev": "59c44d1909c72441144b93cf0f054be7fe764de5", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "nix-filter", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1777954456, @@ -50,7 +35,6 @@ "root": { "inputs": { "libnbtplusplus": "libnbtplusplus", - "nix-filter": "nix-filter", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 9513bdb4d..426054225 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,6 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - nix-filter.url = "github:numtide/nix-filter"; libnbtplusplus = { url = "github:FreesmTeam/libnbtplusplus"; flake = false; @@ -26,7 +25,6 @@ outputs = { self, nixpkgs, - nix-filter, libnbtplusplus, ... }: let @@ -41,7 +39,7 @@ in { overlays.default = final: prev: { freesmlauncher-unwrapped = final.callPackage ./nix/unwrapped.nix { - inherit nix-filter libnbtplusplus self; + inherit libnbtplusplus self; }; freesmlauncher = final.callPackage ./nix/wrapper.nix; @@ -51,7 +49,7 @@ pkgs = import nixpkgs {inherit system;}; freesmlauncher-unwrapped = pkgs.callPackage ./nix/unwrapped.nix { - inherit nix-filter libnbtplusplus self; + inherit libnbtplusplus self; }; freesmlauncher = pkgs.callPackage ./nix/wrapper.nix { diff --git a/nix/unwrapped.nix b/nix/unwrapped.nix index b8d822bd1..98a57aff7 100644 --- a/nix/unwrapped.nix +++ b/nix/unwrapped.nix @@ -14,96 +14,87 @@ tomlplusplus, ghc_filesystem, libarchive, - darwin, gamemode, extra-cmake-modules, - nix-filter, msaClientID ? null, gamemodeSupport ? stdenv.hostPlatform.isLinux, -}: let - isDarwin = stdenv.hostPlatform.isDarwin; -in - assert lib.assertMsg (gamemodeSupport -> stdenv.hostPlatform.isLinux) - "gamemodeSupport only on linux"; - stdenv.mkDerivation { - pname = "freesmlauncher-unwrapped"; - version = self.shortRev or self.dirtyShortRev or "_git"; - src = nix-filter.lib { - root = self; - include = [ - "buildconfig" - "cmake" - "launcher" - "libraries" - "program_info" - "tests" - ../docs/COPYING.md - ../CMakeLists.txt - ]; +}: +assert lib.assertMsg (gamemodeSupport -> stdenv.hostPlatform.isLinux) +"gamemodeSupport only on linux"; + stdenv.mkDerivation { + pname = "freesmlauncher-unwrapped"; + version = self.shortRev or self.dirtyShortRev or "_git"; + src = with lib.fileset; + toSource { + root = ../.; + fileset = unions [ + ../buildconfig + ../cmake + ../launcher + ../libraries + ../program_info + ../tests - # Some fetchers leave submodules directories empty instead of omitting them, causing Garnix CI cache misses. - exclude = [ - "libraries/libnbtplusplus" + ../CMakeLists.txt + ../docs/COPYING.md ]; }; - postUnpack = '' - ln -s ${libnbtplusplus} source/libraries/libnbtplusplus - ''; + postUnpack = let + folder = "source/libraries/libnbtplusplus"; + in '' + rm -rf ${folder} + ln -s ${libnbtplusplus} ${folder} + ''; - nativeBuildInputs = [ - cmake - ninja - extra-cmake-modules - jdk17 - stripJavaArchivesHook - ]; + nativeBuildInputs = [ + cmake + ninja + extra-cmake-modules + jdk17 + stripJavaArchivesHook + ]; - buildInputs = - [ - cmark - ghc_filesystem - kdePackages.qtbase - kdePackages.qtnetworkauth - kdePackages.quazip - libarchive - tomlplusplus - qrencode - zlib - ] - ++ lib.optionals isDarwin [darwin.apple_sdk.frameworks.Cocoa] - ++ lib.optionals gamemodeSupport [gamemode]; + buildInputs = + [ + cmark + ghc_filesystem + kdePackages.qtbase + kdePackages.qtnetworkauth + kdePackages.quazip + libarchive + tomlplusplus + qrencode + zlib + ] + ++ lib.optionals gamemodeSupport [gamemode]; - cmakeFlags = - [(lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs")] - ++ lib.optionals (msaClientID != null) [ - (lib.cmakeFeature "Launcher_MSA_CLIENT_ID" msaClientID) - ] - ++ lib.optionals (lib.versionOlder kdePackages.qtbase.version "6") - [ - (lib.cmakeFeature "Launcher_QT_VERSION_MAJOR" "5") - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - (lib.cmakeFeature "INSTALL_BUNDLE" "nodeps") - (lib.cmakeFeature "MACOSX_SPARKLE_UPDATE_FEED_URL" "''") - (lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/Applications/") - ]; + cmakeFlags = + [(lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs")] + ++ lib.optionals (msaClientID != null) [ + (lib.cmakeFeature "Launcher_MSA_CLIENT_ID" msaClientID) + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + (lib.cmakeFeature "INSTALL_BUNDLE" "nodeps") + (lib.cmakeFeature "MACOSX_SPARKLE_UPDATE_FEED_URL" "''") + (lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/Applications/") + ]; - doCheck = true; - dontWrapQtApps = true; - enableParallelBuilding = true; + doCheck = stdenv.hostPlatform.isLinux; + dontWrapQtApps = true; + enableParallelBuilding = true; - meta = { - description = "Prism Launcher fork aimed to provide a free way to play Minecraft"; - longDescription = '' - Freesm Launcher is a custom launcher for Minecraft that allows you - to easily manage multiple installations of Minecraft at once and login - with offline account without any restrictions. - ''; - homepage = "https://freesmlauncher.org/"; - license = lib.licenses.gpl3Only; - platforms = lib.platforms.linux ++ lib.platforms.darwin; - mainProgram = "freesmlauncher"; - maintainers = with lib.maintainers; [s0me1newithhand7s]; - }; - } + meta = { + description = "Prism Launcher fork aimed to provide a free way to play Minecraft"; + longDescription = '' + Freesm Launcher is a custom launcher for Minecraft that allows you + to easily manage multiple installations of Minecraft at once and login + with offline account without any restrictions. + ''; + homepage = "https://freesmlauncher.org/"; + license = lib.licenses.gpl3Only; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + mainProgram = "freesmlauncher"; + maintainers = with lib.maintainers; [s0me1newithhand7s]; + }; + } diff --git a/nix/wrapper.nix b/nix/wrapper.nix index 54b22a5c1..cad621c91 100644 --- a/nix/wrapper.nix +++ b/nix/wrapper.nix @@ -85,17 +85,22 @@ in paths = [launcher]; nativeBuildInputs = [kdePackages.wrapQtAppsHook]; buildInputs = with kdePackages; - [qtbase qtsvg] + [qtbase qtsvg qtimageformats] ++ lib.optional (lib.versionAtLeast qtbase.version "6" && isLinux) qtwayland; - postBuild = '' - wrapQtAppsHook - ''; - qtWrapperArgs = ["--prefix FREESMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"] ++ lib.optionals isLinux [ "--prefix PATH : ${lib.makeBinPath runtimePrograms}" "--prefix LD_LIBRARY_PATH : ${addDriverRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}" ]; + + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' + if [ -d "$out/Applications/FreesmLauncher.app/Contents/MacOS" ]; then + mkdir -p "$out/bin" + ln -s \ + "$out/Applications/FreesmLauncher.app/Contents/MacOS/freesmlauncher" \ + "$out/bin/freesmlauncher" + fi + ''; } From fb2976a1546f6e9555f7e5e03eb65cba1b1ff228 Mon Sep 17 00:00:00 2001 From: kaeeraa Date: Fri, 15 May 2026 23:21:05 +0300 Subject: [PATCH 2/3] fix(nix): let garnix build package on all platforms Signed-off-by: kaeeraa --- garnix.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 garnix.yaml diff --git a/garnix.yaml b/garnix.yaml new file mode 100644 index 000000000..4514dbda5 --- /dev/null +++ b/garnix.yaml @@ -0,0 +1,4 @@ +builds: + exclude: [] + include: + - "packages.*.freesmlauncher" From b45b54f8f24387631dd2a2d95b4b61b8c3b365c9 Mon Sep 17 00:00:00 2001 From: kaeeraa Date: Mon, 18 May 2026 18:07:14 +0300 Subject: [PATCH 3/3] fix(nix): fix `extra-cmake-modules` in `nixos-unstable`; update `flake.lock` Signed-off-by: kaeeraa --- flake.lock | 6 +++--- nix/unwrapped.nix | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 0b58b8351..45832145d 100644 --- a/flake.lock +++ b/flake.lock @@ -18,11 +18,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1777954456, - "narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=", + "lastModified": 1778869304, + "narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1", + "rev": "d233902339c02a9c334e7e593de68855ad26c4cb", "type": "github" }, "original": { diff --git a/nix/unwrapped.nix b/nix/unwrapped.nix index 98a57aff7..6c205dabf 100644 --- a/nix/unwrapped.nix +++ b/nix/unwrapped.nix @@ -15,7 +15,7 @@ ghc_filesystem, libarchive, gamemode, - extra-cmake-modules, + pkg-config, msaClientID ? null, gamemodeSupport ? stdenv.hostPlatform.isLinux, }: @@ -50,9 +50,10 @@ assert lib.assertMsg (gamemodeSupport -> stdenv.hostPlatform.isLinux) nativeBuildInputs = [ cmake ninja - extra-cmake-modules + kdePackages.extra-cmake-modules jdk17 stripJavaArchivesHook + pkg-config ]; buildInputs =