chore(nix): nixfmt
This commit is contained in:
parent
6ec444e0c4
commit
6b6da03aa4
175
flake.nix
175
flake.nix
@ -2,7 +2,7 @@
|
|||||||
description = "Prism Launcher fork with support for alternative auth servers";
|
description = "Prism Launcher fork with support for alternative auth servers";
|
||||||
|
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
extra-substituters = ["https://unmojang.cachix.org"];
|
extra-substituters = [ "https://unmojang.cachix.org" ];
|
||||||
extra-trusted-public-keys = [
|
extra-trusted-public-keys = [
|
||||||
"unmojang.cachix.org-1:OfHnbBNduZ6Smx9oNbLFbYyvOWSoxb2uPcnXPj4EDQY="
|
"unmojang.cachix.org-1:OfHnbBNduZ6Smx9oNbLFbYyvOWSoxb2uPcnXPj4EDQY="
|
||||||
];
|
];
|
||||||
@ -19,18 +19,18 @@
|
|||||||
nix-filter.url = "github:numtide/nix-filter";
|
nix-filter.url = "github:numtide/nix-filter";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Inputs below this are optional and can be removed
|
Inputs below this are optional and can be removed
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
inputs.shatteredprism = {
|
inputs.shatteredprism = {
|
||||||
url = "github:lunaislazier/ShatteredPrism";
|
url = "github:lunaislazier/ShatteredPrism";
|
||||||
inputs = {
|
inputs = {
|
||||||
flake-compat.follows = "";
|
flake-compat.follows = "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
}
|
```
|
||||||
```
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flake-compat = {
|
flake-compat = {
|
||||||
@ -39,90 +39,99 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs =
|
||||||
self,
|
{
|
||||||
nixpkgs,
|
self,
|
||||||
libnbtplusplus,
|
nixpkgs,
|
||||||
nix-filter,
|
libnbtplusplus,
|
||||||
...
|
nix-filter,
|
||||||
}: let
|
...
|
||||||
inherit (nixpkgs) lib;
|
}:
|
||||||
|
let
|
||||||
|
inherit (nixpkgs) lib;
|
||||||
|
|
||||||
# While we only officially support aarch and x86_64 on Linux and MacOS,
|
# 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
|
# we expose a reasonable amount of other systems for users who want to
|
||||||
# build for most exotic platforms
|
# build for most exotic platforms
|
||||||
systems = lib.systems.flakeExposed;
|
systems = lib.systems.flakeExposed;
|
||||||
|
|
||||||
forAllSystems = lib.genAttrs systems;
|
forAllSystems = lib.genAttrs systems;
|
||||||
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
||||||
in {
|
in
|
||||||
checks = forAllSystems (
|
{
|
||||||
system: let
|
checks = forAllSystems (
|
||||||
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix {inherit self;};
|
system:
|
||||||
in
|
let
|
||||||
|
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix { inherit self; };
|
||||||
|
in
|
||||||
lib.filterAttrs (_: lib.isDerivation) checks'
|
lib.filterAttrs (_: lib.isDerivation) checks'
|
||||||
);
|
);
|
||||||
|
|
||||||
devShells = forAllSystems (
|
devShells = forAllSystems (
|
||||||
system: let
|
system:
|
||||||
pkgs = nixpkgsFor.${system};
|
let
|
||||||
in {
|
pkgs = nixpkgsFor.${system};
|
||||||
default = pkgs.mkShell {
|
in
|
||||||
inputsFrom = [self.packages.${system}.shatteredprism-unwrapped];
|
{
|
||||||
buildInputs = with pkgs; [
|
default = pkgs.mkShell {
|
||||||
ccache
|
inputsFrom = [ self.packages.${system}.shatteredprism-unwrapped ];
|
||||||
ninja
|
buildInputs = with pkgs; [
|
||||||
];
|
ccache
|
||||||
|
ninja
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
|
||||||
|
|
||||||
|
overlays.default = final: prev: {
|
||||||
|
shatteredprism-unwrapped = prev.callPackage ./nix/unwrapped.nix {
|
||||||
|
inherit
|
||||||
|
libnbtplusplus
|
||||||
|
nix-filter
|
||||||
|
self
|
||||||
|
;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
|
shatteredprism = final.callPackage ./nix/wrapper.nix { };
|
||||||
|
|
||||||
overlays.default = final: prev: {
|
|
||||||
shatteredprism-unwrapped = prev.callPackage ./nix/unwrapped.nix {
|
|
||||||
inherit
|
|
||||||
libnbtplusplus
|
|
||||||
nix-filter
|
|
||||||
self
|
|
||||||
;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
shatteredprism = final.callPackage ./nix/wrapper.nix {};
|
packages = forAllSystems (
|
||||||
};
|
system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgsFor.${system};
|
||||||
|
|
||||||
packages = forAllSystems (
|
# Build a scope from our overlay
|
||||||
system: let
|
shatteredPackages = lib.makeScope pkgs.newScope (final: self.overlays.default final pkgs);
|
||||||
pkgs = nixpkgsFor.${system};
|
|
||||||
|
|
||||||
# Build a scope from our overlay
|
# Grab our packages from it and set the default
|
||||||
shatteredPackages = lib.makeScope pkgs.newScope (final: self.overlays.default final pkgs);
|
packages = {
|
||||||
|
inherit (shatteredPackages) shatteredprism-unwrapped shatteredprism;
|
||||||
# Grab our packages from it and set the default
|
default = shatteredPackages.shatteredprism;
|
||||||
packages = {
|
};
|
||||||
inherit (shatteredPackages) shatteredprism-unwrapped shatteredprism;
|
in
|
||||||
default = shatteredPackages.shatteredprism;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
# Only output them if they're available on the current system
|
# Only output them if they're available on the current system
|
||||||
lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages
|
lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages
|
||||||
);
|
);
|
||||||
|
|
||||||
# We put these under legacyPackages as they are meant for CI, not end user consumption
|
# We put these under legacyPackages as they are meant for CI, not end user consumption
|
||||||
legacyPackages = forAllSystems (
|
legacyPackages = forAllSystems (
|
||||||
system: let
|
system:
|
||||||
shatteredPackages = self.packages.${system};
|
let
|
||||||
legacyPackages = self.legacyPackages.${system};
|
shatteredPackages = self.packages.${system};
|
||||||
in {
|
legacyPackages = self.legacyPackages.${system};
|
||||||
shatteredprism-debug = shatteredPackages.shatteredprism.override {
|
in
|
||||||
shatteredprism-unwrapped = legacyPackages.shatteredprism-unwrapped-debug;
|
{
|
||||||
};
|
shatteredprism-debug = shatteredPackages.shatteredprism.override {
|
||||||
|
shatteredprism-unwrapped = legacyPackages.shatteredprism-unwrapped-debug;
|
||||||
|
};
|
||||||
|
|
||||||
shatteredprism-unwrapped-debug = shatteredPackages.shatteredprism-unwrapped.overrideAttrs {
|
shatteredprism-unwrapped-debug = shatteredPackages.shatteredprism-unwrapped.overrideAttrs {
|
||||||
cmakeBuildType = "Debug";
|
cmakeBuildType = "Debug";
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -22,88 +22,88 @@
|
|||||||
assert lib.assertMsg (
|
assert lib.assertMsg (
|
||||||
gamemodeSupport -> stdenv.hostPlatform.isLinux
|
gamemodeSupport -> stdenv.hostPlatform.isLinux
|
||||||
) "gamemodeSupport is only available on Linux.";
|
) "gamemodeSupport is only available on Linux.";
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
pname = "shatteredprism-unwrapped";
|
pname = "shatteredprism-unwrapped";
|
||||||
version = self.shortRev or self.dirtyShortRev or "unknown";
|
version = self.shortRev or self.dirtyShortRev or "unknown";
|
||||||
|
|
||||||
src = nix-filter.lib {
|
src = nix-filter.lib {
|
||||||
root = self;
|
root = self;
|
||||||
include = [
|
include = [
|
||||||
"buildconfig"
|
"buildconfig"
|
||||||
"cmake"
|
"cmake"
|
||||||
"launcher"
|
"launcher"
|
||||||
"libraries"
|
"libraries"
|
||||||
"program_info"
|
"program_info"
|
||||||
"tests"
|
"tests"
|
||||||
../COPYING.md
|
../COPYING.md
|
||||||
../CMakeLists.txt
|
../CMakeLists.txt
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
postUnpack = ''
|
postUnpack = ''
|
||||||
rm -rf source/libraries/libnbtplusplus
|
rm -rf source/libraries/libnbtplusplus
|
||||||
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
|
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
cmake
|
cmake
|
||||||
ninja
|
ninja
|
||||||
extra-cmake-modules
|
extra-cmake-modules
|
||||||
jdk17
|
jdk17
|
||||||
stripJavaArchivesHook
|
stripJavaArchivesHook
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs =
|
||||||
|
[
|
||||||
|
cmark
|
||||||
|
ghc_filesystem
|
||||||
|
kdePackages.qtbase
|
||||||
|
kdePackages.qtnetworkauth
|
||||||
|
kdePackages.quazip
|
||||||
|
tomlplusplus
|
||||||
|
zlib
|
||||||
|
]
|
||||||
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 ]
|
||||||
|
++ lib.optional gamemodeSupport gamemode;
|
||||||
|
|
||||||
|
hardeningEnable = lib.optionals stdenv.hostPlatform.isLinux [ "pie" ];
|
||||||
|
|
||||||
|
cmakeFlags =
|
||||||
|
[
|
||||||
|
# downstream branding
|
||||||
|
(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.hostPlatform.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/")
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs =
|
doCheck = true;
|
||||||
[
|
|
||||||
cmark
|
|
||||||
ghc_filesystem
|
|
||||||
kdePackages.qtbase
|
|
||||||
kdePackages.qtnetworkauth
|
|
||||||
kdePackages.quazip
|
|
||||||
tomlplusplus
|
|
||||||
zlib
|
|
||||||
]
|
|
||||||
++ lib.optionals stdenv.hostPlatform.isDarwin [apple-sdk_11]
|
|
||||||
++ lib.optional gamemodeSupport gamemode;
|
|
||||||
|
|
||||||
hardeningEnable = lib.optionals stdenv.hostPlatform.isLinux ["pie"];
|
dontWrapQtApps = true;
|
||||||
|
|
||||||
cmakeFlags =
|
meta = {
|
||||||
[
|
description = "Prism Launcher fork with support for alternative auth servers";
|
||||||
# downstream branding
|
longDescription = ''
|
||||||
(lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs")
|
Allows you to have multiple, separate instances of Minecraft (each with
|
||||||
]
|
their own mods, texture packs, saves, etc) and helps you manage them and
|
||||||
++ lib.optionals (msaClientID != null) [
|
their associated options with a simple interface.
|
||||||
(lib.cmakeFeature "Launcher_MSA_CLIENT_ID" (toString msaClientID))
|
'';
|
||||||
]
|
homepage = "https://github.com/lunaislazier/ShatteredPrism";
|
||||||
++ lib.optionals (lib.versionOlder kdePackages.qtbase.version "6") [
|
license = lib.licenses.gpl3Only;
|
||||||
(lib.cmakeFeature "Launcher_QT_VERSION_MAJOR" "5")
|
maintainers = with lib.maintainers; [
|
||||||
]
|
lunaislazier
|
||||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
];
|
||||||
# we wrap our binary manually
|
mainProgram = "shatteredprism";
|
||||||
(lib.cmakeFeature "INSTALL_BUNDLE" "nodeps")
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||||
# disable built-in updater
|
};
|
||||||
(lib.cmakeFeature "MACOSX_SPARKLE_UPDATE_FEED_URL" "''")
|
}
|
||||||
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/Applications/")
|
|
||||||
];
|
|
||||||
|
|
||||||
doCheck = true;
|
|
||||||
|
|
||||||
dontWrapQtApps = true;
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = "Prism Launcher fork with support for alternative auth servers";
|
|
||||||
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://github.com/lunaislazier/ShatteredPrism";
|
|
||||||
license = lib.licenses.gpl3Only;
|
|
||||||
maintainers = with lib.maintainers; [
|
|
||||||
lunaislazier
|
|
||||||
];
|
|
||||||
mainProgram = "shatteredprism";
|
|
||||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
udev,
|
udev,
|
||||||
vulkan-loader,
|
vulkan-loader,
|
||||||
xrandr,
|
xrandr,
|
||||||
additionalLibs ? [],
|
additionalLibs ? [ ],
|
||||||
additionalPrograms ? [],
|
additionalPrograms ? [ ],
|
||||||
controllerSupport ? stdenv.hostPlatform.isLinux,
|
controllerSupport ? stdenv.hostPlatform.isLinux,
|
||||||
gamemodeSupport ? stdenv.hostPlatform.isLinux,
|
gamemodeSupport ? stdenv.hostPlatform.isLinux,
|
||||||
jdks ? [
|
jdks ? [
|
||||||
@ -45,31 +45,32 @@ assert lib.assertMsg (
|
|||||||
) "controllerSupport only has an effect on Linux.";
|
) "controllerSupport only has an effect on Linux.";
|
||||||
assert lib.assertMsg (
|
assert lib.assertMsg (
|
||||||
textToSpeechSupport -> stdenv.hostPlatform.isLinux
|
textToSpeechSupport -> stdenv.hostPlatform.isLinux
|
||||||
) "textToSpeechSupport only has an effect on Linux."; let
|
) "textToSpeechSupport only has an effect on Linux.";
|
||||||
shatteredprism' = shatteredprism-unwrapped.override {inherit msaClientID gamemodeSupport;};
|
let
|
||||||
|
shatteredprism' = shatteredprism-unwrapped.override { inherit msaClientID gamemodeSupport; };
|
||||||
in
|
in
|
||||||
symlinkJoin {
|
symlinkJoin {
|
||||||
name = "shatteredprism-${shatteredprism'.version}";
|
name = "shatteredprism-${shatteredprism'.version}";
|
||||||
|
|
||||||
paths = [shatteredprism'];
|
paths = [ shatteredprism' ];
|
||||||
|
|
||||||
nativeBuildInputs = [kdePackages.wrapQtAppsHook];
|
nativeBuildInputs = [ kdePackages.wrapQtAppsHook ];
|
||||||
|
|
||||||
buildInputs =
|
buildInputs =
|
||||||
[
|
[
|
||||||
kdePackages.qtbase
|
kdePackages.qtbase
|
||||||
kdePackages.qtsvg
|
kdePackages.qtsvg
|
||||||
]
|
]
|
||||||
++ lib.optional (
|
++ lib.optional (
|
||||||
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.hostPlatform.isLinux
|
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.hostPlatform.isLinux
|
||||||
)
|
) kdePackages.qtwayland;
|
||||||
kdePackages.qtwayland;
|
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
wrapQtAppsHook
|
wrapQtAppsHook
|
||||||
'';
|
'';
|
||||||
|
|
||||||
qtWrapperArgs = let
|
qtWrapperArgs =
|
||||||
|
let
|
||||||
runtimeLibs =
|
runtimeLibs =
|
||||||
[
|
[
|
||||||
(lib.getLib stdenv.cc.cc)
|
(lib.getLib stdenv.cc.cc)
|
||||||
@ -100,31 +101,28 @@ in
|
|||||||
++ lib.optional controllerSupport libusb1
|
++ lib.optional controllerSupport libusb1
|
||||||
++ additionalLibs;
|
++ additionalLibs;
|
||||||
|
|
||||||
runtimePrograms =
|
runtimePrograms = [
|
||||||
[
|
mesa-demos
|
||||||
mesa-demos
|
pciutils # need lspci
|
||||||
pciutils # need lspci
|
xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
||||||
xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
] ++ additionalPrograms;
|
||||||
]
|
|
||||||
++ additionalPrograms;
|
|
||||||
in
|
in
|
||||||
["--prefix SHATTEREDPRISM_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"]
|
[ "--prefix SHATTEREDPRISM_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ]
|
||||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||||
"--set LD_LIBRARY_PATH ${addDriverRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
|
"--set LD_LIBRARY_PATH ${addDriverRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
|
||||||
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
|
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
|
||||||
];
|
];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
inherit
|
inherit (shatteredprism'.meta)
|
||||||
(shatteredprism'.meta)
|
description
|
||||||
description
|
longDescription
|
||||||
longDescription
|
homepage
|
||||||
homepage
|
changelog
|
||||||
changelog
|
license
|
||||||
license
|
maintainers
|
||||||
maintainers
|
mainProgram
|
||||||
mainProgram
|
platforms
|
||||||
platforms
|
;
|
||||||
;
|
};
|
||||||
};
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user