summary refs log tree commit diff
path: root/pkgs/misc/emulators
diff options
context:
space:
mode:
authorThiago Kenji Okada <thiagokokada@gmail.com>2022-01-04 17:48:08 -0300
committerGitHub <noreply@github.com>2022-01-04 17:48:08 -0300
commitcf9dbdbe037d956ecb229e58e0f2a4b5f6cadd93 (patch)
treec07f4bf39e4e55fd295aa0a167c09152ea098f94 /pkgs/misc/emulators
parentfe0bb916e1df596a4ad0684d8326d94800003baa (diff)
parentd83e270109a084a5088e1c1af5b0cb9cca90efba (diff)
downloadnixpkgs-cf9dbdbe037d956ecb229e58e0f2a4b5f6cadd93.tar
nixpkgs-cf9dbdbe037d956ecb229e58e0f2a4b5f6cadd93.tar.gz
nixpkgs-cf9dbdbe037d956ecb229e58e0f2a4b5f6cadd93.tar.bz2
nixpkgs-cf9dbdbe037d956ecb229e58e0f2a4b5f6cadd93.tar.lz
nixpkgs-cf9dbdbe037d956ecb229e58e0f2a4b5f6cadd93.tar.xz
nixpkgs-cf9dbdbe037d956ecb229e58e0f2a4b5f6cadd93.tar.zst
nixpkgs-cf9dbdbe037d956ecb229e58e0f2a4b5f6cadd93.zip
Merge pull request #153401 from thiagokokada/retroarch-improvements
libretro.citra: remove nix-prefetch-github hack 
Diffstat (limited to 'pkgs/misc/emulators')
-rw-r--r--pkgs/misc/emulators/retroarch/cores.nix15
-rw-r--r--pkgs/misc/emulators/retroarch/hashes.json6
-rwxr-xr-xpkgs/misc/emulators/retroarch/update.py39
3 files changed, 30 insertions, 30 deletions
diff --git a/pkgs/misc/emulators/retroarch/cores.nix b/pkgs/misc/emulators/retroarch/cores.nix
index 09acbca8652..4bbe12cbd29 100644
--- a/pkgs/misc/emulators/retroarch/cores.nix
+++ b/pkgs/misc/emulators/retroarch/cores.nix
@@ -54,7 +54,7 @@ let
     , description
       # Check https://github.com/libretro/libretro-core-info for license information
     , license
-    , src ? null
+    , src ? (getCoreSrc core)
     , broken ? false
     , version ? "unstable-2021-12-06"
     , platforms ? retroarch.meta.platforms
@@ -63,15 +63,13 @@ let
     , normalizeCore ? true
     , ...
     }@args:
-    lib.makeOverridable stdenv.mkDerivation (
+    stdenv.mkDerivation (
       let
         d2u = if normalizeCore then (lib.replaceChars [ "-" ] [ "_" ]) else (x: x);
-        finalSrc = if src == null then getCoreSrc core else src;
       in
       (rec {
         pname = "libretro-${core}";
-        inherit version;
-        src = finalSrc;
+        inherit version src;
 
         buildInputs = [ zlib ] ++ args.extraBuildInputs or [ ];
         nativeBuildInputs = [ makeWrapper ] ++ args.extraNativeBuildInputs or [ ];
@@ -308,13 +306,6 @@ in
 
   citra = mkLibRetroCore {
     core = "citra";
-    # `nix-prefetch-github` doesn't support `deepClone`, necessary for citra
-    # https://github.com/seppeljordan/nix-prefetch-github/issues/41
-    src = fetchFromGitHub {
-      inherit (hashesFile.citra) owner repo rev fetchSubmodules;
-      deepClone = true;
-      sha256 = "sha256-bwnYkMvbtRF5bGZRYVtMWxnCu9P45qeX4+ntOj9eRds=";
-    };
     description = "Port of Citra to libretro";
     license = lib.licenses.gpl2Plus;
     extraNativeBuildInputs = [ cmake pkg-config ];
diff --git a/pkgs/misc/emulators/retroarch/hashes.json b/pkgs/misc/emulators/retroarch/hashes.json
index 2d5e7411b8e..4f01bcf8b47 100644
--- a/pkgs/misc/emulators/retroarch/hashes.json
+++ b/pkgs/misc/emulators/retroarch/hashes.json
@@ -122,8 +122,10 @@
         "owner": "libretro",
         "repo": "citra",
         "rev": "b1959d07a340bfd9af65ad464fd19eb6799a96ef",
-        "sha256": "Tw6Niba9gsZOMKGaXF9AZ5gdigB0mmFyqoRTMElM/Ps=",
-        "fetchSubmodules": true
+        "sha256": "bwnYkMvbtRF5bGZRYVtMWxnCu9P45qeX4+ntOj9eRds=",
+        "fetchSubmodules": true,
+        "leaveDotGit": true,
+        "deepClone": true
     },
     "desmume": {
         "owner": "libretro",
diff --git a/pkgs/misc/emulators/retroarch/update.py b/pkgs/misc/emulators/retroarch/update.py
index 831709d89e7..857c5df6244 100755
--- a/pkgs/misc/emulators/retroarch/update.py
+++ b/pkgs/misc/emulators/retroarch/update.py
@@ -1,12 +1,11 @@
 #!/usr/bin/env nix-shell
-#!nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ requests nix-prefetch-github ])" -p "git"
+#!nix-shell -I nixpkgs=../../../../ -i python3 -p "python3.withPackages (ps: with ps; [ requests nix-prefetch-github ])" -p "git"
 
 import json
 import sys
+import subprocess
 from pathlib import Path
 
-from nix_prefetch_github import nix_prefetch_github
-
 SCRIPT_PATH = Path(__file__).absolute().parent
 HASHES_PATH = SCRIPT_PATH / "hashes.json"
 CORES = {
@@ -27,7 +26,7 @@ CORES = {
     "bsnes": {"repo": "bsnes-libretro"},
     "bsnes-hd": {"repo": "bsnes-hd", "owner": "DerKoun"},
     "bsnes-mercury": {"repo": "bsnes-mercury"},
-    "citra": {"repo": "citra", "fetch_submodules": True},
+    "citra": {"repo": "citra", "fetch_submodules": True, "deep_clone": True, "leave_dot_git": True},
     "desmume": {"repo": "desmume"},
     "desmume2015": {"repo": "desmume2015"},
     "dolphin": {"repo": "dolphin"},
@@ -97,19 +96,27 @@ def info(*msg):
     print(*msg, file=sys.stderr)
 
 
-def get_repo_hash_fetchFromGitHub(repo, owner="libretro", fetch_submodules=False):
-    assert repo is not None, "Parameter 'repo' can't be None."
-
-    repo_hash = nix_prefetch_github(
-        owner=owner, repo=repo, fetch_submodules=fetch_submodules
+def get_repo_hash_fetchFromGitHub(
+    repo,
+    owner="libretro",
+    deep_clone=False,
+    fetch_submodules=False,
+    leave_dot_git=False,
+):
+    extra_args = []
+    if deep_clone:
+        extra_args.append("--deep-clone")
+    if fetch_submodules:
+        extra_args.append("--fetch-submodules")
+    if leave_dot_git:
+        extra_args.append("--leave-dot-git")
+    result = subprocess.run(
+        ["nix-prefetch-github", owner, repo, *extra_args],
+        check=True,
+        capture_output=True,
+        text=True,
     )
-    return {
-        "owner": repo_hash.repository.owner,
-        "repo": repo_hash.repository.name,
-        "rev": repo_hash.rev,
-        "sha256": repo_hash.sha256,
-        "fetchSubmodules": repo_hash.fetch_submodules,
-    }
+    return json.loads(result.stdout)
 
 
 def get_repo_hash(fetcher="fetchFromGitHub", **kwargs):