From 89e434bd5bedcd92bfa99102011607027be20060 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 9 Sep 2023 14:32:50 -0400 Subject: [PATCH 1/5] refactor(nix): don't concat final attr in fixed point Signed-off-by: seth --- nix/distribution.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nix/distribution.nix b/nix/distribution.nix index 6b93d355f..c8fa01c59 100644 --- a/nix/distribution.nix +++ b/nix/distribution.nix @@ -9,7 +9,7 @@ ... }: { packages = let - ourPackages = lib.fix (final: self.overlays.default ({inherit (pkgs) darwin;} // final) pkgs); + ourPackages = lib.fix (final: self.overlays.default final pkgs); in { inherit (ourPackages) @@ -29,16 +29,21 @@ # common args for prismlauncher evaluations unwrappedArgs = { inherit (inputs) libnbtplusplus; - inherit (final.darwin.apple_sdk.frameworks) Cocoa; + inherit ((final.darwin or prev.darwin).apple_sdk.frameworks) Cocoa; inherit self version; }; in { prismlauncher-qt5-unwrapped = prev.libsForQt5.callPackage ./pkg unwrappedArgs; + prismlauncher-qt5 = prev.libsForQt5.callPackage ./pkg/wrapper.nix { prismlauncher-unwrapped = final.prismlauncher-qt5-unwrapped; }; + 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; + }; }; }; } From 6aa821df9c5cb2cd79e03ddad043ab49acfdd5a3 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 9 Sep 2023 14:34:38 -0400 Subject: [PATCH 2/5] refactor(nix): match inputs value in flake Signed-off-by: seth --- flake.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index d45282aa6..a58d66fb9 100644 --- a/flake.nix +++ b/flake.nix @@ -20,12 +20,14 @@ }; }; - outputs = inputs: - inputs.flake-parts.lib.mkFlake - {inherit inputs;} - { + outputs = { + flake-parts, + pre-commit-hooks, + ... + } @ inputs: + flake-parts.lib.mkFlake {inherit inputs;} { imports = [ - inputs.pre-commit-hooks.flakeModule + pre-commit-hooks.flakeModule ./nix/dev.nix ./nix/distribution.nix From 10192c540b85999c9a5cd075d695d1a4298ff9e5 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 9 Sep 2023 15:10:15 -0400 Subject: [PATCH 3/5] feat(nix): add source filtering this - along with garnix - should mostly eliminate unneeded (re)builds Signed-off-by: seth --- flake.lock | 16 ++++++++++++++++ flake.nix | 1 + nix/distribution.nix | 18 +++++++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index b1486ea69..df6039cf4 100644 --- a/flake.lock +++ b/flake.lock @@ -89,6 +89,21 @@ "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": { "locked": { "lastModified": 1693626178, @@ -156,6 +171,7 @@ "flake-compat": "flake-compat", "flake-parts": "flake-parts", "libnbtplusplus": "libnbtplusplus", + "nix-filter": "nix-filter", "nixpkgs": "nixpkgs", "pre-commit-hooks": "pre-commit-hooks" } diff --git a/flake.nix b/flake.nix index a58d66fb9..afb0ec63a 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; + nix-filter.url = "github:numtide/nix-filter"; pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/nix/distribution.nix b/nix/distribution.nix index c8fa01c59..ca9999dcb 100644 --- a/nix/distribution.nix +++ b/nix/distribution.nix @@ -26,11 +26,27 @@ overlays.default = final: prev: let 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 unwrappedArgs = { + self = filteredSelf; + inherit (inputs) libnbtplusplus; inherit ((final.darwin or prev.darwin).apple_sdk.frameworks) Cocoa; - inherit self version; + inherit version; }; in { prismlauncher-qt5-unwrapped = prev.libsForQt5.callPackage ./pkg unwrappedArgs; From 97ced1f459664949943b3f0ef424ea792be1c716 Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 19 Sep 2023 13:45:12 -0400 Subject: [PATCH 4/5] fix(nix): include libusb1 as a runtime dependency Signed-off-by: seth --- nix/pkg/wrapper.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nix/pkg/wrapper.nix b/nix/pkg/wrapper.nix index 8d160143d..8bc255e71 100644 --- a/nix/pkg/wrapper.nix +++ b/nix/pkg/wrapper.nix @@ -18,9 +18,11 @@ flite, mesa-demos, udev, + libusb1, msaClientID ? null, gamemodeSupport ? stdenv.isLinux, textToSpeechSupport ? stdenv.isLinux, + controllerSupport ? stdenv.isLinux, jdks ? [jdk17 jdk8], additionalLibs ? [], additionalPrograms ? [], @@ -71,6 +73,7 @@ in ] ++ lib.optional gamemodeSupport gamemode.lib ++ lib.optional textToSpeechSupport flite + ++ lib.optional controllerSupport libusb1 ++ additionalLibs; runtimePrograms = From 97da8892b9fcb285f7023a671090b4a3becdf2d8 Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 19 Sep 2023 13:45:52 -0400 Subject: [PATCH 5/5] chore(nix): add meta.mainProgram attribute Signed-off-by: seth --- nix/pkg/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/pkg/default.nix b/nix/pkg/default.nix index 074214c4b..fd19a0b3d 100644 --- a/nix/pkg/default.nix +++ b/nix/pkg/default.nix @@ -58,6 +58,7 @@ assert lib.assertMsg (stdenv.isLinux || !gamemodeSupport) "gamemodeSupport is on dontWrapQtApps = true; meta = with lib; { + mainProgram = "prismlauncher"; homepage = "https://prismlauncher.org/"; description = "A free, open source launcher for Minecraft"; longDescription = ''