Merge pull request #653 from muscaln/nix
This commit is contained in:
commit
4a0b0d8735
@ -1 +1 @@
|
|||||||
(import packages/nix/flake-compat.nix).defaultNix
|
(import nix/flake-compat.nix).defaultNix
|
||||||
|
31
flake.lock
generated
31
flake.lock
generated
@ -3,11 +3,11 @@
|
|||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1648199409,
|
"lastModified": 1650374568,
|
||||||
"narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=",
|
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||||
"owner": "edolstra",
|
"owner": "edolstra",
|
||||||
"repo": "flake-compat",
|
"repo": "flake-compat",
|
||||||
"rev": "64a525ee38886ab9028e6f61790de0832aa3ef03",
|
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -34,11 +34,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1648219316,
|
"lastModified": 1653326962,
|
||||||
"narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=",
|
"narHash": "sha256-W8feCYqKTsMre4nAEpv5Kx1PVFC+hao/LwqtB2Wci/8=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634",
|
"rev": "41cc1d5d9584103be4108c1815c350e07c807036",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -48,28 +48,11 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"quazip": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1643049383,
|
|
||||||
"narHash": "sha256-LcJY6yd6GyeL7X5MP4L94diceM1TYespWByliBsjK98=",
|
|
||||||
"owner": "stachenov",
|
|
||||||
"repo": "quazip",
|
|
||||||
"rev": "09ec1d10c6d627f895109b21728dda000cbfa7d1",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "stachenov",
|
|
||||||
"repo": "quazip",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"libnbtplusplus": "libnbtplusplus",
|
"libnbtplusplus": "libnbtplusplus",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs"
|
||||||
"quazip": "quazip"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -5,10 +5,9 @@
|
|||||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
|
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
|
||||||
libnbtplusplus = { url = "github:multimc/libnbtplusplus"; flake = false; };
|
libnbtplusplus = { url = "github:multimc/libnbtplusplus"; flake = false; };
|
||||||
quazip = { url = "github:stachenov/quazip"; flake = false; };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, libnbtplusplus, quazip, ... }:
|
outputs = { self, nixpkgs, libnbtplusplus, ... }:
|
||||||
let
|
let
|
||||||
# Generate a user-friendly version number.
|
# Generate a user-friendly version number.
|
||||||
version = builtins.substring 0 8 self.lastModifiedDate;
|
version = builtins.substring 0 8 self.lastModifiedDate;
|
||||||
@ -23,7 +22,11 @@
|
|||||||
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages = forAllSystems (system: { polymc = pkgs.${system}.libsForQt5.callPackage ./packages/nix/polymc { inherit version self quazip libnbtplusplus; }; });
|
packages = forAllSystems (system: {
|
||||||
|
polymc = pkgs.${system}.libsForQt5.callPackage ./nix { inherit version self libnbtplusplus; };
|
||||||
|
polymc-qt6 = pkgs.${system}.qt6Packages.callPackage ./nix { inherit version self libnbtplusplus; };
|
||||||
|
});
|
||||||
|
|
||||||
defaultPackage = forAllSystems (system: self.packages.${system}.polymc);
|
defaultPackage = forAllSystems (system: self.packages.${system}.polymc);
|
||||||
|
|
||||||
apps = forAllSystems (system: { polymc = { type = "app"; program = "${self.defaultPackage.${system}}/bin/polymc"; }; });
|
apps = forAllSystems (system: { polymc = { type = "app"; program = "${self.defaultPackage.${system}}/bin/polymc"; }; });
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ lib
|
{ stdenv
|
||||||
, mkDerivation
|
, lib
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, cmake
|
, cmake
|
||||||
, ninja
|
, ninja
|
||||||
@ -7,7 +7,7 @@
|
|||||||
, jdk
|
, jdk
|
||||||
, zlib
|
, zlib
|
||||||
, file
|
, file
|
||||||
, makeWrapper
|
, wrapQtAppsHook
|
||||||
, xorg
|
, xorg
|
||||||
, libpulseaudio
|
, libpulseaudio
|
||||||
, qtbase
|
, qtbase
|
||||||
@ -18,7 +18,6 @@
|
|||||||
, self
|
, self
|
||||||
, version
|
, version
|
||||||
, libnbtplusplus
|
, libnbtplusplus
|
||||||
, quazip
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -37,41 +36,34 @@ let
|
|||||||
gameLibraryPath = libpath + ":/run/opengl-driver/lib";
|
gameLibraryPath = libpath + ":/run/opengl-driver/lib";
|
||||||
in
|
in
|
||||||
|
|
||||||
mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "polymc";
|
pname = "polymc";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = lib.cleanSource self;
|
src = lib.cleanSource self;
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ninja file makeWrapper ];
|
nativeBuildInputs = [ cmake ninja jdk file wrapQtAppsHook ];
|
||||||
buildInputs = [ qtbase jdk zlib ];
|
buildInputs = [ qtbase quazip zlib ];
|
||||||
|
|
||||||
dontWrapQtApps = true;
|
dontWrapQtApps = true;
|
||||||
|
|
||||||
postPatch = lib.optionalString (msaClientID != "") ''
|
|
||||||
# add client ID
|
|
||||||
substituteInPlace CMakeLists.txt \
|
|
||||||
--replace '17b47edd-c884-4997-926d-9e7f9a6b4647' '${msaClientID}'
|
|
||||||
'';
|
|
||||||
|
|
||||||
postUnpack = ''
|
postUnpack = ''
|
||||||
# Copy submodules inputs
|
# Copy libnbtplusplus
|
||||||
rm -rf source/libraries/{libnbtplusplus,quazip}
|
rm -rf source/libraries/libnbtplusplus
|
||||||
mkdir source/libraries/{libnbtplusplus,quazip}
|
mkdir source/libraries/libnbtplusplus
|
||||||
cp -a ${libnbtplusplus}/* source/libraries/libnbtplusplus
|
cp -a ${libnbtplusplus}/* source/libraries/libnbtplusplus
|
||||||
cp -a ${quazip}/* source/libraries/quazip
|
chmod a+r+w source/libraries/libnbtplusplus/*
|
||||||
chmod a+r+w source/libraries/{libnbtplusplus,quazip}/*
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-GNinja"
|
"-GNinja"
|
||||||
"-DLauncher_PORTABLE=OFF"
|
"-DENABLE_LTO=on"
|
||||||
];
|
"-DLauncher_QT_VERSION_MAJOR=${lib.versions.major qtbase.version}"
|
||||||
|
] ++ lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
||||||
wrapProgram $out/bin/polymc \
|
wrapQtApp $out/bin/polymc \
|
||||||
"''${qtWrapperArgs[@]}" \
|
|
||||||
--set GAME_LIBRARY_PATH ${gameLibraryPath} \
|
--set GAME_LIBRARY_PATH ${gameLibraryPath} \
|
||||||
--prefix POLYMC_JAVA_PATHS : ${jdk}/lib/openjdk/bin/java:${jdk8}/lib/openjdk/bin/java \
|
--prefix POLYMC_JAVA_PATHS : ${jdk}/lib/openjdk/bin/java:${jdk8}/lib/openjdk/bin/java \
|
||||||
--prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]}
|
--prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]}
|
@ -1,9 +1,9 @@
|
|||||||
let
|
let
|
||||||
lock = builtins.fromJSON (builtins.readFile ../../flake.lock);
|
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
|
||||||
inherit (lock.nodes.flake-compat.locked) rev narHash;
|
inherit (lock.nodes.flake-compat.locked) rev narHash;
|
||||||
flake-compat = fetchTarball {
|
flake-compat = fetchTarball {
|
||||||
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz";
|
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz";
|
||||||
sha256 = narHash;
|
sha256 = narHash;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
import flake-compat { src = ../..; }
|
import flake-compat { src = ../.; }
|
Loading…
x
Reference in New Issue
Block a user