From 0bdbef60f855ee53091772deec3f14bba049ff2b Mon Sep 17 00:00:00 2001 From: Luna Nova Date: Wed, 1 Nov 2023 05:11:16 -0700 Subject: [PATCH] dxvk,vkd3d-proton: use submodules with v4 npins format --- npins/default.nix | 75 ++++++++++++++++++++-------- npins/sources.json | 27 +++++++--- pkgs/dxvk/default.nix | 3 +- pkgs/vkd3d-proton/default.nix | 3 +- pkgs/wineprefix-preparer/default.nix | 4 +- 5 files changed, 80 insertions(+), 32 deletions(-) diff --git a/npins/default.nix b/npins/default.nix index 4a7c3728..2dd49d0e 100644 --- a/npins/default.nix +++ b/npins/default.nix @@ -3,45 +3,80 @@ let data = builtins.fromJSON (builtins.readFile ./sources.json); version = data.version; - mkSource = spec: - assert spec ? type; let + mkSource = + spec: + assert spec ? type; + let path = - if spec.type == "Git" then mkGitSource spec - else if spec.type == "GitRelease" then mkGitSource spec - else if spec.type == "PyPi" then mkPyPiSource spec - else if spec.type == "Channel" then mkChannelSource spec - else builtins.throw "Unknown source type ${spec.type}"; + if spec.type == "Git" then + mkGitSource spec + else if spec.type == "GitRelease" then + mkGitSource spec + else if spec.type == "PyPi" then + mkPyPiSource spec + else if spec.type == "Channel" then + mkChannelSource spec + else + builtins.throw "Unknown source type ${spec.type}" + ; in spec // { outPath = path; }; - mkGitSource = { repository, revision, url ? null, hash, ... }: + mkGitSource = + { + repository, + revision, + url ? null, + submodules, + hash, + ... + }: assert repository ? type; # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository # In the latter case, there we will always be an url to the tarball - if url != null then - (builtins.fetchTarball { + if url != null && !submodules then + builtins.fetchTarball { inherit url; sha256 = hash; # FIXME: check nix version & use SRI hashes - }) - else assert repository.type == "Git"; builtins.fetchGit { - url = repository.url; - rev = revision; - # hash = hash; - }; + } + else + let + url = + if repository.type == "Git" then + repository.url + else if repository.type == "GitHub" then + "https://github.com/${repository.owner}/${repository.repo}.git" + else if repository.type == "GitLab" then + "${repository.server}/${repository.repo_path}.git" + else + throw "Invalid JSON file" + ; + in + builtins.fetchGit { + rev = revision; + # hash = hash; + inherit url submodules; + } + ; - mkPyPiSource = { url, hash, ... }: + mkPyPiSource = + { url, hash, ... }: builtins.fetchurl { inherit url; sha256 = hash; }; - mkChannelSource = { url, hash, ... }: + mkChannelSource = + { url, hash, ... }: builtins.fetchTarball { inherit url; sha256 = hash; }; in -if version == 3 then +if version == 4 then builtins.mapAttrs (_: mkSource) data.pins else - throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" + throw + "Unsupported format version ${ + toString version + } in sources.json. Try running `npins upgrade`" diff --git a/npins/sources.json b/npins/sources.json index 12b40d0c..2860718e 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -9,6 +9,7 @@ }, "pre_releases": false, "version_upper_bound": null, + "submodules": false, "version": "v2023.10.0", "revision": "3cea4439c25285c282bc2a7e7caa989780a1bdeb", "url": "https://api.github.com/repos/FAForever/downlords-faf-client/tarball/v2023.10.0", @@ -23,6 +24,7 @@ }, "pre_releases": true, "version_upper_bound": null, + "submodules": false, "version": "v2023.10.1-alpha-1", "revision": "5ba10c41e889ad31c200e08db7cef0cab74939e0", "url": "https://api.github.com/repos/FAForever/downlords-faf-client/tarball/v2023.10.1-alpha-1", @@ -36,11 +38,12 @@ "repo": "dxvk" }, "pre_releases": false, - "version_upper_bound": null, - "version": "v2.3", - "revision": "f328343a23c9ad4af9148c06a0f75a77242c0457", - "url": "https://api.github.com/repos/doitsujin/dxvk/tarball/v2.3", - "hash": "1ykqbgsp22fsaca24ryiav9mgvqvw10rjbgi264mx1nl3yj6w0pi" + "version_upper_bound": "2.1", + "submodules": true, + "version": "v2.0", + "revision": "1f31c4e0e9865d028014c6976c9c2c991b19a109", + "url": null, + "hash": "01hhg70kapnva592kd6wbs6y9c3gcpjfx5cm1azgkchbhaz4a8wr" }, "dxvk-async": { "type": "GitRelease", @@ -51,6 +54,7 @@ }, "pre_releases": false, "version_upper_bound": null, + "submodules": false, "version": "2.0", "revision": "8665e600c04f9df2958f1b7aa348fa63f2ae24a9", "url": "https://api.github.com/repos/Sporif/dxvk-async/tarball/2.0", @@ -65,6 +69,7 @@ }, "pre_releases": false, "version_upper_bound": null, + "submodules": false, "version": "v3.3.2", "revision": "2807bf94ad0dea9df950cd0277918c72c15ea3ee", "url": "https://api.github.com/repos/FAForever/java-ice-adapter/tarball/v3.3.2", @@ -79,6 +84,7 @@ }, "pre_releases": false, "version_upper_bound": null, + "submodules": false, "version": "v4.0.5", "revision": "5a2c98d2213492287b724429707f0bc7f6fa017f", "url": "https://api.github.com/repos/FAForever/uid/tarball/v4.0.5", @@ -93,6 +99,7 @@ }, "pre_releases": false, "version_upper_bound": null, + "submodules": false, "version": "2023.1026.0", "revision": "dbf0b2e318b6ead068b7f71848d1cd8e0fcd9148", "url": "https://api.github.com/repos/ppy/osu/tarball/2023.1026.0", @@ -106,6 +113,7 @@ "repo": "proton-wine" }, "branch": "Proton8-22", + "submodules": false, "revision": "d5a97061ec96dbbceccec3a7f3ba54b39738fbdd", "url": "https://github.com/GloriousEggroll/proton-wine/archive/d5a97061ec96dbbceccec3a7f3ba54b39738fbdd.tar.gz", "hash": "1fdj8jawh7jip4i0aiqr1x0hln5hydrrnzx2yacyv6d4fwhjnvvx" @@ -119,10 +127,11 @@ }, "pre_releases": false, "version_upper_bound": null, + "submodules": true, "version": "v2.10", "revision": "88e4f300cc0b5b6f0880c1233d562cf506b546fb", - "url": "https://api.github.com/repos/HansKristian-Work/vkd3d-proton/tarball/v2.10", - "hash": "12835ym6hvf29l4a5giysxr79z6kn134zx4i10cwc2g2qirlyz9p" + "url": null, + "hash": "1jlpd0am2282ryb84824ibsn0cxjjw62871ahhd6h0n74mn7kjl5" }, "wine-discord-ipc-bridge": { "type": "GitRelease", @@ -133,6 +142,7 @@ }, "pre_releases": false, "version_upper_bound": null, + "submodules": false, "version": "v0.0.2", "revision": "dd649284cdbb41927e504b122a478aa5ae5ece60", "url": "https://api.github.com/repos/0e4ef622/wine-discord-ipc-bridge/tarball/v0.0.2", @@ -146,10 +156,11 @@ "repo": "wine-tkg" }, "branch": "master", + "submodules": false, "revision": "f4aed6f69f1a7d3e9482677b959524551e2aaab9", "url": "https://github.com/Kron4ek/wine-tkg/archive/f4aed6f69f1a7d3e9482677b959524551e2aaab9.tar.gz", "hash": "0b0407qjd2vks9ngwz90gkbldf7ypa7qd6snj0mv0dz4cbmrcs0s" } }, - "version": 3 + "version": 4 } \ No newline at end of file diff --git a/pkgs/dxvk/default.nix b/pkgs/dxvk/default.nix index eb46d251..3ae9c180 100644 --- a/pkgs/dxvk/default.nix +++ b/pkgs/dxvk/default.nix @@ -36,7 +36,8 @@ in mesonFlags = ["--buildtype=release"]; postInstall = lib.optionalString stdenv.targetPlatform.isWindows '' - ln -s ${windows.mcfgthreads}/bin/mcfgthread-12.dll $out/bin/mcfgthread-12.dll + [ -f ${windows.mcfgthreads_pre_gcc_13}/bin/mcfgthread-12.dll ] + ln -s ${windows.mcfgthreads_pre_gcc_13}/bin/mcfgthread-12.dll $out/bin/mcfgthread-12.dll ''; src = dxvk; diff --git a/pkgs/vkd3d-proton/default.nix b/pkgs/vkd3d-proton/default.nix index d9e3a2be..c2a73147 100644 --- a/pkgs/vkd3d-proton/default.nix +++ b/pkgs/vkd3d-proton/default.nix @@ -39,7 +39,8 @@ stdenv.mkDerivation { ]; postInstall = lib.optionalString stdenv.targetPlatform.isWindows '' - ln -s ${windows.mcfgthreads}/bin/mcfgthread-12.dll $out/bin/mcfgthread-12.dll + [ -f ${windows.mcfgthreads_pre_gcc_13}/bin/mcfgthread-12.dll ] + ln -s ${windows.mcfgthreads_pre_gcc_13}/bin/mcfgthread-12.dll $out/bin/mcfgthread-12.dll ''; mesonFlags = diff --git a/pkgs/wineprefix-preparer/default.nix b/pkgs/wineprefix-preparer/default.nix index 6e7ffd8c..8b240e96 100644 --- a/pkgs/wineprefix-preparer/default.nix +++ b/pkgs/wineprefix-preparer/default.nix @@ -36,7 +36,7 @@ writeShellScriptBin "wineprefix-preparer" echo "Found 32 bit path $win32_sys_path and 64 bit path $win64_sys_path" echo "Removing existing dxvk and vkd3d-proton DLLs" - rm -rf {"$win32_sys_path","$win64_sys_path"}/{dxgi,d3d9,d3d10core,d3d11,d3d12}.dll + rm -rf {"$win32_sys_path","$win64_sys_path"}/{dxgi,d3d9,d3d10core,d3d11,d3d12,d3d12core}.dll echo "Installing dxvk DLLs" install -v -D -m644 -t "$win64_sys_path" ${dxvk-w64}/bin/*.dll @@ -47,7 +47,7 @@ writeShellScriptBin "wineprefix-preparer" install -v -D -m644 -t "$win32_sys_path" ${vkd3d-proton-w32}/bin/*.dll echo "Adding native DllOverrides" - for dll in dxgi d3d9 d3d10core d3d11 d3d12; do + for dll in dxgi d3d9 d3d10core d3d11 d3d12 d3d12core; do wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $dll /d native /f >/dev/null 2>&1 done ''