Merge pull request #888 from Scrumplex/nix-stuff
This commit is contained in:
commit
84e91ec3b5
4
.gitignore
vendored
4
.gitignore
vendored
@ -22,6 +22,10 @@ Debug
|
|||||||
build
|
build
|
||||||
/build-*
|
/build-*
|
||||||
|
|
||||||
|
# direnv / Nix
|
||||||
|
.direnv/
|
||||||
|
.pre-commit-config.yaml
|
||||||
|
|
||||||
# Install dirs
|
# Install dirs
|
||||||
install
|
install
|
||||||
/install-*
|
/install-*
|
||||||
|
52
BUILD.md
52
BUILD.md
@ -1,53 +1,3 @@
|
|||||||
# Build Instructions
|
# Build Instructions
|
||||||
|
|
||||||
Full build instructions will be available on [the website](https://prismlauncher.org/wiki/development/build-instructions/).
|
Full build instructions are available on [the website](https://prismlauncher.org/wiki/development/build-instructions/).
|
||||||
|
|
||||||
If you would like to contribute or fix an issue with the Build instructions you will be able to do so [here](https://github.com/PrismLauncher/website/blob/master/src/wiki/development/build-instructions.md).
|
|
||||||
|
|
||||||
## Getting the source
|
|
||||||
|
|
||||||
Clone the source code using git, and grab all the submodules. This is generic for all platforms you want to build on.
|
|
||||||
```
|
|
||||||
git clone --recursive https://github.com/PrismLauncher/PrismLauncher
|
|
||||||
cd PrismLauncher
|
|
||||||
```
|
|
||||||
|
|
||||||
## Linux
|
|
||||||
|
|
||||||
This guide will mostly mention dependant packages by their Debian naming and commands are done by a user in the sudoers file.
|
|
||||||
### Dependencies
|
|
||||||
|
|
||||||
- A C++ compiler capable of building C++17 code (can be found in the package `build-essential`).
|
|
||||||
- Qt Development tools 5.12 or newer (on Debian 11 or Debian-based distributions, `qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5`).
|
|
||||||
- `cmake` 3.15 or newer.
|
|
||||||
- `extra-cmake-modules`.
|
|
||||||
- zlib (`zlib1g-dev` on Debian 11 or Debian-based distributions).
|
|
||||||
- Java Development Kit (Java JDK) (`openjdk-17-jdk` on Debian 11 or Debian-based distributions).
|
|
||||||
- Mesa GL headers (`libgl1-mesa-dev` on Debian 11 or Debian-based distributions).
|
|
||||||
- (Optional) `scdoc` to generate man pages.
|
|
||||||
|
|
||||||
In conclusion, to check if all you need is installed (including optional):
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt install build-essential qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5 cmake extra-cmake-modules zlib1g-dev openjdk-17-jdk libgl1-mesa-dev scdoc
|
|
||||||
```
|
|
||||||
|
|
||||||
### Compiling
|
|
||||||
#### Building and installing on the system
|
|
||||||
This is usually the suggested way to build the client.
|
|
||||||
|
|
||||||
```
|
|
||||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/usr" -DENABLE_LTO=ON
|
|
||||||
cmake --build build -j$(nproc)
|
|
||||||
sudo cmake --install build
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Building a portable binary
|
|
||||||
|
|
||||||
```
|
|
||||||
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install
|
|
||||||
cmake --build build -j$(nproc)
|
|
||||||
cmake --install build
|
|
||||||
cmake --install build --component portable
|
|
||||||
```
|
|
||||||
|
|
||||||
|
110
flake.lock
generated
110
flake.lock
generated
@ -3,11 +3,11 @@
|
|||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1668681692,
|
"lastModified": 1673956053,
|
||||||
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||||
"owner": "edolstra",
|
"owner": "edolstra",
|
||||||
"repo": "flake-compat",
|
"repo": "flake-compat",
|
||||||
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -16,6 +16,58 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-compat_2": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1673956053,
|
||||||
|
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676283394,
|
||||||
|
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"pre-commit-hooks",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1660459072,
|
||||||
|
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"libnbtplusplus": {
|
"libnbtplusplus": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@ -34,11 +86,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1671417167,
|
"lastModified": 1678693419,
|
||||||
"narHash": "sha256-JkHam6WQOwZN1t2C2sbp1TqMv3TVRjzrdoejqfefwrM=",
|
"narHash": "sha256-bbSv5yqZAW6dz+3f3f3pOUZbxpPN+3OgCljgn7P+nnQ=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "bb31220cca6d044baa6dc2715b07497a2a7c4bc7",
|
"rev": "8e3fad82be64c06fbfb9fd43993aec9ef4623936",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -48,11 +100,55 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1673800717,
|
||||||
|
"narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-22.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre-commit-hooks": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat_2",
|
||||||
|
"flake-utils": [
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1678376203,
|
||||||
|
"narHash": "sha256-3tyYGyC8h7fBwncLZy5nCUjTJPrHbmNwp47LlNLOHSM=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"rev": "1a20b9708962096ec2481eeb2ddca29ed747770a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
"libnbtplusplus": "libnbtplusplus",
|
"libnbtplusplus": "libnbtplusplus",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"pre-commit-hooks": "pre-commit-hooks"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
94
flake.nix
94
flake.nix
@ -3,35 +3,89 @@
|
|||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
libnbtplusplus = { url = "github:PrismLauncher/libnbtplusplus"; flake = false; };
|
pre-commit-hooks = {
|
||||||
|
url = "github:cachix/pre-commit-hooks.nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.flake-utils.follows = "flake-utils";
|
||||||
|
};
|
||||||
|
flake-compat = {
|
||||||
|
url = "github:edolstra/flake-compat";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
libnbtplusplus = {
|
||||||
|
url = "github:PrismLauncher/libnbtplusplus";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, libnbtplusplus, ... }:
|
outputs = {
|
||||||
let
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
pre-commit-hooks,
|
||||||
|
libnbtplusplus,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
# User-friendly version number.
|
# User-friendly version number.
|
||||||
version = builtins.substring 0 8 self.lastModifiedDate;
|
version = builtins.substring 0 8 self.lastModifiedDate;
|
||||||
|
|
||||||
# Supported systems (qtbase is currently broken for "aarch64-darwin")
|
# Supported systems (qtbase is currently broken for "aarch64-darwin")
|
||||||
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ];
|
supportedSystems = with flake-utils.lib.system; [
|
||||||
|
x86_64-linux
|
||||||
|
x86_64-darwin
|
||||||
|
aarch64-linux
|
||||||
|
];
|
||||||
|
|
||||||
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
|
packagesFn = pkgs: {
|
||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
prismlauncher-qt5 = pkgs.libsForQt5.callPackage ./nix {
|
||||||
|
inherit version self libnbtplusplus;
|
||||||
# Nixpkgs instantiated for supported systems.
|
};
|
||||||
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
prismlauncher = pkgs.qt6Packages.callPackage ./nix {
|
||||||
|
inherit version self libnbtplusplus;
|
||||||
packagesFn = pkgs: rec {
|
};
|
||||||
prismlauncher-qt5 = pkgs.libsForQt5.callPackage ./nix { inherit version self libnbtplusplus; };
|
|
||||||
prismlauncher = pkgs.qt6Packages.callPackage ./nix { inherit version self libnbtplusplus; };
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
flake-utils.lib.eachSystem supportedSystems (system: let
|
||||||
packages = forAllSystems (system:
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
let packages = packagesFn pkgs.${system}; in
|
in {
|
||||||
packages // { default = packages.prismlauncher; }
|
checks = {
|
||||||
);
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||||
|
src = ./.;
|
||||||
|
hooks = {
|
||||||
|
markdownlint.enable = true;
|
||||||
|
|
||||||
overlay = final: packagesFn;
|
alejandra.enable = true;
|
||||||
|
deadnix.enable = true;
|
||||||
|
|
||||||
|
clang-format = {
|
||||||
|
enable =
|
||||||
|
false; # As most of the codebase is **not** formatted, we don't want clang-format yet
|
||||||
|
types_or = ["c" "c++"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
packages = let
|
||||||
|
packages = packagesFn pkgs;
|
||||||
|
in
|
||||||
|
packages // {default = packages.prismlauncher;};
|
||||||
|
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||||
|
packages = with pkgs; [
|
||||||
|
nodePackages.markdownlint-cli
|
||||||
|
alejandra
|
||||||
|
deadnix
|
||||||
|
clang-tools
|
||||||
|
];
|
||||||
|
|
||||||
|
inputsFrom = [self.packages.${system}.default];
|
||||||
|
buildInputs = with pkgs; [ccache ninja];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
// {
|
||||||
|
overlays.default = final: _: (packagesFn final);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ Configurable settings storage, Twitter XAuth specialization, new demos, cleanups
|
|||||||
|
|
||||||
> "Hi Akos,
|
> "Hi Akos,
|
||||||
>
|
>
|
||||||
> I'm writing this mail to confirm that my contributions to the O2 library, available here https://github.com/pipacs/o2, can be freely distributed according to the project's license (as shown in the LICENSE file).
|
> I'm writing this mail to confirm that my contributions to the O2 library, available here <https://github.com/pipacs/o2>, can be freely distributed according to the project's license (as shown in the LICENSE file).
|
||||||
>
|
>
|
||||||
> Regards,
|
> Regards,
|
||||||
> -mandeep"
|
> -mandeep"
|
||||||
|
@ -1,33 +1,32 @@
|
|||||||
{ lib
|
{
|
||||||
, stdenv
|
lib,
|
||||||
, cmake
|
stdenv,
|
||||||
, jdk8
|
cmake,
|
||||||
, jdk17
|
jdk8,
|
||||||
, zlib
|
jdk17,
|
||||||
, file
|
zlib,
|
||||||
, wrapQtAppsHook
|
file,
|
||||||
, xorg
|
wrapQtAppsHook,
|
||||||
, libpulseaudio
|
xorg,
|
||||||
, qtbase
|
libpulseaudio,
|
||||||
, qtsvg
|
qtbase,
|
||||||
, qtwayland
|
qtsvg,
|
||||||
, libGL
|
qtwayland,
|
||||||
, quazip
|
libGL,
|
||||||
, glfw
|
quazip,
|
||||||
, openal
|
glfw,
|
||||||
, extra-cmake-modules
|
openal,
|
||||||
, tomlplusplus
|
extra-cmake-modules,
|
||||||
, ghc_filesystem
|
tomlplusplus,
|
||||||
, cmark
|
ghc_filesystem,
|
||||||
, msaClientID ? ""
|
cmark,
|
||||||
, jdks ? [ jdk17 jdk8 ]
|
msaClientID ? "",
|
||||||
|
jdks ? [jdk17 jdk8],
|
||||||
# flake
|
# flake
|
||||||
, self
|
self,
|
||||||
, version
|
version,
|
||||||
, libnbtplusplus
|
libnbtplusplus,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "prismlauncher";
|
pname = "prismlauncher";
|
||||||
inherit version;
|
inherit version;
|
||||||
@ -35,7 +34,8 @@ stdenv.mkDerivation rec {
|
|||||||
src = lib.cleanSource self;
|
src = lib.cleanSource self;
|
||||||
|
|
||||||
nativeBuildInputs = [extra-cmake-modules cmake file jdk17 wrapQtAppsHook];
|
nativeBuildInputs = [extra-cmake-modules cmake file jdk17 wrapQtAppsHook];
|
||||||
buildInputs = [
|
buildInputs =
|
||||||
|
[
|
||||||
qtbase
|
qtbase
|
||||||
qtsvg
|
qtsvg
|
||||||
zlib
|
zlib
|
||||||
@ -43,9 +43,11 @@ stdenv.mkDerivation rec {
|
|||||||
ghc_filesystem
|
ghc_filesystem
|
||||||
tomlplusplus
|
tomlplusplus
|
||||||
cmark
|
cmark
|
||||||
] ++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland;
|
]
|
||||||
|
++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland;
|
||||||
|
|
||||||
cmakeFlags = lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ]
|
cmakeFlags =
|
||||||
|
lib.optionals (msaClientID != "") ["-DLauncher_MSA_CLIENT_ID=${msaClientID}"]
|
||||||
++ lib.optionals (lib.versionOlder qtbase.version "6") ["-DLauncher_QT_VERSION_MAJOR=5"];
|
++ lib.optionals (lib.versionOlder qtbase.version "6") ["-DLauncher_QT_VERSION_MAJOR=5"];
|
||||||
dontWrapQtApps = true;
|
dontWrapQtApps = true;
|
||||||
|
|
||||||
@ -57,8 +59,7 @@ stdenv.mkDerivation rec {
|
|||||||
chown -R $USER: source/libraries/libnbtplusplus
|
chown -R $USER: source/libraries/libnbtplusplus
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall =
|
postInstall = let
|
||||||
let
|
|
||||||
libpath = with xorg;
|
libpath = with xorg;
|
||||||
lib.makeLibraryPath [
|
lib.makeLibraryPath [
|
||||||
libX11
|
libX11
|
||||||
@ -72,8 +73,7 @@ stdenv.mkDerivation rec {
|
|||||||
openal
|
openal
|
||||||
stdenv.cc.cc.lib
|
stdenv.cc.cc.lib
|
||||||
];
|
];
|
||||||
in
|
in ''
|
||||||
''
|
|
||||||
# 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
|
||||||
wrapQtApp $out/bin/prismlauncher \
|
wrapQtApp $out/bin/prismlauncher \
|
||||||
--set LD_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \
|
--set LD_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \
|
||||||
@ -81,7 +81,6 @@ stdenv.mkDerivation rec {
|
|||||||
--prefix PATH : ${lib.makeBinPath [xorg.xrandr]}
|
--prefix PATH : ${lib.makeBinPath [xorg.xrandr]}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://prismlauncher.org/";
|
homepage = "https://prismlauncher.org/";
|
||||||
description = "A free, open source launcher for Minecraft";
|
description = "A free, open source launcher for Minecraft";
|
||||||
|
Loading…
Reference in New Issue
Block a user