{nix,flake}: add submodules

This commit is contained in:
Mustafa Çalışkan 2022-01-08 22:15:19 +03:00
parent 8d4f8795de
commit d29d020d6f
4 changed files with 70 additions and 9 deletions

36
flake.lock generated
View File

@ -15,6 +15,22 @@
"type": "github"
}
},
"libnbtplusplus": {
"flake": false,
"locked": {
"lastModified": 1591558203,
"narHash": "sha256-QgvNvaoFflCXEPCCFBCeZvYTpuiwScBG7EosUgFwFNQ=",
"owner": "multimc",
"repo": "libnbtplusplus",
"rev": "dc72a20b7efd304d12af2025223fad07b4b78464",
"type": "github"
},
"original": {
"owner": "multimc",
"repo": "libnbtplusplus",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1641528457,
@ -31,10 +47,28 @@
"type": "github"
}
},
"quazip": {
"flake": false,
"locked": {
"lastModified": 1633895098,
"narHash": "sha256-+Of0M2IAoTf1CyC0teCpsyurv6xfqiBo84V49dSeNTA=",
"owner": "multimc",
"repo": "quazip",
"rev": "b1a72ac0bb5a732bf887a535ab75c6f9bedb6b6b",
"type": "github"
},
"original": {
"owner": "multimc",
"repo": "quazip",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
"libnbtplusplus": "libnbtplusplus",
"nixpkgs": "nixpkgs",
"quazip": "quazip"
}
}
},

View File

@ -2,8 +2,16 @@
description = "PolyMC flake";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.libnbtplusplus = {
url = "github:multimc/libnbtplusplus";
flake = false;
};
inputs.quazip = {
url = "github:multimc/quazip";
flake = false;
};
outputs = inputs@{ self, nixpkgs, flake-utils,... }:
outputs = inputs@{ self, nixpkgs, flake-utils, libnbtplusplus, quazip, ... }:
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let
pkgs = import nixpkgs {
@ -11,9 +19,17 @@
};
packages = {
polymc = pkgs.libsForQt5.callPackage ./packages/nix/polymc { inherit self; };
polymc = pkgs.libsForQt5.callPackage ./packages/nix/polymc {
inherit self;
submoduleQuazip = quazip;
submoduleNbt = libnbtplusplus;
};
};
overlay = import ./packages/nix/overlay.nix {
inherit self quazip libnbtplusplus;
};
apps = {
polymc = flake-utils.lib.mkApp {
name = "PolyMC";
@ -22,11 +38,9 @@
};
in
{
inherit packages apps;
inherit packages overlay apps;
defaultPackage = packages.polymc;
defaultApp = apps.polymc;
overlay = import ./packages/nix/overlay.nix { inherit self; };
}
);
}

View File

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

View File

@ -14,7 +14,10 @@
, libpulseaudio
, qtbase
, libGL
# submodules
, self
, submoduleNbt
, submoduleQuazip
, msaClientID ? ""
}:
@ -39,6 +42,12 @@ mkDerivation rec {
nativeBuildInputs = [ cmake file makeWrapper ];
buildInputs = [ qtbase jdk8 zlib ];
postUnpack = ''
mkdir libraries/{libnbtplusplus,quazip}
cp -a ${submoduleNbt}/* libraries/libnbtplusplus
cp -a ${submoduleQuazip}/* libraries/quazip
'';
postPatch = ''
# add client ID
substituteInPlace notsecrets/Secrets.cpp \