fufexan/nix-gaming

Dependency umu-launcher is unproporionally large and is likely to time out when fetched

Opened this issue · 1 comments

This is the error I get when trying to run nix flake update in my system configuration.

[7.0 MiB DL] fetching Git repository 'https://github.com/Open-Wine-Components/umu-launcher/'error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
error: 7586 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
error:
       … while updating the lock file of flake 'git+file:///home/sntx/Documents/projects/2024-04-02_hive'

       … while updating the flake input 'nix-gaming'

       … while updating the flake input 'nix-gaming/umu'

       … while fetching the input 'git+https://github.com/Open-Wine-Components/umu-launcher/'

       error: program 'git' failed with exit code 128

I recognise this is likely an upstream issue, but wanted to raise awareness here first.

Would it be feasable to pin umu-launcher to a specific commit to avoid redownloading it on nix flake update?

From what I've noticed while testing, having an unreliable connection causes git to fail the download.

Here's what I've come up with: using npins to track the repo, and hackily importing the flake (could be done with flake-compat instead) to get the package. Though this suffers from the same problem, at least it's deferred to wherever umu is needed.

umu.diff
diff --git a/flake.lock b/flake.lock
index 63c3198..8edb4ae 100644
--- a/flake.lock
+++ b/flake.lock
@@ -49,32 +49,7 @@
     "root": {
       "inputs": {
         "flake-parts": "flake-parts",
-        "nixpkgs": "nixpkgs",
-        "umu": "umu"
-      }
-    },
-    "umu": {
-      "inputs": {
-        "nixpkgs": [
-          "nixpkgs"
-        ]
-      },
-      "locked": {
-        "dir": "packaging/nix",
-        "lastModified": 1727227288,
-        "narHash": "sha256-82fIhNN93zk0vmc5rltsbYJlD96AHzEFY2q1KizLP0A=",
-        "ref": "refs/heads/main",
-        "rev": "5cc1c3f23e2ecc9e03267c097e990d1702416852",
-        "revCount": 730,
-        "submodules": true,
-        "type": "git",
-        "url": "https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging/nix"
-      },
-      "original": {
-        "dir": "packaging/nix",
-        "submodules": true,
-        "type": "git",
-        "url": "https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging/nix"
+        "nixpkgs": "nixpkgs"
       }
     }
   },
diff --git a/flake.nix b/flake.nix
index 8529b1d..5b3eecb 100644
--- a/flake.nix
+++ b/flake.nix
@@ -4,10 +4,6 @@
   inputs = {
     nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
     flake-parts.url = "github:hercules-ci/flake-parts";
-    umu = {
-      url = "git+https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging\/nix&submodules=1";
-      inputs.nixpkgs.follows = "nixpkgs";
-    };
   };
 
   outputs = {self, ...} @ inputs:
diff --git a/npins/sources.json b/npins/sources.json
index f8420c4..d7f2c4d 100644
--- a/npins/sources.json
+++ b/npins/sources.json
@@ -117,6 +117,17 @@
       "url": "https://github.com/GloriousEggroll/proton-wine/archive/39021e609a24b6aeffdf9c4695a286d71e7dffbc.tar.gz",
       "hash": "000d5kba7vs5nc1sc3946jkpqmch4w09qz74i5zgc7nh7znck6f8"
     },
+    "umu-launcher": {
+      "type": "Git",
+      "repository": {
+        "type": "Git",
+        "url": "https://github.com/open-wine-components/umu-launcher"
+      },
+      "branch": "main",
+      "revision": "5cc1c3f23e2ecc9e03267c097e990d1702416852",
+      "url": null,
+      "hash": "0xy0iybrk2avxhij0mm7w0sjwyszhisjphkl13xdl2jvvivfzksm"
+    },
     "vkd3d-proton": {
       "type": "GitRelease",
       "repository": {
diff --git a/pkgs/default.nix b/pkgs/default.nix
index cb5fbbd..9afe12e 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -31,8 +31,14 @@
           }
           // extra))
         .${wine};
+
+      umu-src = import "${pins.umu-launcher}/packaging/nix/flake.nix";
+      umu-flake = umu-src.outputs {
+        self = umu-flake;
+        inherit (inputs) nixpkgs;
+      };
     in {
-      inherit (inputs.umu.packages.${system}) umu;
+      inherit (umu-flake.packages.${system}) umu;
       dxvk = pkgs.callPackage ./dxvk {inherit pins;};
       dxvk-w32 = pkgs.pkgsCross.mingw32.callPackage ./dxvk {inherit pins;};
       dxvk-w64 = pkgs.pkgsCross.mingwW64.callPackage ./dxvk {inherit pins;};