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

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

View File

@ -21,14 +21,13 @@
packages = { packages = {
polymc = pkgs.libsForQt5.callPackage ./packages/nix/polymc { polymc = pkgs.libsForQt5.callPackage ./packages/nix/polymc {
inherit self; inherit self;
isFlakeBuild = true;
submoduleQuazip = quazip; submoduleQuazip = quazip;
submoduleNbt = libnbtplusplus; submoduleNbt = libnbtplusplus;
}; };
}; };
overlay = import ./packages/nix/overlay.nix { overlay = import ./packages/nix/overlay.nix {};
inherit self quazip libnbtplusplus;
};
apps = { apps = {
polymc = flake-utils.lib.mkApp { polymc = flake-utils.lib.mkApp {

View File

@ -1,9 +1,3 @@
{ self, quazip, libnbtplusplus }:
final: prev: rec { final: prev: rec {
polymc = prev.libsForQt5.callPackage ./polymc { polymc = prev.libsForQt5.callPackage ./polymc {};
inherit self;
submoduleQuazip = quazip;
submoduleNbt = libnbtplusplus;
};
} }

View File

@ -15,9 +15,10 @@
, qtbase , qtbase
, libGL , libGL
# submodules # submodules
, self , isFlakeBuild ? false
, submoduleNbt , self ? ""
, submoduleQuazip , submoduleNbt ? ""
, submoduleQuazip ? ""
}: }:
let let
@ -34,19 +35,26 @@ in
mkDerivation rec { mkDerivation rec {
pname = "polymc"; 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 ]; nativeBuildInputs = [ cmake file makeWrapper ];
buildInputs = [ qtbase jdk8 zlib ]; buildInputs = [ qtbase jdk8 zlib ];
postUnpack = '' postUnpack = if isFlakeBuild then ''
mkdir source/libraries/{libnbtplusplus,quazip} mkdir source/libraries/{libnbtplusplus,quazip}
cp -a ${submoduleNbt}/* source/libraries/libnbtplusplus cp -a ${submoduleNbt}/* source/libraries/libnbtplusplus
cp -a ${submoduleQuazip}/* source/libraries/quazip cp -a ${submoduleQuazip}/* source/libraries/quazip
chmod a+r+w source/libraries/{libnbtplusplus,quazip}/* chmod a+r+w source/libraries/{libnbtplusplus,quazip}/*
''; '' else "";
cmakeFlags = [ cmakeFlags = [
"-DLauncher_LAYOUT=lin-system" "-DLauncher_LAYOUT=lin-system"