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"; 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="
]; ];
@ -39,13 +39,15 @@
}; };
}; };
outputs = { outputs =
{
self, self,
nixpkgs, nixpkgs,
libnbtplusplus, libnbtplusplus,
nix-filter, nix-filter,
... ...
}: let }:
let
inherit (nixpkgs) lib; 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,
@ -55,20 +57,24 @@
forAllSystems = lib.genAttrs systems; forAllSystems = lib.genAttrs systems;
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system}); nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
in { in
{
checks = forAllSystems ( checks = forAllSystems (
system: let system:
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix {inherit self;}; let
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix { inherit self; };
in in
lib.filterAttrs (_: lib.isDerivation) checks' lib.filterAttrs (_: lib.isDerivation) checks'
); );
devShells = forAllSystems ( devShells = forAllSystems (
system: let system:
let
pkgs = nixpkgsFor.${system}; pkgs = nixpkgsFor.${system};
in { in
{
default = pkgs.mkShell { default = pkgs.mkShell {
inputsFrom = [self.packages.${system}.fjordlauncher-unwrapped]; inputsFrom = [ self.packages.${system}.fjordlauncher-unwrapped ];
buildInputs = with pkgs; [ buildInputs = with pkgs; [
ccache ccache
ninja ninja
@ -88,11 +94,12 @@
; ;
}; };
fjordlauncher = final.callPackage ./nix/wrapper.nix {}; fjordlauncher = final.callPackage ./nix/wrapper.nix { };
}; };
packages = forAllSystems ( packages = forAllSystems (
system: let system:
let
pkgs = nixpkgsFor.${system}; pkgs = nixpkgsFor.${system};
# Build a scope from our overlay # 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 # We put these under legacyPackages as they are meant for CI, not end user consumption
legacyPackages = forAllSystems ( legacyPackages = forAllSystems (
system: let system:
let
fjordPackages = self.packages.${system}; fjordPackages = self.packages.${system};
legacyPackages = self.legacyPackages.${system}; legacyPackages = self.legacyPackages.${system};
in { in
{
fjordlauncher-debug = fjordPackages.fjordlauncher.override { fjordlauncher-debug = fjordPackages.fjordlauncher.override {
fjordlauncher-unwrapped = legacyPackages.fjordlauncher-unwrapped-debug; fjordlauncher-unwrapped = legacyPackages.fjordlauncher-unwrapped-debug;
}; };

View File

@ -22,7 +22,7 @@
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 = "fjordlauncher-unwrapped"; pname = "fjordlauncher-unwrapped";
version = self.shortRev or self.dirtyShortRev or "unknown"; version = self.shortRev or self.dirtyShortRev or "unknown";
@ -63,10 +63,10 @@ assert lib.assertMsg (
tomlplusplus tomlplusplus
zlib zlib
] ]
++ lib.optionals stdenv.hostPlatform.isDarwin [apple-sdk_11] ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 ]
++ lib.optional gamemodeSupport gamemode; ++ lib.optional gamemodeSupport gamemode;
hardeningEnable = lib.optionals stdenv.hostPlatform.isLinux ["pie"]; hardeningEnable = lib.optionals stdenv.hostPlatform.isLinux [ "pie" ];
cmakeFlags = cmakeFlags =
[ [
@ -106,4 +106,4 @@ assert lib.assertMsg (
mainProgram = "fjordlauncher"; mainProgram = "fjordlauncher";
platforms = lib.platforms.linux ++ lib.platforms.darwin; platforms = lib.platforms.linux ++ lib.platforms.darwin;
}; };
} }

View File

@ -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,15 +45,16 @@ 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.";
fjordlauncher' = fjordlauncher-unwrapped.override {inherit msaClientID gamemodeSupport;}; let
fjordlauncher' = fjordlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; };
in in
symlinkJoin { symlinkJoin {
name = "fjordlauncher-${fjordlauncher'.version}"; name = "fjordlauncher-${fjordlauncher'.version}";
paths = [fjordlauncher']; paths = [ fjordlauncher' ];
nativeBuildInputs = [kdePackages.wrapQtAppsHook]; nativeBuildInputs = [ kdePackages.wrapQtAppsHook ];
buildInputs = buildInputs =
[ [
@ -62,14 +63,14 @@ in
] ]
++ 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,23 +101,20 @@ 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 FJORDLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"] [ "--prefix FJORDLAUNCHER_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 (fjordlauncher'.meta)
(fjordlauncher'.meta)
description description
longDescription longDescription
homepage homepage
@ -127,4 +125,4 @@ in
platforms platforms
; ;
}; };
} }