style(nix): format with nixfmt

Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
seth 2024-08-20 01:44:24 -04:00
parent 7dff77ca35
commit 4c81d8c53d
No known key found for this signature in database
GPG Key ID: D31BD0D494BBEE86
7 changed files with 259 additions and 236 deletions

View File

@ -1,6 +1,4 @@
(
import
(
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
@ -8,7 +6,4 @@
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
) { src = ./.; }).defaultNix

View File

@ -30,11 +30,8 @@
};
};
outputs = {
flake-parts,
pre-commit-hooks,
...
} @ inputs:
outputs =
{ flake-parts, pre-commit-hooks, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
pre-commit-hooks.flakeModule

View File

@ -15,7 +15,6 @@ to temporarily enable it when using `nix` commands.
Example (NixOS):
```nix
{...}:
{
nix.settings = {
trusted-substituters = [
@ -39,6 +38,7 @@ 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
@ -47,19 +47,24 @@ Example:
};
};
outputs = {nixpkgs, prismlauncher}: {
outputs =
{ nixpkgs, prismlauncher }:
{
nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({pkgs, ...}: {
./configuration.nix
(
{ pkgs, ... }:
{
nixpkgs.overlays = [ prismlauncher.overlays.default ];
environment.systemPackages = [ pkgs.prismlauncher ];
})
}
)
];
};
}
};
}
```
@ -74,6 +79,7 @@ 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
@ -82,17 +88,22 @@ Example:
};
};
outputs = {nixpkgs, prismlauncher}: {
outputs =
{ nixpkgs, prismlauncher }:
{
nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({pkgs, ...}: {
./configuration.nix
(
{ pkgs, ... }:
{
environment.systemPackages = [ prismlauncher.packages.${pkgs.system}.prismlauncher ];
})
}
)
];
};
}
};
}
```
@ -118,7 +129,6 @@ If you want to avoid rebuilds you may add the garnix cache to your substitutors.
Example (NixOS):
```nix
{...}:
{
nix.settings = {
trusted-substituters = [
@ -139,8 +149,13 @@ We use flake-compat to allow using this Flake on a system that doesn't use flake
Example:
```nix
{pkgs, ...}: {
nixpkgs.overlays = [(import (builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz")).overlays.default];
{ pkgs, ... }:
{
nixpkgs.overlays = [
(import (
builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz"
)).overlays.default
];
environment.systemPackages = [ pkgs.prismlauncher ];
}
@ -154,8 +169,13 @@ This way the installed package is fully reproducible.
Example:
```nix
{pkgs, ...}: {
environment.systemPackages = [(import (builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz")).packages.${pkgs.system}.prismlauncher];
{ pkgs, ... }:
{
environment.systemPackages = [
(import (
builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz"
)).packages.${pkgs.system}.prismlauncher
];
}
```

View File

@ -1,10 +1,12 @@
{
perSystem = {
perSystem =
{
config,
lib,
pkgs,
...
}: {
}:
{
pre-commit.settings = {
hooks = {
markdownlint.enable = true;
@ -15,7 +17,13 @@
clang-format = {
enable = true;
types_or = ["c" "c++" "java" "json" "objective-c"];
types_or = [
"c"
"c++"
"java"
"json"
"objective-c"
];
};
};
@ -28,7 +36,10 @@
'';
inputsFrom = [ config.packages.prismlauncher-unwrapped ];
buildInputs = with pkgs; [ccache ninja];
buildInputs = with pkgs; [
ccache
ninja
];
};
formatter = pkgs.nixfmt-rfc-style;

View File

@ -1,29 +1,25 @@
{ inputs, self, ... }:
{
inputs,
self,
...
}: {
perSystem = {
lib,
pkgs,
...
}: {
packages = let
perSystem =
{ lib, pkgs, ... }:
{
packages =
let
ourPackages = lib.fix (final: self.overlays.default final pkgs);
in {
inherit
(ourPackages)
prismlauncher-unwrapped
prismlauncher
;
in
{
inherit (ourPackages) prismlauncher-unwrapped prismlauncher;
default = ourPackages.prismlauncher;
};
};
flake = {
overlays.default = final: prev: let
overlays.default =
final: prev:
let
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
in {
in
{
prismlauncher-unwrapped = prev.callPackage ./pkg {
inherit (inputs) libnbtplusplus;
inherit version;

View File

@ -18,16 +18,19 @@
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}) [
fileset = lib.fileset.unions (
map (fileName: ../../${fileName}) [
"buildconfig"
"cmake"
"launcher"
@ -36,7 +39,8 @@ assert lib.assertMsg (
"tests"
"COPYING.md"
"CMakeLists.txt"
]);
]
);
};
postUnpack = ''
@ -68,9 +72,7 @@ assert lib.assertMsg (
hardeningEnable = lib.optionals stdenv.isLinux [ "pie" ];
cmakeFlags =
[
(lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs")
]
[ (lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs") ]
++ lib.optionals (msaClientID != null) [
(lib.cmakeFeature "Launcher_MSA_CLIENT_ID" (toString msaClientID))
]

View File

@ -42,15 +42,20 @@
# 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
) "withWaylandGLFW is only available on Linux.";
let
prismlauncher' = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; };
in
symlinkJoin {
@ -71,8 +76,7 @@ in
]
++ lib.optional (
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux
)
kdePackages.qtwayland;
) kdePackages.qtwayland;
env = {
waylandPreExec = lib.optionalString withWaylandGLFW ''
@ -90,7 +94,8 @@ in
wrapQtAppsHook
'';
qtWrapperArgs = let
qtWrapperArgs =
let
runtimeLibs =
[
# lwjgl
@ -115,13 +120,11 @@ in
++ lib.optional controllerSupport libusb1
++ additionalLibs;
runtimePrograms =
[
runtimePrograms = [
glxinfo
pciutils # need lspci
xorg.xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
]
++ additionalPrograms;
] ++ additionalPrograms;
in
[ "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ]
++ lib.optionals stdenv.isLinux [
@ -130,8 +133,7 @@ in
];
meta = {
inherit
(prismlauncher'.meta)
inherit (prismlauncher'.meta)
description
longDescription
homepage