style(nix): format with nixfmt
Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
parent
7dff77ca35
commit
4c81d8c53d
@ -1,6 +1,4 @@
|
|||||||
(
|
(import (
|
||||||
import
|
|
||||||
(
|
|
||||||
let
|
let
|
||||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
in
|
in
|
||||||
@ -8,7 +6,4 @@
|
|||||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
}
|
}
|
||||||
)
|
) { src = ./.; }).defaultNix
|
||||||
{src = ./.;}
|
|
||||||
)
|
|
||||||
.defaultNix
|
|
||||||
|
13
flake.nix
13
flake.nix
@ -2,8 +2,8 @@
|
|||||||
description = "A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once (Fork of MultiMC)";
|
description = "A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once (Fork of MultiMC)";
|
||||||
|
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
extra-substituters = ["https://cache.garnix.io"];
|
extra-substituters = [ "https://cache.garnix.io" ];
|
||||||
extra-trusted-public-keys = ["cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="];
|
extra-trusted-public-keys = [ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
@ -30,12 +30,9 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs =
|
||||||
flake-parts,
|
{ flake-parts, pre-commit-hooks, ... }@inputs:
|
||||||
pre-commit-hooks,
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
...
|
|
||||||
} @ inputs:
|
|
||||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
|
||||||
imports = [
|
imports = [
|
||||||
pre-commit-hooks.flakeModule
|
pre-commit-hooks.flakeModule
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ to temporarily enable it when using `nix` commands.
|
|||||||
Example (NixOS):
|
Example (NixOS):
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{...}:
|
|
||||||
{
|
{
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
trusted-substituters = [
|
trusted-substituters = [
|
||||||
@ -39,6 +38,7 @@ Example:
|
|||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
prismlauncher = {
|
prismlauncher = {
|
||||||
url = "github:PrismLauncher/PrismLauncher";
|
url = "github:PrismLauncher/PrismLauncher";
|
||||||
# Optional: Override the nixpkgs input of prismlauncher to use the same revision as the rest of your flake
|
# 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 {
|
nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
({pkgs, ...}: {
|
./configuration.nix
|
||||||
nixpkgs.overlays = [prismlauncher.overlays.default];
|
|
||||||
|
|
||||||
environment.systemPackages = [pkgs.prismlauncher];
|
(
|
||||||
})
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
nixpkgs.overlays = [ prismlauncher.overlays.default ];
|
||||||
|
|
||||||
|
environment.systemPackages = [ pkgs.prismlauncher ];
|
||||||
|
}
|
||||||
|
)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -74,6 +79,7 @@ Example:
|
|||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
prismlauncher = {
|
prismlauncher = {
|
||||||
url = "github:PrismLauncher/PrismLauncher";
|
url = "github:PrismLauncher/PrismLauncher";
|
||||||
# Optional: Override the nixpkgs input of prismlauncher to use the same revision as the rest of your flake
|
# 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 {
|
nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
({pkgs, ...}: {
|
./configuration.nix
|
||||||
environment.systemPackages = [prismlauncher.packages.${pkgs.system}.prismlauncher];
|
|
||||||
})
|
(
|
||||||
|
{ 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):
|
Example (NixOS):
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{...}:
|
|
||||||
{
|
{
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
trusted-substituters = [
|
trusted-substituters = [
|
||||||
@ -139,10 +149,15 @@ We use flake-compat to allow using this Flake on a system that doesn't use flake
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{pkgs, ...}: {
|
{ pkgs, ... }:
|
||||||
nixpkgs.overlays = [(import (builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz")).overlays.default];
|
{
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(import (
|
||||||
|
builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz"
|
||||||
|
)).overlays.default
|
||||||
|
];
|
||||||
|
|
||||||
environment.systemPackages = [pkgs.prismlauncher];
|
environment.systemPackages = [ pkgs.prismlauncher ];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -154,8 +169,13 @@ This way the installed package is fully reproducible.
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{pkgs, ...}: {
|
{ pkgs, ... }:
|
||||||
environment.systemPackages = [(import (builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz")).packages.${pkgs.system}.prismlauncher];
|
{
|
||||||
|
environment.systemPackages = [
|
||||||
|
(import (
|
||||||
|
builtins.fetchTarball "https://github.com/PrismLauncher/PrismLauncher/archive/develop.tar.gz"
|
||||||
|
)).packages.${pkgs.system}.prismlauncher
|
||||||
|
];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
21
nix/dev.nix
21
nix/dev.nix
@ -1,10 +1,12 @@
|
|||||||
{
|
{
|
||||||
perSystem = {
|
perSystem =
|
||||||
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
pre-commit.settings = {
|
pre-commit.settings = {
|
||||||
hooks = {
|
hooks = {
|
||||||
markdownlint.enable = true;
|
markdownlint.enable = true;
|
||||||
@ -15,7 +17,13 @@
|
|||||||
|
|
||||||
clang-format = {
|
clang-format = {
|
||||||
enable = true;
|
enable = true;
|
||||||
types_or = ["c" "c++" "java" "json" "objective-c"];
|
types_or = [
|
||||||
|
"c"
|
||||||
|
"c++"
|
||||||
|
"java"
|
||||||
|
"json"
|
||||||
|
"objective-c"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -27,8 +35,11 @@
|
|||||||
${config.pre-commit.installationScript}
|
${config.pre-commit.installationScript}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
inputsFrom = [config.packages.prismlauncher-unwrapped];
|
inputsFrom = [ config.packages.prismlauncher-unwrapped ];
|
||||||
buildInputs = with pkgs; [ccache ninja];
|
buildInputs = with pkgs; [
|
||||||
|
ccache
|
||||||
|
ninja
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
formatter = pkgs.nixfmt-rfc-style;
|
formatter = pkgs.nixfmt-rfc-style;
|
||||||
|
@ -1,29 +1,25 @@
|
|||||||
|
{ inputs, self, ... }:
|
||||||
{
|
{
|
||||||
inputs,
|
perSystem =
|
||||||
self,
|
{ lib, pkgs, ... }:
|
||||||
...
|
{
|
||||||
}: {
|
packages =
|
||||||
perSystem = {
|
let
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
packages = let
|
|
||||||
ourPackages = lib.fix (final: self.overlays.default final pkgs);
|
ourPackages = lib.fix (final: self.overlays.default final pkgs);
|
||||||
in {
|
in
|
||||||
inherit
|
{
|
||||||
(ourPackages)
|
inherit (ourPackages) prismlauncher-unwrapped prismlauncher;
|
||||||
prismlauncher-unwrapped
|
|
||||||
prismlauncher
|
|
||||||
;
|
|
||||||
default = ourPackages.prismlauncher;
|
default = ourPackages.prismlauncher;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
flake = {
|
flake = {
|
||||||
overlays.default = final: prev: let
|
overlays.default =
|
||||||
|
final: prev:
|
||||||
|
let
|
||||||
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
|
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
prismlauncher-unwrapped = prev.callPackage ./pkg {
|
prismlauncher-unwrapped = prev.callPackage ./pkg {
|
||||||
inherit (inputs) libnbtplusplus;
|
inherit (inputs) libnbtplusplus;
|
||||||
inherit version;
|
inherit version;
|
||||||
|
@ -18,16 +18,19 @@
|
|||||||
version,
|
version,
|
||||||
libnbtplusplus,
|
libnbtplusplus,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert lib.assertMsg (
|
assert lib.assertMsg (
|
||||||
gamemodeSupport -> stdenv.isLinux
|
gamemodeSupport -> stdenv.isLinux
|
||||||
) "gamemodeSupport is only available on Linux.";
|
) "gamemodeSupport is only available on Linux.";
|
||||||
stdenv.mkDerivation {
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
pname = "prismlauncher-unwrapped";
|
pname = "prismlauncher-unwrapped";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = lib.fileset.toSource {
|
src = lib.fileset.toSource {
|
||||||
root = ../../.;
|
root = ../../.;
|
||||||
fileset = lib.fileset.unions (map (fileName: ../../${fileName}) [
|
fileset = lib.fileset.unions (
|
||||||
|
map (fileName: ../../${fileName}) [
|
||||||
"buildconfig"
|
"buildconfig"
|
||||||
"cmake"
|
"cmake"
|
||||||
"launcher"
|
"launcher"
|
||||||
@ -36,7 +39,8 @@ assert lib.assertMsg (
|
|||||||
"tests"
|
"tests"
|
||||||
"COPYING.md"
|
"COPYING.md"
|
||||||
"CMakeLists.txt"
|
"CMakeLists.txt"
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
postUnpack = ''
|
postUnpack = ''
|
||||||
@ -62,15 +66,13 @@ assert lib.assertMsg (
|
|||||||
tomlplusplus
|
tomlplusplus
|
||||||
zlib
|
zlib
|
||||||
]
|
]
|
||||||
++ lib.optionals stdenv.isDarwin [darwin.apple_sdk.frameworks.Cocoa]
|
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
|
||||||
++ lib.optional gamemodeSupport gamemode;
|
++ lib.optional gamemodeSupport gamemode;
|
||||||
|
|
||||||
hardeningEnable = lib.optionals stdenv.isLinux ["pie"];
|
hardeningEnable = lib.optionals stdenv.isLinux [ "pie" ];
|
||||||
|
|
||||||
cmakeFlags =
|
cmakeFlags =
|
||||||
[
|
[ (lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs") ]
|
||||||
(lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs")
|
|
||||||
]
|
|
||||||
++ lib.optionals (msaClientID != null) [
|
++ lib.optionals (msaClientID != null) [
|
||||||
(lib.cmakeFeature "Launcher_MSA_CLIENT_ID" (toString msaClientID))
|
(lib.cmakeFeature "Launcher_MSA_CLIENT_ID" (toString msaClientID))
|
||||||
]
|
]
|
||||||
@ -103,4 +105,4 @@ assert lib.assertMsg (
|
|||||||
mainProgram = "prismlauncher";
|
mainProgram = "prismlauncher";
|
||||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
udev,
|
udev,
|
||||||
vulkan-loader,
|
vulkan-loader,
|
||||||
xorg,
|
xorg,
|
||||||
additionalLibs ? [],
|
additionalLibs ? [ ],
|
||||||
additionalPrograms ? [],
|
additionalPrograms ? [ ],
|
||||||
controllerSupport ? stdenv.isLinux,
|
controllerSupport ? stdenv.isLinux,
|
||||||
gamemodeSupport ? stdenv.isLinux,
|
gamemodeSupport ? stdenv.isLinux,
|
||||||
jdks ? [
|
jdks ? [
|
||||||
@ -42,24 +42,29 @@
|
|||||||
# itself can take slightly longer to start
|
# itself can take slightly longer to start
|
||||||
withWaylandGLFW ? false,
|
withWaylandGLFW ? false,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert lib.assertMsg (
|
assert lib.assertMsg (
|
||||||
controllerSupport -> stdenv.isLinux
|
controllerSupport -> stdenv.isLinux
|
||||||
) "controllerSupport only has an effect on Linux.";
|
) "controllerSupport only has an effect on Linux.";
|
||||||
|
|
||||||
assert lib.assertMsg (
|
assert lib.assertMsg (
|
||||||
textToSpeechSupport -> stdenv.isLinux
|
textToSpeechSupport -> stdenv.isLinux
|
||||||
) "textToSpeechSupport only has an effect on Linux.";
|
) "textToSpeechSupport only has an effect on Linux.";
|
||||||
|
|
||||||
assert lib.assertMsg (
|
assert lib.assertMsg (
|
||||||
withWaylandGLFW -> stdenv.isLinux
|
withWaylandGLFW -> stdenv.isLinux
|
||||||
) "withWaylandGLFW is only available on Linux."; let
|
) "withWaylandGLFW is only available on Linux.";
|
||||||
prismlauncher' = prismlauncher-unwrapped.override {inherit msaClientID gamemodeSupport;};
|
|
||||||
|
let
|
||||||
|
prismlauncher' = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; };
|
||||||
in
|
in
|
||||||
symlinkJoin {
|
symlinkJoin {
|
||||||
name = "prismlauncher-${prismlauncher'.version}";
|
name = "prismlauncher-${prismlauncher'.version}";
|
||||||
|
|
||||||
paths = [prismlauncher'];
|
paths = [ prismlauncher' ];
|
||||||
|
|
||||||
nativeBuildInputs =
|
nativeBuildInputs =
|
||||||
[kdePackages.wrapQtAppsHook]
|
[ kdePackages.wrapQtAppsHook ]
|
||||||
# purposefully using a shell wrapper here for variable expansion
|
# purposefully using a shell wrapper here for variable expansion
|
||||||
# see https://github.com/NixOS/nixpkgs/issues/172583
|
# see https://github.com/NixOS/nixpkgs/issues/172583
|
||||||
++ lib.optional withWaylandGLFW makeWrapper;
|
++ lib.optional withWaylandGLFW makeWrapper;
|
||||||
@ -71,8 +76,7 @@ in
|
|||||||
]
|
]
|
||||||
++ lib.optional (
|
++ lib.optional (
|
||||||
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux
|
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux
|
||||||
)
|
) kdePackages.qtwayland;
|
||||||
kdePackages.qtwayland;
|
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
waylandPreExec = lib.optionalString withWaylandGLFW ''
|
waylandPreExec = lib.optionalString withWaylandGLFW ''
|
||||||
@ -90,7 +94,8 @@ in
|
|||||||
wrapQtAppsHook
|
wrapQtAppsHook
|
||||||
'';
|
'';
|
||||||
|
|
||||||
qtWrapperArgs = let
|
qtWrapperArgs =
|
||||||
|
let
|
||||||
runtimeLibs =
|
runtimeLibs =
|
||||||
[
|
[
|
||||||
# lwjgl
|
# lwjgl
|
||||||
@ -115,23 +120,20 @@ in
|
|||||||
++ lib.optional controllerSupport libusb1
|
++ lib.optional controllerSupport libusb1
|
||||||
++ additionalLibs;
|
++ additionalLibs;
|
||||||
|
|
||||||
runtimePrograms =
|
runtimePrograms = [
|
||||||
[
|
|
||||||
glxinfo
|
glxinfo
|
||||||
pciutils # need lspci
|
pciutils # need lspci
|
||||||
xorg.xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
xorg.xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
||||||
]
|
] ++ additionalPrograms;
|
||||||
++ additionalPrograms;
|
|
||||||
in
|
in
|
||||||
["--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"]
|
[ "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ]
|
||||||
++ lib.optionals stdenv.isLinux [
|
++ lib.optionals stdenv.isLinux [
|
||||||
"--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
|
"--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
|
||||||
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
|
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
|
||||||
];
|
];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
inherit
|
inherit (prismlauncher'.meta)
|
||||||
(prismlauncher'.meta)
|
|
||||||
description
|
description
|
||||||
longDescription
|
longDescription
|
||||||
homepage
|
homepage
|
||||||
@ -142,4 +144,4 @@ in
|
|||||||
platforms
|
platforms
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user