Revert "nix: revert overlay changes and add conditionals to derivation for flake build"

This commit is contained in:
Mustafa Çalışkan 2022-01-08 23:09:53 +03:00
parent 6065b4dcf9
commit 2a760a8e32
3 changed files with 17 additions and 18 deletions

View File

@ -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 {

View File

@ -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;
};
}

View File

@ -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"