From 6065b4dcf9c084dcea6b317ca3e186d14ad9f26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20=C3=87al=C4=B1=C5=9Fkan?= Date: Sat, 8 Jan 2022 23:06:56 +0300 Subject: [PATCH] nix: revert overlay changes and add conditionals to derivation for flake build --- flake.nix | 5 ++--- packages/nix/overlay.nix | 8 +------- packages/nix/polymc/default.nix | 22 +++++++++++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/flake.nix b/flake.nix index aa2c2cb5c..2ef65c649 100644 --- a/flake.nix +++ b/flake.nix @@ -21,14 +21,13 @@ packages = { polymc = pkgs.libsForQt5.callPackage ./packages/nix/polymc { inherit self; + isFlakeBuild = true; submoduleQuazip = quazip; submoduleNbt = libnbtplusplus; }; }; - overlay = import ./packages/nix/overlay.nix { - inherit self quazip libnbtplusplus; - }; + overlay = import ./packages/nix/overlay.nix {}; apps = { polymc = flake-utils.lib.mkApp { diff --git a/packages/nix/overlay.nix b/packages/nix/overlay.nix index a65c23e05..6fa701b39 100644 --- a/packages/nix/overlay.nix +++ b/packages/nix/overlay.nix @@ -1,9 +1,3 @@ -{ self, quazip, libnbtplusplus }: - final: prev: rec { - polymc = prev.libsForQt5.callPackage ./polymc { - inherit self; - submoduleQuazip = quazip; - submoduleNbt = libnbtplusplus; - }; + polymc = prev.libsForQt5.callPackage ./polymc {}; } diff --git a/packages/nix/polymc/default.nix b/packages/nix/polymc/default.nix index 340c1ae57..c55c8a3c9 100644 --- a/packages/nix/polymc/default.nix +++ b/packages/nix/polymc/default.nix @@ -15,9 +15,10 @@ , qtbase , libGL # submodules -, self -, submoduleNbt -, submoduleQuazip +, isFlakeBuild ? false +, self ? "" +, submoduleNbt ? "" +, submoduleQuazip ? "" }: let @@ -34,19 +35,26 @@ in mkDerivation rec { pname = "polymc"; - version = "nightly"; + version = if isFlakeBuild then "nightly" else "1.0.4"; - src = lib.cleanSource self; + src = if isFlakeBuild then lib.cleanSource self + else fetchFromGitHub { + owner = "PolyMC"; + repo = "PolyMC"; + rev = "${version}"; + sha256 = "sha256-8aya0KfV9F+i2qBpweWcR9hwyTSQkqn2wHdtkCEeNvk="; + fetchSubmodules = true; + }; nativeBuildInputs = [ cmake file makeWrapper ]; buildInputs = [ qtbase jdk8 zlib ]; - postUnpack = '' + postUnpack = if isFlakeBuild then '' mkdir source/libraries/{libnbtplusplus,quazip} cp -a ${submoduleNbt}/* source/libraries/libnbtplusplus cp -a ${submoduleQuazip}/* source/libraries/quazip chmod a+r+w source/libraries/{libnbtplusplus,quazip}/* - ''; + '' else ""; cmakeFlags = [ "-DLauncher_LAYOUT=lin-system"