From a49a58bc4571f87f42f45bb9eeb1a957d5d12331 Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 21 Aug 2024 03:42:40 -0400 Subject: [PATCH] Revert "refactor(nix): nix-filter -> lib.fileset" This reverts commit 8312713dc2274670db6f9167125af8a27c2fd8a6. See nix#9428. Path coercion like `"${./.}"` in flakes causes the path to be copied to the store twice; using the `self` argument works around this. However, as `lib.fileset` doesn't support using `self`, so we need to go back to `nix-filter` Signed-off-by: seth --- flake.lock | 16 ++++++++++++++++ flake.nix | 12 +++++++++++- nix/unwrapped.nix | 28 ++++++++++++++-------------- 3 files changed, 41 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index 7d21aad14..3210dc4e2 100644 --- a/flake.lock +++ b/flake.lock @@ -32,6 +32,21 @@ "type": "github" } }, + "nix-filter": { + "locked": { + "lastModified": 1710156097, + "narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "3342559a24e85fc164b295c3444e8a139924675b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1723637854, @@ -52,6 +67,7 @@ "inputs": { "flake-compat": "flake-compat", "libnbtplusplus": "libnbtplusplus", + "nix-filter": "nix-filter", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 2fe36902a..987fc0eda 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,8 @@ flake = false; }; + nix-filter.url = "github:numtide/nix-filter"; + /* Inputs below this are optional and can be removed @@ -40,6 +42,7 @@ self, nixpkgs, libnbtplusplus, + nix-filter, ... }: let @@ -86,7 +89,14 @@ version = builtins.substring 0 8 self.lastModifiedDate or "dirty"; in { - prismlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix { inherit libnbtplusplus version; }; + prismlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix { + inherit + libnbtplusplus + nix-filter + self + version + ; + }; prismlauncher = final.callPackage ./nix/wrapper.nix { }; }; diff --git a/nix/unwrapped.nix b/nix/unwrapped.nix index f007c05b8..f75acf1de 100644 --- a/nix/unwrapped.nix +++ b/nix/unwrapped.nix @@ -10,6 +10,8 @@ jdk17, kdePackages, ninja, + nix-filter, + self, stripJavaArchivesHook, tomlplusplus, zlib, @@ -27,20 +29,18 @@ stdenv.mkDerivation { pname = "prismlauncher-unwrapped"; inherit version; - src = lib.fileset.toSource { - root = ../.; - fileset = lib.fileset.unions ( - map (fileName: ../${fileName}) [ - "buildconfig" - "cmake" - "launcher" - "libraries" - "program_info" - "tests" - "COPYING.md" - "CMakeLists.txt" - ] - ); + src = nix-filter.lib { + root = self; + include = [ + "buildconfig" + "cmake" + "launcher" + "libraries" + "program_info" + "tests" + ../COPYING.md + ../CMakeLists.txt + ]; }; postUnpack = ''