diff options
Diffstat (limited to 'nix/distribution.nix')
-rw-r--r-- | nix/distribution.nix | 67 |
1 files changed, 51 insertions, 16 deletions
diff --git a/nix/distribution.nix b/nix/distribution.nix index d0904d41..ca9999dc 100644 --- a/nix/distribution.nix +++ b/nix/distribution.nix @@ -1,30 +1,65 @@ { inputs, self, - version, ... }: { - perSystem = {pkgs, ...}: { - packages = { - inherit (pkgs) prismlauncher-qt5-unwrapped prismlauncher-qt5 prismlauncher-unwrapped prismlauncher; - default = pkgs.prismlauncher; + perSystem = { + lib, + pkgs, + ... + }: { + packages = let + ourPackages = lib.fix (final: self.overlays.default final pkgs); + in { + inherit + (ourPackages) + prismlauncher-qt5-unwrapped + prismlauncher-qt5 + prismlauncher-unwrapped + prismlauncher + ; + default = ourPackages.prismlauncher; }; }; flake = { overlays.default = final: prev: let - # Helper function to build prism against different versions of Qt. - mkPrism = qt: - qt.callPackage ./package.nix { - inherit (inputs) libnbtplusplus; - inherit (prev.darwin.apple_sdk.frameworks) Cocoa; - inherit self version; - }; + 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 version; + }; in { - prismlauncher-qt5-unwrapped = mkPrism final.libsForQt5; - prismlauncher-qt5 = prev.prismlauncher-qt5.override {prismlauncher-unwrapped = final.prismlauncher-qt5-unwrapped;}; - prismlauncher-unwrapped = mkPrism final.qt6Packages; - prismlauncher = prev.prismlauncher.override {inherit (final) prismlauncher-unwrapped;}; + 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; + }; }; }; } |