about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/emulators/yuzu/default.nix
blob: ef9c12703f24284245aca3ab93d6ec61c209d7c6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ branch ? "mainline"
, qt6Packages
, fetchFromGitHub
, fetchgit
, fetchurl
, fetchzip
, runCommand
, gnutar
}:

let
  sources = import ./sources.nix;

  compat-list = fetchurl {
    name = "yuzu-compat-list";
    url = "https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/${sources.compatList.rev}/compatibility_list.json";
    hash = sources.compatList.hash;
  };

  mainlineSrc = fetchFromGitHub {
    owner = "yuzu-emu";
    repo = "yuzu-mainline";
    rev = "mainline-0-${sources.mainline.version}";
    hash = sources.mainline.hash;
    fetchSubmodules = true;
  };

  # The mirror repo for early access builds is missing submodule info,
  # but the Windows distributions include a source tarball, which in turn
  # includes the full git metadata. So, grab that and rehydrate it.
  # This has the unfortunate side effect of requiring two FODs, one
  # for the Windows download and one for the full repo with submodules.
  eaZip = fetchzip {
    name = "yuzu-ea-windows-dist";
    url = "https://github.com/pineappleEA/pineapple-src/releases/download/EA-${sources.ea.version}/Windows-Yuzu-EA-${sources.ea.version}.zip";
    hash = sources.ea.distHash;
  };

  eaGitSrc = runCommand "yuzu-ea-dist-unpacked" {
    src = eaZip;
    nativeBuildInputs = [ gnutar ];
  }
  ''
    mkdir $out
    tar xf $src/*.tar.xz --directory=$out --strip-components=1
  '';

  eaSrcRehydrated = fetchgit {
    url = eaGitSrc;
    fetchSubmodules = true;
    hash = sources.ea.fullHash;
  };

in {
  mainline = qt6Packages.callPackage ./generic.nix {
    branch = "mainline";
    version = sources.mainline.version;
    src = mainlineSrc;
    inherit compat-list;
  };

  early-access = qt6Packages.callPackage ./generic.nix {
    branch = "early-access";
    version = sources.ea.version;
    src = eaSrcRehydrated;
    inherit compat-list;
  };
}.${branch}