Merge pull request #1618 from getchoo/cool-nix-stuff

filter source in flake & add controller support
This commit is contained in:
Sefa Eyeoglu 2023-09-20 07:47:22 +02:00 committed by GitHub
commit 98bc102f5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 9 deletions

View File

@ -89,6 +89,21 @@
"type": "github" "type": "github"
} }
}, },
"nix-filter": {
"locked": {
"lastModified": 1693833173,
"narHash": "sha256-hlMABKrGbEiJD5dwUSfnw1CQ3bG7KKwDV+Nx3bEZd7U=",
"owner": "numtide",
"repo": "nix-filter",
"rev": "ac030bd9ba98e318e1f4c4328d60766ade8ebe8b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nix-filter",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1694760568, "lastModified": 1694760568,
@ -156,6 +171,7 @@
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"libnbtplusplus": "libnbtplusplus", "libnbtplusplus": "libnbtplusplus",
"nix-filter": "nix-filter",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks" "pre-commit-hooks": "pre-commit-hooks"
} }

View File

@ -4,6 +4,7 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
nix-filter.url = "github:numtide/nix-filter";
pre-commit-hooks = { pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix"; url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -20,12 +21,14 @@
}; };
}; };
outputs = inputs: outputs = {
inputs.flake-parts.lib.mkFlake flake-parts,
{inherit inputs;} pre-commit-hooks,
{ ...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [ imports = [
inputs.pre-commit-hooks.flakeModule pre-commit-hooks.flakeModule
./nix/dev.nix ./nix/dev.nix
./nix/distribution.nix ./nix/distribution.nix

View File

@ -9,7 +9,7 @@
... ...
}: { }: {
packages = let packages = let
ourPackages = lib.fix (final: self.overlays.default ({inherit (pkgs) darwin;} // final) pkgs); ourPackages = lib.fix (final: self.overlays.default final pkgs);
in { in {
inherit inherit
(ourPackages) (ourPackages)
@ -26,19 +26,40 @@
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";
filteredSelf = inputs.nix-filter.lib.filter {
root = ../.;
include = [
"buildconfig"
"cmake"
"launcher"
"libraries"
"program_info"
"tests"
../COPYING.md
../CMakeLists.txt
];
};
# common args for prismlauncher evaluations # common args for prismlauncher evaluations
unwrappedArgs = { unwrappedArgs = {
self = filteredSelf;
inherit (inputs) libnbtplusplus; inherit (inputs) libnbtplusplus;
inherit (final.darwin.apple_sdk.frameworks) Cocoa; inherit ((final.darwin or prev.darwin).apple_sdk.frameworks) Cocoa;
inherit self version; inherit version;
}; };
in { in {
prismlauncher-qt5-unwrapped = prev.libsForQt5.callPackage ./pkg unwrappedArgs; prismlauncher-qt5-unwrapped = prev.libsForQt5.callPackage ./pkg unwrappedArgs;
prismlauncher-qt5 = prev.libsForQt5.callPackage ./pkg/wrapper.nix { prismlauncher-qt5 = prev.libsForQt5.callPackage ./pkg/wrapper.nix {
prismlauncher-unwrapped = final.prismlauncher-qt5-unwrapped; prismlauncher-unwrapped = final.prismlauncher-qt5-unwrapped;
}; };
prismlauncher-unwrapped = prev.qt6Packages.callPackage ./pkg unwrappedArgs; prismlauncher-unwrapped = prev.qt6Packages.callPackage ./pkg unwrappedArgs;
prismlauncher = prev.qt6Packages.callPackage ./pkg/wrapper.nix {inherit (final) prismlauncher-unwrapped;};
prismlauncher = prev.qt6Packages.callPackage ./pkg/wrapper.nix {
inherit (final) prismlauncher-unwrapped;
};
}; };
}; };
} }

View File

@ -58,6 +58,7 @@ assert lib.assertMsg (stdenv.isLinux || !gamemodeSupport) "gamemodeSupport is on
dontWrapQtApps = true; dontWrapQtApps = true;
meta = with lib; { meta = with lib; {
mainProgram = "prismlauncher";
homepage = "https://prismlauncher.org/"; homepage = "https://prismlauncher.org/";
description = "A free, open source launcher for Minecraft"; description = "A free, open source launcher for Minecraft";
longDescription = '' longDescription = ''

View File

@ -18,9 +18,11 @@
flite, flite,
mesa-demos, mesa-demos,
udev, udev,
libusb1,
msaClientID ? null, msaClientID ? null,
gamemodeSupport ? stdenv.isLinux, gamemodeSupport ? stdenv.isLinux,
textToSpeechSupport ? stdenv.isLinux, textToSpeechSupport ? stdenv.isLinux,
controllerSupport ? stdenv.isLinux,
jdks ? [jdk17 jdk8], jdks ? [jdk17 jdk8],
additionalLibs ? [], additionalLibs ? [],
additionalPrograms ? [], additionalPrograms ? [],
@ -71,6 +73,7 @@ in
] ]
++ lib.optional gamemodeSupport gamemode.lib ++ lib.optional gamemodeSupport gamemode.lib
++ lib.optional textToSpeechSupport flite ++ lib.optional textToSpeechSupport flite
++ lib.optional controllerSupport libusb1
++ additionalLibs; ++ additionalLibs;
runtimePrograms = runtimePrograms =