Skip to content

Commit

Permalink
dxvk,vkd3d-proton: use submodules with v4 npins format
Browse files Browse the repository at this point in the history
  • Loading branch information
LunNova committed Nov 1, 2023
1 parent 923e530 commit 0bdbef6
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 32 deletions.
75 changes: 55 additions & 20 deletions npins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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`"
27 changes: 19 additions & 8 deletions npins/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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"
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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
}
3 changes: 2 additions & 1 deletion pkgs/dxvk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion pkgs/vkd3d-proton/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
4 changes: 2 additions & 2 deletions pkgs/wineprefix-preparer/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
''

0 comments on commit 0bdbef6

Please sign in to comment.