Skip to content

Instantly share code, notes, and snippets.

@ckiee
Last active March 16, 2024 12:43
Show Gist options
  • Select an option

  • Save ckiee/0162326cad0a2415570b36c69be80aac to your computer and use it in GitHub Desktop.

Select an option

Save ckiee/0162326cad0a2415570b36c69be80aac to your computer and use it in GitHub Desktop.

Revisions

  1. ckiee revised this gist Mar 16, 2024. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions package.nix
    Original file line number Diff line number Diff line change
    @@ -73,10 +73,6 @@ stdenv.mkDerivation rec {
    hash = "sha256-O6Eq7EQ427hOcN16Z33I74CevnHlX/a4ZAcljgc+vk8=";
    };

    patches = [
    ./0001-server-wivrn_session-Add-fps-field-to-header.patch
    ];

    prePatch = ''
    substituteInPlace ./server/CMakeLists.txt \
    --replace "../../../" "../../../../../.."
  2. ckiee created this gist Mar 13, 2024.
    139 changes: 139 additions & 0 deletions package.nix
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,139 @@
    { lib
    , stdenv
    , fetchFromGitHub
    , fetchFromGitLab
    , fetchpatch2
    , avahi
    , boost
    , cmake
    , cudaPackages
    , eigen
    , ffmpeg
    , freetype
    , git
    , glm
    , glslang
    , harfbuzz
    , libdrm
    , libva
    , libpulseaudio
    , libX11
    , libXrandr
    , monado
    , nlohmann_json
    , onnxruntime
    , openxr-loader
    , pkg-config
    , python3
    , shaderc
    , spdlog
    , systemd
    , udev
    , vulkan-headers
    , vulkan-loader
    , vulkan-tools
    , x264
    }:
    let
    vendorMonado = monado.overrideAttrs rec {
    # Version stated in CMakeList for WiVRn 0.12
    version = "ffb71af26f8349952f5f820c268ee4774613e200";

    src = fetchFromGitLab {
    domain = "gitlab.freedesktop.org";
    owner = "monado";
    repo = "monado";
    rev = version;
    hash = "sha256-+RTHS9ShicuzhiAVAXf38V6k4SVr+Bc2xUjpRWZoB0c=";
    };

    # FIXME: Never used? Since we only eval .src
    patches = [
    # WiVRn-specific patch
    (fetchpatch2 {
    name = "0001-c-multi-disable-dropping-of-old-frames.patch";
    url = "https://raw.githubusercontent.com/Meumeu/WiVRn/46d6d2181b62ecb976616a3b2396b9bd0ce345b4/patches/monado/0001-c-multi-disable-dropping-of-old-frames.patch";
    hash = "sha256-s/000000000/woCEOEZECdcZoJDoWc1eM63sd60cxeY=";
    })
    ];

    postInstall = ''
    mv src/xrt/compositor/libcomp_main.a $out/lib/libcomp_main.a
    '';
    };
    in
    stdenv.mkDerivation rec {
    pname = "wivrn";
    version = "0.12";

    src = fetchFromGitHub {
    owner = "meumeu";
    repo = "wivrn";
    rev = "v${version}";
    hash = "sha256-O6Eq7EQ427hOcN16Z33I74CevnHlX/a4ZAcljgc+vk8=";
    };

    patches = [
    ./0001-server-wivrn_session-Add-fps-field-to-header.patch
    ];

    prePatch = ''
    substituteInPlace ./server/CMakeLists.txt \
    --replace "../../../" "../../../../../.."
    '';

    nativeBuildInputs = [
    cmake
    cudaPackages.cuda_nvcc
    git
    pkg-config
    python3
    ];

    buildInputs = [
    avahi
    boost
    cudaPackages.cuda_cudart
    eigen
    ffmpeg
    freetype
    glm
    glslang
    harfbuzz
    libdrm
    libva
    libX11
    libXrandr
    libpulseaudio
    nlohmann_json
    onnxruntime
    openxr-loader
    shaderc
    spdlog
    systemd
    udev
    vulkan-headers
    vulkan-loader
    vulkan-tools
    x264
    ];

    cmakeFlags = [
    (lib.cmakeBool "WIVRN_BUILD_CLIENT" false)
    (lib.cmakeBool "WIVRN_USE_VAAPI" true)
    (lib.cmakeBool "WIVRN_USE_X264" true)
    (lib.cmakeBool "WIVRN_USE_NVENC" false)
    (lib.cmakeBool "FETCHCONTENT_FULLY_DISCONNECTED" true)
    (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_MONADO" "${vendorMonado.src}")
    ];

    meta = with lib; {
    description = "An OpenXR streaming application to a standalone headset";
    homepage = "https://github.com/Meumeu/WiVRn/";
    changelog = "https://github.com/Meumeu/WiVRn/releases/tag/v${version}";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ passivelemon ];
    platforms = platforms.linux;
    mainProgram = "wivrn-server";
    };
    }