From 2a760a8e32627617dc80c96c9598ad3ed34ffbc8 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:09:53 +0300 Subject: [PATCH] Revert "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, 17 insertions(+), 18 deletions(-) diff --git a/flake.nix b/flake.nix index 2ef65c64..aa2c2cb5 100644 --- a/flake.nix +++ b/flake.nix @@ -21,13 +21,14 @@ packages = { polymc = pkgs.libsForQt5.callPackage ./packages/nix/polymc { inherit self; - isFlakeBuild = true; submoduleQuazip = quazip; submoduleNbt = libnbtplusplus; }; }; - overlay = import ./packages/nix/overlay.nix {}; + overlay = import ./packages/nix/overlay.nix { + inherit self quazip libnbtplusplus; + }; apps = { polymc = flake-utils.lib.mkApp { diff --git a/packages/nix/overlay.nix b/packages/nix/overlay.nix index 6fa701b3..a65c23e0 100644 --- a/packages/nix/overlay.nix +++ b/packages/nix/overlay.nix @@ -1,3 +1,9 @@ +{ self, quazip, libnbtplusplus }: + final: prev: rec { - polymc = prev.libsForQt5.callPackage ./polymc {}; + polymc = prev.libsForQt5.callPackage ./polymc { + inherit self; + submoduleQuazip = quazip; + submoduleNbt = libnbtplusplus; + }; } diff --git a/packages/nix/polymc/default.nix b/packages/nix/polymc/default.nix index c55c8a3c..340c1ae5 100644 --- a/packages/nix/polymc/default.nix +++ b/packages/nix/polymc/default.nix @@ -15,10 +15,9 @@ , qtbase , libGL # submodules -, isFlakeBuild ? false -, self ? "" -, submoduleNbt ? "" -, submoduleQuazip ? "" +, self +, submoduleNbt +, submoduleQuazip }: let @@ -35,26 +34,19 @@ in mkDerivation rec { pname = "polymc"; - version = if isFlakeBuild then "nightly" else "1.0.4"; + version = "nightly"; - src = if isFlakeBuild then lib.cleanSource self - else fetchFromGitHub { - owner = "PolyMC"; - repo = "PolyMC"; - rev = "${version}"; - sha256 = "sha256-8aya0KfV9F+i2qBpweWcR9hwyTSQkqn2wHdtkCEeNvk="; - fetchSubmodules = true; - }; + src = lib.cleanSource self; nativeBuildInputs = [ cmake file makeWrapper ]; buildInputs = [ qtbase jdk8 zlib ]; - postUnpack = if isFlakeBuild then '' + postUnpack = '' 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"