chore(nix): nixfmt

This commit is contained in:
Evan Goode 2024-11-30 17:29:26 -05:00
parent a5bca15d46
commit 6879344334
3 changed files with 215 additions and 208 deletions

View File

@ -2,7 +2,7 @@
description = "Prism Launcher fork with support for alternative auth servers";
nixConfig = {
extra-substituters = ["https://unmojang.cachix.org"];
extra-substituters = [ "https://unmojang.cachix.org" ];
extra-trusted-public-keys = [
"unmojang.cachix.org-1:OfHnbBNduZ6Smx9oNbLFbYyvOWSoxb2uPcnXPj4EDQY="
];
@ -39,13 +39,15 @@
};
};
outputs = {
outputs =
{
self,
nixpkgs,
libnbtplusplus,
nix-filter,
...
}: let
}:
let
inherit (nixpkgs) lib;
# While we only officially support aarch and x86_64 on Linux and MacOS,
@ -55,20 +57,24 @@
forAllSystems = lib.genAttrs systems;
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
in {
in
{
checks = forAllSystems (
system: let
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix {inherit self;};
system:
let
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix { inherit self; };
in
lib.filterAttrs (_: lib.isDerivation) checks'
);
devShells = forAllSystems (
system: let
system:
let
pkgs = nixpkgsFor.${system};
in {
in
{
default = pkgs.mkShell {
inputsFrom = [self.packages.${system}.fjordlauncher-unwrapped];
inputsFrom = [ self.packages.${system}.fjordlauncher-unwrapped ];
buildInputs = with pkgs; [
ccache
ninja
@ -88,11 +94,12 @@
;
};
fjordlauncher = final.callPackage ./nix/wrapper.nix {};
fjordlauncher = final.callPackage ./nix/wrapper.nix { };
};
packages = forAllSystems (
system: let
system:
let
pkgs = nixpkgsFor.${system};
# Build a scope from our overlay
@ -110,10 +117,12 @@
# We put these under legacyPackages as they are meant for CI, not end user consumption
legacyPackages = forAllSystems (
system: let
system:
let
fjordPackages = self.packages.${system};
legacyPackages = self.legacyPackages.${system};
in {
in
{
fjordlauncher-debug = fjordPackages.fjordlauncher.override {
fjordlauncher-unwrapped = legacyPackages.fjordlauncher-unwrapped-debug;
};

View File

@ -22,7 +22,7 @@
assert lib.assertMsg (
gamemodeSupport -> stdenv.hostPlatform.isLinux
) "gamemodeSupport is only available on Linux.";
stdenv.mkDerivation {
stdenv.mkDerivation {
pname = "fjordlauncher-unwrapped";
version = self.shortRev or self.dirtyShortRev or "unknown";
@ -63,10 +63,10 @@ assert lib.assertMsg (
tomlplusplus
zlib
]
++ lib.optionals stdenv.hostPlatform.isDarwin [apple-sdk_11]
++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 ]
++ lib.optional gamemodeSupport gamemode;
hardeningEnable = lib.optionals stdenv.hostPlatform.isLinux ["pie"];
hardeningEnable = lib.optionals stdenv.hostPlatform.isLinux [ "pie" ];
cmakeFlags =
[
@ -106,4 +106,4 @@ assert lib.assertMsg (
mainProgram = "fjordlauncher";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}
}

View File

@ -28,8 +28,8 @@
udev,
vulkan-loader,
xrandr,
additionalLibs ? [],
additionalPrograms ? [],
additionalLibs ? [ ],
additionalPrograms ? [ ],
controllerSupport ? stdenv.hostPlatform.isLinux,
gamemodeSupport ? stdenv.hostPlatform.isLinux,
jdks ? [
@ -45,15 +45,16 @@ assert lib.assertMsg (
) "controllerSupport only has an effect on Linux.";
assert lib.assertMsg (
textToSpeechSupport -> stdenv.hostPlatform.isLinux
) "textToSpeechSupport only has an effect on Linux."; let
fjordlauncher' = fjordlauncher-unwrapped.override {inherit msaClientID gamemodeSupport;};
) "textToSpeechSupport only has an effect on Linux.";
let
fjordlauncher' = fjordlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; };
in
symlinkJoin {
symlinkJoin {
name = "fjordlauncher-${fjordlauncher'.version}";
paths = [fjordlauncher'];
paths = [ fjordlauncher' ];
nativeBuildInputs = [kdePackages.wrapQtAppsHook];
nativeBuildInputs = [ kdePackages.wrapQtAppsHook ];
buildInputs =
[
@ -62,14 +63,14 @@ in
]
++ lib.optional (
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.hostPlatform.isLinux
)
kdePackages.qtwayland;
) kdePackages.qtwayland;
postBuild = ''
wrapQtAppsHook
'';
qtWrapperArgs = let
qtWrapperArgs =
let
runtimeLibs =
[
(lib.getLib stdenv.cc.cc)
@ -100,23 +101,20 @@ in
++ lib.optional controllerSupport libusb1
++ additionalLibs;
runtimePrograms =
[
runtimePrograms = [
mesa-demos
pciutils # need lspci
xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
]
++ additionalPrograms;
] ++ additionalPrograms;
in
["--prefix FJORDLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"]
[ "--prefix FJORDLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ]
++ lib.optionals stdenv.hostPlatform.isLinux [
"--set LD_LIBRARY_PATH ${addDriverRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
];
meta = {
inherit
(fjordlauncher'.meta)
inherit (fjordlauncher'.meta)
description
longDescription
homepage
@ -127,4 +125,4 @@ in
platforms
;
};
}
}