Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into metadata2
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
commit
465c9498d4
23
default.nix
23
default.nix
@ -1,14 +1,9 @@
|
||||
(
|
||||
import
|
||||
(
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
in
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
)
|
||||
{src = ./.;}
|
||||
)
|
||||
.defaultNix
|
||||
(import (
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
in
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
) { src = ./.; }).defaultNix
|
||||
|
88
flake.lock
generated
88
flake.lock
generated
@ -16,47 +16,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722555600,
|
||||
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"pre-commit-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"libnbtplusplus": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@ -73,6 +32,21 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-filter": {
|
||||
"locked": {
|
||||
"lastModified": 1710156097,
|
||||
"narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=",
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"rev": "3342559a24e85fc164b295c3444e8a139924675b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1723637854,
|
||||
@ -89,40 +63,12 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"flake-compat"
|
||||
],
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1723803910,
|
||||
"narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-parts": "flake-parts",
|
||||
"libnbtplusplus": "libnbtplusplus",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
"nix-filter": "nix-filter",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
139
flake.nix
139
flake.nix
@ -2,52 +2,121 @@
|
||||
description = "A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once (Fork of MultiMC)";
|
||||
|
||||
nixConfig = {
|
||||
extra-substituters = ["https://cache.garnix.io"];
|
||||
extra-trusted-public-keys = ["cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="];
|
||||
extra-substituters = [ "https://cache.garnix.io" ];
|
||||
extra-trusted-public-keys = [ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ];
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-parts = {
|
||||
url = "github:hercules-ci/flake-parts";
|
||||
inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||
};
|
||||
pre-commit-hooks = {
|
||||
url = "github:cachix/pre-commit-hooks.nix";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
nixpkgs-stable.follows = "nixpkgs";
|
||||
flake-compat.follows = "flake-compat";
|
||||
};
|
||||
};
|
||||
flake-compat = {
|
||||
url = "github:edolstra/flake-compat";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
libnbtplusplus = {
|
||||
url = "github:PrismLauncher/libnbtplusplus";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nix-filter.url = "github:numtide/nix-filter";
|
||||
|
||||
/*
|
||||
Inputs below this are optional and can be removed
|
||||
|
||||
```
|
||||
{
|
||||
inputs.prismlauncher = {
|
||||
url = "github:PrismLauncher/PrismLauncher";
|
||||
inputs = {
|
||||
flake-compat.follows = "";
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
*/
|
||||
|
||||
flake-compat = {
|
||||
url = "github:edolstra/flake-compat";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
flake-parts,
|
||||
pre-commit-hooks,
|
||||
...
|
||||
} @ inputs:
|
||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
imports = [
|
||||
pre-commit-hooks.flakeModule
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
libnbtplusplus,
|
||||
nix-filter,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
./nix/dev.nix
|
||||
./nix/distribution.nix
|
||||
];
|
||||
# While we only officially support aarch and x86_64 on Linux and MacOS,
|
||||
# we expose a reasonable amount of other systems for users who want to
|
||||
# build for most exotic platforms
|
||||
systems = lib.systems.flakeExposed;
|
||||
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
forAllSystems = lib.genAttrs systems;
|
||||
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
||||
in
|
||||
{
|
||||
checks = forAllSystems (
|
||||
system:
|
||||
let
|
||||
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix { inherit self; };
|
||||
in
|
||||
lib.filterAttrs (_: lib.isDerivation) checks'
|
||||
);
|
||||
|
||||
devShells = forAllSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgsFor.${system};
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
inputsFrom = [ self.packages.${system}.prismlauncher-unwrapped ];
|
||||
buildInputs = with pkgs; [
|
||||
ccache
|
||||
ninja
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
|
||||
|
||||
overlays.default =
|
||||
final: prev:
|
||||
let
|
||||
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
|
||||
in
|
||||
{
|
||||
prismlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix {
|
||||
inherit
|
||||
libnbtplusplus
|
||||
nix-filter
|
||||
self
|
||||
version
|
||||
;
|
||||
};
|
||||
|
||||
prismlauncher = final.callPackage ./nix/wrapper.nix { };
|
||||
};
|
||||
|
||||
packages = forAllSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgsFor.${system};
|
||||
|
||||
# Build a scope from our overlay
|
||||
prismPackages = lib.makeScope pkgs.newScope (final: self.overlays.default final pkgs);
|
||||
|
||||
# Grab our packages from it and set the default
|
||||
packages = {
|
||||
inherit (prismPackages) prismlauncher-unwrapped prismlauncher;
|
||||
default = prismPackages.prismlauncher;
|
||||
};
|
||||
in
|
||||
# Only output them if they're available on the current system
|
||||
lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages
|
||||
);
|
||||
};
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
builds:
|
||||
exclude:
|
||||
# Currently broken on Garnix's end
|
||||
- "*.x86_64-darwin.*"
|
||||
include:
|
||||
- "checks.x86_64-linux.*"
|
||||
- "devShells.*.*"
|
||||
- "packages.*.*"
|
||||
- "packages.x86_64-linux.*"
|
||||
- "packages.aarch64-linux.*"
|
||||
- "packages.x86_64-darwin.*"
|
||||
- "packages.aarch64-darwin.*"
|
||||
|
@ -403,12 +403,17 @@ QList<QString> JavaUtils::FindJavaPaths()
|
||||
{
|
||||
QList<QString> javas;
|
||||
javas.append(this->GetDefaultJava()->path);
|
||||
auto scanJavaDir = [&](const QString& dirPath) {
|
||||
auto scanJavaDir = [&](
|
||||
const QString& dirPath,
|
||||
const std::function<bool(const QFileInfo&)>& filter = [](const QFileInfo&) { return true; }) {
|
||||
QDir dir(dirPath);
|
||||
if (!dir.exists())
|
||||
return;
|
||||
auto entries = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
for (auto& entry : entries) {
|
||||
if (!filter(entry))
|
||||
continue;
|
||||
|
||||
QString prefix;
|
||||
prefix = entry.canonicalFilePath();
|
||||
javas.append(FS::PathCombine(prefix, "jre/bin/java"));
|
||||
@ -431,9 +436,13 @@ QList<QString> JavaUtils::FindJavaPaths()
|
||||
scanJavaDirs("/usr/lib64/jvm");
|
||||
scanJavaDirs("/usr/lib32/jvm");
|
||||
// Gentoo's locations for openjdk and openjdk-bin respectively
|
||||
scanJavaDir("/usr/lib64");
|
||||
scanJavaDir("/usr/lib");
|
||||
scanJavaDir("/opt");
|
||||
auto gentooFilter = [](const QFileInfo& info) {
|
||||
QString fileName = info.fileName();
|
||||
return fileName.startsWith("openjdk-") || fileName.startsWith("openj9-");
|
||||
};
|
||||
scanJavaDir("/usr/lib64", gentooFilter);
|
||||
scanJavaDir("/usr/lib", gentooFilter);
|
||||
scanJavaDir("/opt", gentooFilter);
|
||||
// javas stored in Prism Launcher's folder
|
||||
scanJavaDirs("java");
|
||||
// manually installed JDKs in /opt
|
||||
|
@ -384,11 +384,11 @@ bool ModrinthCreationTask::parseManifest(const QString& index_path,
|
||||
hash = Json::ensureString(hashes, "sha512");
|
||||
hashAlgorithm = QCryptographicHash::Sha512;
|
||||
if (hash.isEmpty()) {
|
||||
hash = Json::ensureString(hashes, "sha1");
|
||||
hashAlgorithm = QCryptographicHash::Sha1;
|
||||
hash = Json::ensureString(hashes, "sha256");
|
||||
hashAlgorithm = QCryptographicHash::Sha256;
|
||||
if (hash.isEmpty()) {
|
||||
hash = Json::ensureString(hashes, "sha256");
|
||||
hashAlgorithm = QCryptographicHash::Sha256;
|
||||
hash = Json::ensureString(hashes, "sha1");
|
||||
hashAlgorithm = QCryptographicHash::Sha1;
|
||||
if (hash.isEmpty()) {
|
||||
throw JSONValidationError("No hash found for: " + file.path);
|
||||
}
|
||||
|
@ -40,11 +40,11 @@
|
||||
#include "HintOverrideProxyStyle.h"
|
||||
#include "ThemeManager.h"
|
||||
|
||||
SystemTheme::SystemTheme(QString& styleName, bool isSystemTheme)
|
||||
SystemTheme::SystemTheme(const QString& styleName, const QPalette& palette, bool isDefaultTheme)
|
||||
{
|
||||
themeName = isSystemTheme ? "system" : styleName;
|
||||
themeName = isDefaultTheme ? "system" : styleName;
|
||||
widgetTheme = styleName;
|
||||
colorPalette = QApplication::palette();
|
||||
colorPalette = palette;
|
||||
}
|
||||
|
||||
void SystemTheme::apply(bool initial)
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
class SystemTheme : public ITheme {
|
||||
public:
|
||||
SystemTheme(QString& themeName, bool isSystemTheme = false);
|
||||
SystemTheme(const QString& styleName, const QPalette& palette, bool isDefaultTheme);
|
||||
virtual ~SystemTheme() {}
|
||||
void apply(bool initial) override;
|
||||
|
||||
|
@ -36,6 +36,13 @@
|
||||
|
||||
ThemeManager::ThemeManager()
|
||||
{
|
||||
themeDebugLog() << "Determining System Widget Theme...";
|
||||
const auto& style = QApplication::style();
|
||||
m_defaultStyle = style->objectName();
|
||||
themeDebugLog() << "System theme seems to be:" << m_defaultStyle;
|
||||
|
||||
m_defaultPalette = QApplication::palette();
|
||||
|
||||
initializeThemes();
|
||||
initializeCatPacks();
|
||||
}
|
||||
@ -121,13 +128,8 @@ void ThemeManager::initializeIcons()
|
||||
|
||||
void ThemeManager::initializeWidgets()
|
||||
{
|
||||
themeDebugLog() << "Determining System Widget Theme...";
|
||||
const auto& style = QApplication::style();
|
||||
m_currentlySelectedSystemTheme = style->objectName();
|
||||
themeDebugLog() << "System theme seems to be:" << m_currentlySelectedSystemTheme;
|
||||
|
||||
themeDebugLog() << "<> Initializing Widget Themes";
|
||||
themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique<SystemTheme>(m_currentlySelectedSystemTheme, true));
|
||||
themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique<SystemTheme>(m_defaultStyle, m_defaultPalette, true));
|
||||
auto darkThemeId = addTheme(std::make_unique<DarkTheme>());
|
||||
themeDebugLog() << "Loading Built-in Theme:" << darkThemeId;
|
||||
themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique<BrightTheme>());
|
||||
@ -140,7 +142,7 @@ void ThemeManager::initializeWidgets()
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
themeDebugLog() << "Loading System Theme:" << addTheme(std::make_unique<SystemTheme>(st));
|
||||
themeDebugLog() << "Loading System Theme:" << addTheme(std::make_unique<SystemTheme>(st, m_defaultPalette, false));
|
||||
}
|
||||
|
||||
// TODO: need some way to differentiate same name themes in different subdirectories
|
||||
@ -260,7 +262,7 @@ void ThemeManager::applyCurrentlySelectedTheme(bool initial)
|
||||
themeDebugLog() << "<> Icon theme set.";
|
||||
auto applicationTheme = settings->get("ApplicationTheme").toString();
|
||||
if (applicationTheme == "") {
|
||||
applicationTheme = m_currentlySelectedSystemTheme;
|
||||
applicationTheme = m_defaultStyle;
|
||||
}
|
||||
setApplicationTheme(applicationTheme, initial);
|
||||
themeDebugLog() << "<> Application theme set.";
|
||||
|
@ -66,7 +66,8 @@ class ThemeManager {
|
||||
QDir m_applicationThemeFolder{ "themes" };
|
||||
QDir m_catPacksFolder{ "catpacks" };
|
||||
std::map<QString, std::unique_ptr<CatPack>> m_catPacks;
|
||||
QString m_currentlySelectedSystemTheme;
|
||||
QString m_defaultStyle;
|
||||
QPalette m_defaultPalette;
|
||||
LogColors m_logColors;
|
||||
|
||||
void initializeThemes();
|
||||
|
130
nix/README.md
130
nix/README.md
@ -15,7 +15,6 @@ to temporarily enable it when using `nix` commands.
|
||||
Example (NixOS):
|
||||
|
||||
```nix
|
||||
{...}:
|
||||
{
|
||||
nix.settings = {
|
||||
trusted-substituters = [
|
||||
@ -29,9 +28,9 @@ Example (NixOS):
|
||||
}
|
||||
```
|
||||
|
||||
### Using the overlay
|
||||
### Installing the package directly
|
||||
|
||||
After adding `github:PrismLauncher/PrismLauncher` to your flake inputs, you can add the `default` overlay to your nixpkgs instance.
|
||||
After adding `github:PrismLauncher/PrismLauncher` to your flake inputs, you can access the flake's `packages` output.
|
||||
|
||||
Example:
|
||||
|
||||
@ -39,34 +38,47 @@ Example:
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
prismlauncher = {
|
||||
url = "github:PrismLauncher/PrismLauncher";
|
||||
|
||||
# Optional: Override the nixpkgs input of prismlauncher to use the same revision as the rest of your flake
|
||||
# Note that overriding any input of prismlauncher may break reproducibility
|
||||
# Note that this may break the reproducibility mentioned above, and you might not be able to access the binary cache
|
||||
#
|
||||
# inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# This is not required for Flakes
|
||||
inputs.flake-compat.follows = "";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {nixpkgs, prismlauncher}: {
|
||||
nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
outputs =
|
||||
{ nixpkgs, prismlauncher, ... }:
|
||||
{
|
||||
nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
./configuration.nix
|
||||
|
||||
modules = [
|
||||
({pkgs, ...}: {
|
||||
nixpkgs.overlays = [prismlauncher.overlays.default];
|
||||
|
||||
environment.systemPackages = [pkgs.prismlauncher];
|
||||
})
|
||||
];
|
||||
(
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [ prismlauncher.packages.${pkgs.system}.prismlauncher ];
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Installing the package directly
|
||||
### Using the overlay
|
||||
|
||||
Alternatively, if you don't want to use an overlay, you can install Prism Launcher directly by installing the `prismlauncher` package.
|
||||
This way the installed package is fully reproducible.
|
||||
Alternatively, if you don't want to use our `packages` output, you can add our overlay to your nixpkgs instance.
|
||||
This will ensure Prism is built with your system's packages.
|
||||
|
||||
> [!WARNING]
|
||||
> Depending on what revision of nixpkgs your system uses, this may result in binaries that differ from the above `packages` output
|
||||
> If this is the case, you will not be able to use the binary cache
|
||||
|
||||
Example:
|
||||
|
||||
@ -74,25 +86,38 @@ Example:
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
prismlauncher = {
|
||||
url = "github:PrismLauncher/PrismLauncher";
|
||||
|
||||
# Optional: Override the nixpkgs input of prismlauncher to use the same revision as the rest of your flake
|
||||
# Note that overriding any input of prismlauncher may break reproducibility
|
||||
# Note that this may break the reproducibility mentioned above, and you might not be able to access the binary cache
|
||||
#
|
||||
# inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# This is not required for Flakes
|
||||
inputs.flake-compat.follows = "";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {nixpkgs, prismlauncher}: {
|
||||
nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
outputs =
|
||||
{ nixpkgs, prismlauncher, ... }:
|
||||
{
|
||||
nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
./configuration.nix
|
||||
|
||||
modules = [
|
||||
({pkgs, ...}: {
|
||||
environment.systemPackages = [prismlauncher.packages.${pkgs.system}.prismlauncher];
|
||||
})
|
||||
];
|
||||
(
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
nixpkgs.overlays = [ prismlauncher.overlays.default ];
|
||||
|
||||
environment.systemPackages = [ pkgs.prismlauncher ];
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -118,7 +143,6 @@ If you want to avoid rebuilds you may add the garnix cache to your substitutors.
|
||||
Example (NixOS):
|
||||
|
||||
```nix
|
||||
{...}:
|
||||
{
|
||||
nix.settings = {
|
||||
trusted-substituters = [
|
||||
@ -132,30 +156,40 @@ Example (NixOS):
|
||||
}
|
||||
```
|
||||
|
||||
### Using the overlay (`fetchTarball`)
|
||||
### Installing the package directly (`fetchTarball`)
|
||||
|
||||
We use flake-compat to allow using this Flake on a system that doesn't use flakes.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
{pkgs, ...}: {
|
||||
nixpkgs.overlays = [(import (builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz")).overlays.default];
|
||||
|
||||
environment.systemPackages = [pkgs.prismlauncher];
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [
|
||||
(import (
|
||||
builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz"
|
||||
)).packages.${pkgs.system}.prismlauncher
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### Installing the package directly (`fetchTarball`)
|
||||
### Using the overlay (`fetchTarball`)
|
||||
|
||||
Alternatively, if you don't want to use an overlay, you can install Prism Launcher directly by installing the `prismlauncher` package.
|
||||
This way the installed package is fully reproducible.
|
||||
Alternatively, if you don't want to use our `packages` output, you can add our overlay to your instance of nixpkgs.
|
||||
This results in Prism using your system's libraries
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
{pkgs, ...}: {
|
||||
environment.systemPackages = [(import (builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz")).packages.${pkgs.system}.prismlauncher];
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(import (
|
||||
builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz"
|
||||
)).overlays.default
|
||||
];
|
||||
|
||||
environment.systemPackages = [ pkgs.prismlauncher ];
|
||||
}
|
||||
```
|
||||
|
||||
@ -177,18 +211,20 @@ nix-env -iA prismlauncher.prismlauncher
|
||||
|
||||
Both Nixpkgs and this repository offer the following packages:
|
||||
|
||||
- `prismlauncher` - Preferred build using Qt 6
|
||||
- `prismlauncher-qt5` - Legacy build using Qt 5 (i.e. for Qt 5 theming support)
|
||||
|
||||
Both of these packages also have `-unwrapped` counterparts, that are not wrapped and can therefore be customized even further than what the wrapper packages offer.
|
||||
- `prismlauncher` - The preferred build, wrapped with everything necessary to run the launcher and Minecraft
|
||||
- `prismlauncher-unwrapped` - A minimal build that allows for advanced customization of the launcher's runtime environment
|
||||
|
||||
### Customizing wrapped packages
|
||||
|
||||
The wrapped packages (`prismlauncher` and `prismlauncher-qt5`) offer some build parameters to further customize the launcher's environment.
|
||||
The wrapped package (`prismlauncher`) offers some build parameters to further customize the launcher's environment.
|
||||
|
||||
The following parameters can be overridden:
|
||||
|
||||
- `msaClientID` (default: `null`, requires full rebuild!) Client ID used for Microsoft Authentication
|
||||
- `gamemodeSupport` (default: `true`) Turn on/off support for [Feral GameMode](https://github.com/FeralInteractive/gamemode)
|
||||
- `jdks` (default: `[ jdk17 jdk8 ]`) Java runtimes added to `PRISMLAUNCHER_JAVA_PATHS` variable
|
||||
- `additionalLibs` (default: `[ ]`) Additional libraries that will be added to `LD_LIBRARY_PATH`
|
||||
- `additionalPrograms` (default: `[ ]`) Additional libraries that will be added to `PATH`
|
||||
- `controllerSupport` (default: `isLinux`) Turn on/off support for controllers on Linux (macOS will always have this)
|
||||
- `gamemodeSupport` (default: `isLinux`) Turn on/off support for [Feral GameMode](https://github.com/FeralInteractive/gamemode) on Linux
|
||||
- `jdks` (default: `[ jdk21 jdk17 jdk8 ]`) Java runtimes added to `PRISMLAUNCHER_JAVA_PATHS` variable
|
||||
- `msaClientID` (default: `null`, requires full rebuild!) Client ID used for Microsoft Authentication
|
||||
- `textToSpeechSupport` (default: `isLinux`) Turn on/off support for text-to-speech on Linux (macOS will always have this)
|
||||
- `withWaylandGLFW` (default: `isLinux`) Build with support for native Wayland via a custom GLFW
|
||||
|
42
nix/checks.nix
Normal file
42
nix/checks.nix
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
runCommand,
|
||||
deadnix,
|
||||
llvmPackages_18,
|
||||
markdownlint-cli,
|
||||
nixfmt-rfc-style,
|
||||
statix,
|
||||
self,
|
||||
}:
|
||||
{
|
||||
formatting =
|
||||
runCommand "check-formatting"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
deadnix
|
||||
llvmPackages_18.clang-tools
|
||||
markdownlint-cli
|
||||
nixfmt-rfc-style
|
||||
statix
|
||||
];
|
||||
}
|
||||
''
|
||||
cd ${self}
|
||||
|
||||
echo "Running clang-format...."
|
||||
clang-format -i --style='file' --Werror */**.{c,cc,cpp,h,hh,hpp}
|
||||
|
||||
echo "Running deadnix..."
|
||||
deadnix --fail
|
||||
|
||||
echo "Running markdownlint..."
|
||||
markdownlint --dot .
|
||||
|
||||
echo "Running nixfmt..."
|
||||
nixfmt --check .
|
||||
|
||||
echo "Running statix"
|
||||
statix check .
|
||||
|
||||
touch $out
|
||||
'';
|
||||
}
|
36
nix/dev.nix
36
nix/dev.nix
@ -1,36 +0,0 @@
|
||||
{
|
||||
perSystem = {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
pre-commit.settings = {
|
||||
hooks = {
|
||||
markdownlint.enable = true;
|
||||
|
||||
alejandra.enable = true;
|
||||
deadnix.enable = true;
|
||||
nil.enable = true;
|
||||
|
||||
clang-format = {
|
||||
enable = true;
|
||||
types_or = ["c" "c++" "java" "json" "objective-c"];
|
||||
};
|
||||
};
|
||||
|
||||
tools.clang-tools = lib.mkForce pkgs.clang-tools_18;
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
shellHook = ''
|
||||
${config.pre-commit.installationScript}
|
||||
'';
|
||||
|
||||
inputsFrom = [config.packages.prismlauncher-unwrapped];
|
||||
buildInputs = with pkgs; [ccache ninja];
|
||||
};
|
||||
|
||||
formatter = pkgs.alejandra;
|
||||
};
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
{
|
||||
inputs,
|
||||
self,
|
||||
...
|
||||
}: {
|
||||
perSystem = {
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
packages = let
|
||||
ourPackages = lib.fix (final: self.overlays.default final pkgs);
|
||||
in {
|
||||
inherit
|
||||
(ourPackages)
|
||||
prismlauncher-unwrapped
|
||||
prismlauncher
|
||||
;
|
||||
default = ourPackages.prismlauncher;
|
||||
};
|
||||
};
|
||||
|
||||
flake = {
|
||||
overlays.default = final: prev: let
|
||||
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
|
||||
in {
|
||||
prismlauncher-unwrapped = prev.callPackage ./pkg {
|
||||
inherit (inputs) libnbtplusplus;
|
||||
inherit version;
|
||||
};
|
||||
|
||||
prismlauncher = prev.qt6Packages.callPackage ./pkg/wrapper.nix {
|
||||
inherit (final) prismlauncher-unwrapped;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
cmake,
|
||||
cmark,
|
||||
darwin,
|
||||
extra-cmake-modules,
|
||||
gamemode,
|
||||
ghc_filesystem,
|
||||
jdk17,
|
||||
kdePackages,
|
||||
ninja,
|
||||
stripJavaArchivesHook,
|
||||
tomlplusplus,
|
||||
zlib,
|
||||
msaClientID ? null,
|
||||
gamemodeSupport ? stdenv.isLinux,
|
||||
version,
|
||||
libnbtplusplus,
|
||||
}:
|
||||
assert lib.assertMsg (
|
||||
gamemodeSupport -> stdenv.isLinux
|
||||
) "gamemodeSupport is only available on Linux.";
|
||||
stdenv.mkDerivation {
|
||||
pname = "prismlauncher-unwrapped";
|
||||
inherit version;
|
||||
|
||||
src = lib.fileset.toSource {
|
||||
root = ../../.;
|
||||
fileset = lib.fileset.unions (map (fileName: ../../${fileName}) [
|
||||
"buildconfig"
|
||||
"cmake"
|
||||
"launcher"
|
||||
"libraries"
|
||||
"program_info"
|
||||
"tests"
|
||||
"COPYING.md"
|
||||
"CMakeLists.txt"
|
||||
]);
|
||||
};
|
||||
|
||||
postUnpack = ''
|
||||
rm -rf source/libraries/libnbtplusplus
|
||||
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
extra-cmake-modules
|
||||
jdk17
|
||||
stripJavaArchivesHook
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
[
|
||||
cmark
|
||||
ghc_filesystem
|
||||
kdePackages.qtbase
|
||||
kdePackages.qtnetworkauth
|
||||
kdePackages.quazip
|
||||
tomlplusplus
|
||||
zlib
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [darwin.apple_sdk.frameworks.Cocoa]
|
||||
++ lib.optional gamemodeSupport gamemode;
|
||||
|
||||
hardeningEnable = lib.optionals stdenv.isLinux ["pie"];
|
||||
|
||||
cmakeFlags =
|
||||
[
|
||||
(lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs")
|
||||
]
|
||||
++ lib.optionals (msaClientID != null) [
|
||||
(lib.cmakeFeature "Launcher_MSA_CLIENT_ID" (toString msaClientID))
|
||||
]
|
||||
++ lib.optionals (lib.versionOlder kdePackages.qtbase.version "6") [
|
||||
(lib.cmakeFeature "Launcher_QT_VERSION_MAJOR" "5")
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
# we wrap our binary manually
|
||||
(lib.cmakeFeature "INSTALL_BUNDLE" "nodeps")
|
||||
# disable built-in updater
|
||||
(lib.cmakeFeature "MACOSX_SPARKLE_UPDATE_FEED_URL" "''")
|
||||
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/Applications/")
|
||||
];
|
||||
|
||||
dontWrapQtApps = true;
|
||||
|
||||
meta = {
|
||||
description = "Free, open source launcher for Minecraft";
|
||||
longDescription = ''
|
||||
Allows you to have multiple, separate instances of Minecraft (each with
|
||||
their own mods, texture packs, saves, etc) and helps you manage them and
|
||||
their associated options with a simple interface.
|
||||
'';
|
||||
homepage = "https://prismlauncher.org/";
|
||||
license = lib.licenses.gpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
Scrumplex
|
||||
getchoo
|
||||
];
|
||||
mainProgram = "prismlauncher";
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
};
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
symlinkJoin,
|
||||
prismlauncher-unwrapped,
|
||||
addOpenGLRunpath,
|
||||
flite,
|
||||
gamemode,
|
||||
glfw,
|
||||
glfw-wayland-minecraft,
|
||||
glxinfo,
|
||||
jdk8,
|
||||
jdk17,
|
||||
jdk21,
|
||||
kdePackages,
|
||||
libGL,
|
||||
libpulseaudio,
|
||||
libusb1,
|
||||
makeWrapper,
|
||||
openal,
|
||||
pciutils,
|
||||
udev,
|
||||
vulkan-loader,
|
||||
xorg,
|
||||
additionalLibs ? [],
|
||||
additionalPrograms ? [],
|
||||
controllerSupport ? stdenv.isLinux,
|
||||
gamemodeSupport ? stdenv.isLinux,
|
||||
jdks ? [
|
||||
jdk21
|
||||
jdk17
|
||||
jdk8
|
||||
],
|
||||
msaClientID ? null,
|
||||
textToSpeechSupport ? stdenv.isLinux,
|
||||
# Adds `glfw-wayland-minecraft` to `LD_LIBRARY_PATH`
|
||||
# when launched on wayland, allowing for the game to be run natively.
|
||||
# Make sure to enable "Use system installation of GLFW" in instance settings
|
||||
# for this to take effect
|
||||
#
|
||||
# Warning: This build of glfw may be unstable, and the launcher
|
||||
# itself can take slightly longer to start
|
||||
withWaylandGLFW ? false,
|
||||
}:
|
||||
assert lib.assertMsg (
|
||||
controllerSupport -> stdenv.isLinux
|
||||
) "controllerSupport only has an effect on Linux.";
|
||||
assert lib.assertMsg (
|
||||
textToSpeechSupport -> stdenv.isLinux
|
||||
) "textToSpeechSupport only has an effect on Linux.";
|
||||
assert lib.assertMsg (
|
||||
withWaylandGLFW -> stdenv.isLinux
|
||||
) "withWaylandGLFW is only available on Linux."; let
|
||||
prismlauncher' = prismlauncher-unwrapped.override {inherit msaClientID gamemodeSupport;};
|
||||
in
|
||||
symlinkJoin {
|
||||
name = "prismlauncher-${prismlauncher'.version}";
|
||||
|
||||
paths = [prismlauncher'];
|
||||
|
||||
nativeBuildInputs =
|
||||
[kdePackages.wrapQtAppsHook]
|
||||
# purposefully using a shell wrapper here for variable expansion
|
||||
# see https://github.com/NixOS/nixpkgs/issues/172583
|
||||
++ lib.optional withWaylandGLFW makeWrapper;
|
||||
|
||||
buildInputs =
|
||||
[
|
||||
kdePackages.qtbase
|
||||
kdePackages.qtsvg
|
||||
]
|
||||
++ lib.optional (
|
||||
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux
|
||||
)
|
||||
kdePackages.qtwayland;
|
||||
|
||||
env = {
|
||||
waylandPreExec = lib.optionalString withWaylandGLFW ''
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
postBuild =
|
||||
lib.optionalString withWaylandGLFW ''
|
||||
qtWrapperArgs+=(--run "$waylandPreExec")
|
||||
''
|
||||
+ ''
|
||||
wrapQtAppsHook
|
||||
'';
|
||||
|
||||
qtWrapperArgs = let
|
||||
runtimeLibs =
|
||||
[
|
||||
# lwjgl
|
||||
glfw
|
||||
libpulseaudio
|
||||
libGL
|
||||
openal
|
||||
stdenv.cc.cc.lib
|
||||
|
||||
vulkan-loader # VulkanMod's lwjgl
|
||||
|
||||
udev # oshi
|
||||
|
||||
xorg.libX11
|
||||
xorg.libXext
|
||||
xorg.libXcursor
|
||||
xorg.libXrandr
|
||||
xorg.libXxf86vm
|
||||
]
|
||||
++ lib.optional textToSpeechSupport flite
|
||||
++ lib.optional gamemodeSupport gamemode.lib
|
||||
++ lib.optional controllerSupport libusb1
|
||||
++ additionalLibs;
|
||||
|
||||
runtimePrograms =
|
||||
[
|
||||
glxinfo
|
||||
pciutils # need lspci
|
||||
xorg.xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
||||
]
|
||||
++ additionalPrograms;
|
||||
in
|
||||
["--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"]
|
||||
++ lib.optionals stdenv.isLinux [
|
||||
"--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
|
||||
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
|
||||
];
|
||||
|
||||
meta = {
|
||||
inherit
|
||||
(prismlauncher'.meta)
|
||||
description
|
||||
longDescription
|
||||
homepage
|
||||
changelog
|
||||
license
|
||||
maintainers
|
||||
mainProgram
|
||||
platforms
|
||||
;
|
||||
};
|
||||
}
|
108
nix/unwrapped.nix
Normal file
108
nix/unwrapped.nix
Normal file
@ -0,0 +1,108 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
cmake,
|
||||
cmark,
|
||||
darwin,
|
||||
extra-cmake-modules,
|
||||
gamemode,
|
||||
ghc_filesystem,
|
||||
jdk17,
|
||||
kdePackages,
|
||||
ninja,
|
||||
nix-filter,
|
||||
self,
|
||||
stripJavaArchivesHook,
|
||||
tomlplusplus,
|
||||
zlib,
|
||||
msaClientID ? null,
|
||||
gamemodeSupport ? stdenv.isLinux,
|
||||
version,
|
||||
libnbtplusplus,
|
||||
}:
|
||||
|
||||
assert lib.assertMsg (
|
||||
gamemodeSupport -> stdenv.isLinux
|
||||
) "gamemodeSupport is only available on Linux.";
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "prismlauncher-unwrapped";
|
||||
inherit version;
|
||||
|
||||
src = nix-filter.lib {
|
||||
root = self;
|
||||
include = [
|
||||
"buildconfig"
|
||||
"cmake"
|
||||
"launcher"
|
||||
"libraries"
|
||||
"program_info"
|
||||
"tests"
|
||||
../COPYING.md
|
||||
../CMakeLists.txt
|
||||
];
|
||||
};
|
||||
|
||||
postUnpack = ''
|
||||
rm -rf source/libraries/libnbtplusplus
|
||||
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
extra-cmake-modules
|
||||
jdk17
|
||||
stripJavaArchivesHook
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
[
|
||||
cmark
|
||||
ghc_filesystem
|
||||
kdePackages.qtbase
|
||||
kdePackages.qtnetworkauth
|
||||
kdePackages.quazip
|
||||
tomlplusplus
|
||||
zlib
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
|
||||
++ lib.optional gamemodeSupport gamemode;
|
||||
|
||||
hardeningEnable = lib.optionals stdenv.isLinux [ "pie" ];
|
||||
|
||||
cmakeFlags =
|
||||
[ (lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs") ]
|
||||
++ lib.optionals (msaClientID != null) [
|
||||
(lib.cmakeFeature "Launcher_MSA_CLIENT_ID" (toString msaClientID))
|
||||
]
|
||||
++ lib.optionals (lib.versionOlder kdePackages.qtbase.version "6") [
|
||||
(lib.cmakeFeature "Launcher_QT_VERSION_MAJOR" "5")
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
# we wrap our binary manually
|
||||
(lib.cmakeFeature "INSTALL_BUNDLE" "nodeps")
|
||||
# disable built-in updater
|
||||
(lib.cmakeFeature "MACOSX_SPARKLE_UPDATE_FEED_URL" "''")
|
||||
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/Applications/")
|
||||
];
|
||||
|
||||
dontWrapQtApps = true;
|
||||
|
||||
meta = {
|
||||
description = "Free, open source launcher for Minecraft";
|
||||
longDescription = ''
|
||||
Allows you to have multiple, separate instances of Minecraft (each with
|
||||
their own mods, texture packs, saves, etc) and helps you manage them and
|
||||
their associated options with a simple interface.
|
||||
'';
|
||||
homepage = "https://prismlauncher.org/";
|
||||
license = lib.licenses.gpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
Scrumplex
|
||||
getchoo
|
||||
];
|
||||
mainProgram = "prismlauncher";
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
};
|
||||
}
|
147
nix/wrapper.nix
Normal file
147
nix/wrapper.nix
Normal file
@ -0,0 +1,147 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
symlinkJoin,
|
||||
prismlauncher-unwrapped,
|
||||
addOpenGLRunpath,
|
||||
flite,
|
||||
gamemode,
|
||||
glfw,
|
||||
glfw-wayland-minecraft,
|
||||
glxinfo,
|
||||
jdk8,
|
||||
jdk17,
|
||||
jdk21,
|
||||
kdePackages,
|
||||
libGL,
|
||||
libpulseaudio,
|
||||
libusb1,
|
||||
makeWrapper,
|
||||
openal,
|
||||
pciutils,
|
||||
udev,
|
||||
vulkan-loader,
|
||||
xorg,
|
||||
additionalLibs ? [ ],
|
||||
additionalPrograms ? [ ],
|
||||
controllerSupport ? stdenv.isLinux,
|
||||
gamemodeSupport ? stdenv.isLinux,
|
||||
jdks ? [
|
||||
jdk21
|
||||
jdk17
|
||||
jdk8
|
||||
],
|
||||
msaClientID ? null,
|
||||
textToSpeechSupport ? stdenv.isLinux,
|
||||
# Adds `glfw-wayland-minecraft` to `LD_LIBRARY_PATH`
|
||||
# when launched on wayland, allowing for the game to be run natively.
|
||||
# Make sure to enable "Use system installation of GLFW" in instance settings
|
||||
# for this to take effect
|
||||
#
|
||||
# Warning: This build of glfw may be unstable, and the launcher
|
||||
# itself can take slightly longer to start
|
||||
withWaylandGLFW ? false,
|
||||
}:
|
||||
|
||||
assert lib.assertMsg (
|
||||
controllerSupport -> stdenv.isLinux
|
||||
) "controllerSupport only has an effect on Linux.";
|
||||
|
||||
assert lib.assertMsg (
|
||||
textToSpeechSupport -> stdenv.isLinux
|
||||
) "textToSpeechSupport only has an effect on Linux.";
|
||||
|
||||
assert lib.assertMsg (
|
||||
withWaylandGLFW -> stdenv.isLinux
|
||||
) "withWaylandGLFW is only available on Linux.";
|
||||
|
||||
let
|
||||
prismlauncher' = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; };
|
||||
in
|
||||
symlinkJoin {
|
||||
name = "prismlauncher-${prismlauncher'.version}";
|
||||
|
||||
paths = [ prismlauncher' ];
|
||||
|
||||
nativeBuildInputs =
|
||||
[ kdePackages.wrapQtAppsHook ]
|
||||
# purposefully using a shell wrapper here for variable expansion
|
||||
# see https://github.com/NixOS/nixpkgs/issues/172583
|
||||
++ lib.optional withWaylandGLFW makeWrapper;
|
||||
|
||||
buildInputs =
|
||||
[
|
||||
kdePackages.qtbase
|
||||
kdePackages.qtsvg
|
||||
]
|
||||
++ lib.optional (
|
||||
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux
|
||||
) kdePackages.qtwayland;
|
||||
|
||||
env = {
|
||||
waylandPreExec = lib.optionalString withWaylandGLFW ''
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
postBuild =
|
||||
lib.optionalString withWaylandGLFW ''
|
||||
qtWrapperArgs+=(--run "$waylandPreExec")
|
||||
''
|
||||
+ ''
|
||||
wrapQtAppsHook
|
||||
'';
|
||||
|
||||
qtWrapperArgs =
|
||||
let
|
||||
runtimeLibs =
|
||||
[
|
||||
# lwjgl
|
||||
glfw
|
||||
libpulseaudio
|
||||
libGL
|
||||
openal
|
||||
stdenv.cc.cc.lib
|
||||
|
||||
vulkan-loader # VulkanMod's lwjgl
|
||||
|
||||
udev # oshi
|
||||
|
||||
xorg.libX11
|
||||
xorg.libXext
|
||||
xorg.libXcursor
|
||||
xorg.libXrandr
|
||||
xorg.libXxf86vm
|
||||
]
|
||||
++ lib.optional textToSpeechSupport flite
|
||||
++ lib.optional gamemodeSupport gamemode.lib
|
||||
++ lib.optional controllerSupport libusb1
|
||||
++ additionalLibs;
|
||||
|
||||
runtimePrograms = [
|
||||
glxinfo
|
||||
pciutils # need lspci
|
||||
xorg.xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
||||
] ++ additionalPrograms;
|
||||
in
|
||||
[ "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ]
|
||||
++ lib.optionals stdenv.isLinux [
|
||||
"--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
|
||||
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
|
||||
];
|
||||
|
||||
meta = {
|
||||
inherit (prismlauncher'.meta)
|
||||
description
|
||||
longDescription
|
||||
homepage
|
||||
changelog
|
||||
license
|
||||
maintainers
|
||||
mainProgram
|
||||
platforms
|
||||
;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user