···365365 pkgs.xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
366366 ];
367367 optionalPackages = [
368368+ pkgs.aha # needed by kinfocenter for fwupd support
368369 plasma-browser-integration
369370 konsole
370371 oxygen
···11{ lib
22-, pkgs
32, stdenvNoCC
43, fetchFromGitHub
54, pkgsCross
55+, stdenv
66+, bash
67}:
7889stdenvNoCC.mkDerivation (finalAttrs:
910 let
1010- system = lib.toLower stdenvNoCC.targetPlatform.uname.system;
1111-1212- # DXVK needs to be a separate derivation because it’s actually a set of DLLs for Windows that
1313- # needs to be built with a cross-compiler.
1414- dxvk32 = pkgsCross.mingw32.callPackage ./dxvk.nix {
1515- inherit (finalAttrs) src version dxvkPatches;
1616- };
1717- dxvk64 = pkgsCross.mingwW64.callPackage ./dxvk.nix {
1818- inherit (finalAttrs) src version dxvkPatches;
1919- };
2020-2121- # Split out by platform to make maintenance easy in case supported versions on Darwin and other
2222- # platforms diverge (due to the need for Darwin-specific patches that would fail to apply).
2323- # Should that happen, set `darwin` to the last working `rev` and `hash`.
2424- srcs = rec {
2525- darwin = {
2626- rev = "v${finalAttrs.version}";
2727- hash = "sha256-T93ZylxzJGprrP+j6axZwl2d3hJowMCUOKNjIyNzkmE=";
2828- version = "1.10.3";
2929- };
3030- default = {
3131- rev = "v${finalAttrs.version}";
3232- hash = "sha256-mboVLdPgZMzmqyeF0jAloEz6xqfIDiY/X98e7l2KZnw=";
3333- version = "2.0";
3434- };
3535- };
1111+ dxvk32 = if stdenv.isDarwin then pkgsCross.mingw32.dxvk_1 else pkgsCross.mingw32.dxvk_2;
1212+ dxvk64 = if stdenv.isDarwin then pkgsCross.mingwW64.dxvk_1 else pkgsCross.mingwW64.dxvk_2;
3613 in
3714 {
3815 name = "dxvk";
3939- inherit (srcs."${system}" or srcs.default) version;
4040-4141- src = fetchFromGitHub {
4242- owner = "doitsujin";
4343- repo = "dxvk";
4444- inherit (srcs."${system}" or srcs.default) rev hash;
4545- };
4646-4747- # Override this to patch DXVK itself (rather than the setup script).
4848- dxvkPatches = lib.optionals stdenvNoCC.isDarwin [
4949- # Patch DXVK to work with MoltenVK even though it doesn’t support some required features.
5050- # Some games work poorly (particularly Unreal Engine 4 games), but others work pretty well.
5151- ./darwin-dxvk-compat.patch
5252- # Use synchronization primitives from the C++ standard library to avoid deadlocks on Darwin.
5353- # See: https://www.reddit.com/r/macgaming/comments/t8liua/comment/hzsuce9/
5454- ./darwin-thread-primitives.patch
5555- ];
1616+ inherit (dxvk64) version;
56175718 outputs = [ "out" "bin" "lib" ];
58195959- # Also copy `mcfgthread-12.dll` due to DXVK’s being built in a MinGW cross environment.
6060- patches = [ ./mcfgthread.patch ];
6161-2020+ dontUnpack = true;
6221 dontConfigure = true;
6322 dontBuild = true;
64236524 installPhase = ''
6625 mkdir -p $out/bin $bin $lib
6767- # Replace both basedir forms to support both DXVK 2.0 and older versions.
6868- substitute setup_dxvk.sh $out/bin/setup_dxvk.sh \
2626+ substitute ${./setup_dxvk.sh} $out/bin/setup_dxvk.sh \
2727+ --subst-var-by bash ${bash} \
2828+ --subst-var-by dxvk32 ${dxvk32} \
2929+ --subst-var-by dxvk64 ${dxvk64} \
6930 --subst-var-by mcfgthreads32 "${pkgsCross.mingw32.windows.mcfgthreads}" \
7070- --subst-var-by mcfgthreads64 "${pkgsCross.mingwW64.windows.mcfgthreads}" \
7171- --replace 'basedir=$(dirname "$(readlink -f $0)")' "basedir=$bin" \
7272- --replace 'basedir="$(dirname "$(readlink -f "$0")")"' "basedir=$bin"
3131+ --subst-var-by mcfgthreads64 "${pkgsCross.mingwW64.windows.mcfgthreads}"
7332 chmod a+x $out/bin/setup_dxvk.sh
7433 declare -A dxvks=( [x32]=${dxvk32} [x64]=${dxvk64} )
7534 for arch in "''${!dxvks[@]}"; do
···7938 '';
80398140 meta = {
8282- description = "A Vulkan-based translation layer for Direct3D 9/10/11";
4141+ description = "Setup script for DXVK";
8342 homepage = "https://github.com/doitsujin/dxvk";
8443 changelog = "https://github.com/doitsujin/dxvk/releases";
8544 maintainers = [ lib.maintainers.reckenrode ];
+67-14
pkgs/misc/dxvk/dxvk.nix
···55, meson
66, ninja
77, windows
88-, src
99-, version
88+, dxvkVersion
109, spirv-headers
1110, vulkan-headers
1212-, dxvkPatches
1111+, SDL2
1212+, glfw
1313+, pkgsBuildHost
1414+, sdl2Support ? true
1515+, glfwSupport ? false
1316}:
14171818+# SDL2 and GLFW support are mutually exclusive.
1919+assert !sdl2Support || !glfwSupport;
2020+1521let
1622 # DXVK 2.0+ no longer vendors certain dependencies. This derivation also needs to build on Darwin,
1723 # which does not currently support DXVK 2.0, so adapt conditionally for this situation.
1818- isDxvk2 = lib.versionAtLeast version "2.0";
2424+ isDxvk2 = lib.versionAtLeast (srcs.${dxvkVersion}.version) "2.0";
2525+2626+ # DXVK has effectively the same build script regardless of platform.
2727+ srcs = {
2828+ "1.10" = rec {
2929+ version = "1.10.3";
3030+ src = fetchFromGitHub {
3131+ owner = "doitsujin";
3232+ repo = "dxvk";
3333+ rev = "v${version}";
3434+ hash = "sha256-T93ZylxzJGprrP+j6axZwl2d3hJowMCUOKNjIyNzkmE=";
3535+ };
3636+ # These patches are required when using DXVK with Wine on Darwin.
3737+ patches = lib.optionals stdenv.buildPlatform.isDarwin [
3838+ # Patch DXVK to work with MoltenVK even though it doesn’t support some required features.
3939+ # Some games work poorly (particularly Unreal Engine 4 games), but others work pretty well.
4040+ ./darwin-dxvk-compat.patch
4141+ # Use synchronization primitives from the C++ standard library to avoid deadlocks on Darwin.
4242+ # See: https://www.reddit.com/r/macgaming/comments/t8liua/comment/hzsuce9/
4343+ ./darwin-thread-primitives.patch
4444+ ];
4545+ };
4646+ "2.1" = rec {
4747+ version = "2.1";
4848+ src = fetchFromGitHub {
4949+ owner = "doitsujin";
5050+ repo = "dxvk";
5151+ rev = "v${version}";
5252+ hash = "sha256-A4KR11brfQbR56dGt371MRwMN/H6HFAU8TlFC97/bRs=";
5353+ fetchSubmodules = true; # Needed for the DirectX headers and libdisplay-info
5454+ };
5555+ patches = [ ];
5656+ };
5757+ };
5858+5959+ isWindows = stdenv.targetPlatform.uname.system == "Windows";
6060+ isCross = stdenv.hostPlatform != stdenv.targetPlatform;
1961in
2062stdenv.mkDerivation {
2163 pname = "dxvk";
2222- inherit src version;
6464+ inherit (srcs.${dxvkVersion}) version src patches;
23652466 nativeBuildInputs = [ glslang meson ninja ];
2525- buildInputs = [ windows.pthreads ]
2626- ++ lib.optionals isDxvk2 [ spirv-headers vulkan-headers ];
6767+ buildInputs = lib.optional isWindows [ windows.pthreads ]
6868+ ++ lib.optionals isDxvk2 (
6969+ [ spirv-headers vulkan-headers ]
7070+ ++ lib.optional (!isWindows && sdl2Support) SDL2
7171+ ++ lib.optional (!isWindows && glfwSupport) glfw
7272+ );
27732828- patches = dxvkPatches;
7474+ postPatch = lib.optionalString isDxvk2 ''
7575+ substituteInPlace "subprojects/libdisplay-info/tool/gen-search-table.py" \
7676+ --replace "/usr/bin/env python3" "${lib.getBin pkgsBuildHost.python3}/bin/python3"
7777+ '';
29783030- preConfigure = lib.optionalString isDxvk2 ''
3131- ln -s ${lib.getDev spirv-headers}/include include/spirv/include
3232- ln -s ${lib.getDev vulkan-headers}/include include/vulkan/include
7979+ # Build with the Vulkan SDK in nixpkgs.
8080+ preConfigure = ''
8181+ rm -rf include/spirv/include include/vulkan/include
8282+ mkdir -p include/spirv/include include/vulkan/include
3383 '';
34843585 mesonFlags =
···3888 in
3989 [
4090 "--buildtype" "release"
4141- "--cross-file" "build-win${arch}.txt"
4291 "--prefix" "${placeholder "out"}"
4343- ];
9292+ ]
9393+ ++ lib.optionals isCross [ "--cross-file" "build-win${arch}.txt" ]
9494+ ++ lib.optional glfwSupport "-Ddxvk_native_wsi=glfw";
9595+9696+ doCheck = isDxvk2 && !isCross;
44974598 meta = {
4699 description = "A Vulkan-based translation layer for Direct3D 9/10/11";
···48101 changelog = "https://github.com/doitsujin/dxvk/releases";
49102 maintainers = [ lib.maintainers.reckenrode ];
50103 license = lib.licenses.zlib;
5151- platforms = lib.platforms.windows;
104104+ platforms = lib.platforms.windows ++ lib.optionals isDxvk2 lib.platforms.linux;
52105 };
53106}
···11+{ lib, mkDiscoursePlugin, fetchFromGitHub }:
22+33+mkDiscoursePlugin {
44+ name = "discourse-reactions";
55+ src = fetchFromGitHub {
66+ owner = "discourse";
77+ repo = "discourse-reactions";
88+ rev = "3afaabc8e430dfe655be4efbbcb20ab7f0c7c8d3";
99+ sha256 = "sha256-CdrInrPFDpvYW7j0epIeAFUoPGTbmMOGdm2DpkIQBbs=";
1010+ };
1111+ meta = with lib; {
1212+ homepage = "https://github.com/discourse/discourse-reactions";
1313+ maintainers = with maintainers; [ bbenno ];
1414+ license = licenses.mit;
1515+ description = "Allows users to react to a post from a choice of emojis, rather than only the like heart";
1616+ };
1717+}