Merge pull request #272 from Kranzes/develop

This commit is contained in:
Sefa Eyeoglu 2022-04-07 20:30:26 +02:00 committed by GitHub
commit c3f1c13a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 76 deletions

View File

@ -3,11 +3,11 @@
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1641205782, "lastModified": 1648199409,
"narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=", "narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7", "rev": "64a525ee38886ab9028e6f61790de0832aa3ef03",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -16,21 +16,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": {
"locked": {
"lastModified": 1642700792,
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"libnbtplusplus": { "libnbtplusplus": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -49,16 +34,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1643169865, "lastModified": 1648219316,
"narHash": "sha256-+KIpNRazbc8Gac9jdWCKQkFv9bjceaLaLhlwqUEYu8c=", "narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "945ec499041db73043f745fad3b2a3a01e826081", "rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "nixos-unstable", "ref": "nixpkgs-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -82,7 +67,6 @@
"root": { "root": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"libnbtplusplus": "libnbtplusplus", "libnbtplusplus": "libnbtplusplus",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"quazip": "quazip" "quazip": "quazip"

View File

@ -1,50 +1,34 @@
{ {
description = "PolyMC flake"; description = "A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once (Fork of MultiMC)";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs = {
inputs.flake-compat = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
url = "github:edolstra/flake-compat"; flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
flake = false; libnbtplusplus = { url = "github:multimc/libnbtplusplus"; flake = false; };
}; quazip = { url = "github:stachenov/quazip"; flake = false; };
inputs.libnbtplusplus = {
url = "github:multimc/libnbtplusplus";
flake = false;
};
inputs.quazip = {
url = "github:stachenov/quazip";
flake = false;
}; };
outputs = args@{ self, nixpkgs, flake-utils, libnbtplusplus, quazip, ... }: outputs = { self, nixpkgs, libnbtplusplus, quazip, ... }:
let let
systems = [ # Generate a user-friendly version number.
"aarch64-linux" version = builtins.substring 0 8 self.lastModifiedDate;
# "aarch64-darwin" # qtbase is currently broken
"i686-linux" # System types to support (qtbase is currently broken for "aarch64-darwin")
"x86_64-darwin" supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ];
"x86_64-linux"
]; # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
in { forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
overlay = final: prev: {
inherit (self.packages.${final.system}) polymc; # Nixpkgs instantiated for supported system types.
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
in
{
packages = forAllSystems (system: { polymc = pkgs.${system}.libsForQt5.callPackage ./packages/nix/polymc { inherit version self quazip libnbtplusplus; }; });
defaultPackage = forAllSystems (system: self.packages.${system}.polymc);
apps = forAllSystems (system: { polymc = { type = "app"; program = "${self.defaultPackage.${system}}/bin/polymc"; }; });
defaultApp = forAllSystems (system: self.apps.${system}.polymc);
overlay = final: prev: { polymc = self.defaultPackage.${final.system}; };
}; };
} // flake-utils.lib.eachSystem systems (system:
let pkgs = import nixpkgs { inherit system; };
in {
packages = {
polymc = pkgs.libsForQt5.callPackage ./packages/nix/polymc {
inherit self;
submoduleQuazip = quazip;
submoduleNbt = libnbtplusplus;
};
};
apps = {
polymc = flake-utils.lib.mkApp {
name = "polymc";
drv = self.packages.${system}.polymc;
};
};
defaultPackage = self.packages.${system}.polymc;
defaultApp = self.apps.${system}.polymc;
});
} }

View File

@ -16,8 +16,9 @@
# flake # flake
, self , self
, submoduleNbt , version
, submoduleQuazip , libnbtplusplus
, quazip
}: }:
let let
@ -38,12 +39,12 @@ in
mkDerivation rec { mkDerivation rec {
pname = "polymc"; pname = "polymc";
version = "nightly"; inherit version;
src = lib.cleanSource self; src = lib.cleanSource self;
nativeBuildInputs = [ cmake ninja file makeWrapper ]; nativeBuildInputs = [ cmake ninja file makeWrapper ];
buildInputs = [ qtbase jdk8 zlib ]; buildInputs = [ qtbase jdk zlib ];
dontWrapQtApps = true; dontWrapQtApps = true;
@ -57,8 +58,8 @@ mkDerivation rec {
# Copy submodules inputs # Copy submodules inputs
rm -rf source/libraries/{libnbtplusplus,quazip} rm -rf source/libraries/{libnbtplusplus,quazip}
mkdir source/libraries/{libnbtplusplus,quazip} mkdir source/libraries/{libnbtplusplus,quazip}
cp -a ${submoduleNbt}/* source/libraries/libnbtplusplus cp -a ${libnbtplusplus}/* source/libraries/libnbtplusplus
cp -a ${submoduleQuazip}/* source/libraries/quazip cp -a ${quazip}/* source/libraries/quazip
chmod a+r+w source/libraries/{libnbtplusplus,quazip}/* chmod a+r+w source/libraries/{libnbtplusplus,quazip}/*
''; '';