mirror of
https://github.com/WiVRn/WiVRn.git
synced 2026-11-20 00:51:32 -08:00
121 lines
4.5 KiB
Nix
121 lines
4.5 KiB
Nix
{
|
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
outputs =
|
|
inputs@{ nixpkgs, flake-parts, ... }:
|
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
|
systems = [ "x86_64-linux" ];
|
|
perSystem =
|
|
{ lib, pkgs, ... }:
|
|
let
|
|
# Extra build inputs only inside the devShell.
|
|
devBuildInputs = [
|
|
# for client build
|
|
pkgs.curl
|
|
pkgs.ktx-tools
|
|
];
|
|
# Tools used for development work (clangd, clang-format)
|
|
devTools = [
|
|
pkgs.clang-tools
|
|
pkgs.gdb
|
|
pkgs.ktx-tools
|
|
];
|
|
# Extra build inputs not yet in the nixpkgs recipe.
|
|
extraBuildInputs = [
|
|
# XRT_FEATURE_DEBUG_GUI requires SDL2
|
|
pkgs.sdl2-compat
|
|
|
|
pkgs.libpng
|
|
pkgs.kdePackages.kirigami-addons
|
|
];
|
|
extraNativeBuildInputs = [
|
|
pkgs.ninja
|
|
pkgs.util-linux
|
|
];
|
|
|
|
package = pkgs.enableDebugging (
|
|
pkgs.wivrn.overrideAttrs (
|
|
finalAttrs: oldAttrs: {
|
|
# Filter the directories and files we don't need to keep to avoid needless rebuilds
|
|
src = lib.cleanSourceWith {
|
|
filter =
|
|
name: type:
|
|
let
|
|
baseName = baseNameOf (toString name);
|
|
in
|
|
(lib.cleanSourceFilter name type)
|
|
&& !(
|
|
(
|
|
type == "directory"
|
|
&& (baseName == ".direnv" || baseName == ".cxx" || lib.hasPrefix "build" baseName)
|
|
)
|
|
|| baseName == ".envrc"
|
|
);
|
|
src = ./.;
|
|
};
|
|
version = "next";
|
|
|
|
# Because src is just a folder path and not a set from a fetcher, it doesn't need to be unpacked, so having a postUnpack throws an error.
|
|
# We also don't need the check since we read the revision from the monado-rev file.
|
|
postUnpack = null;
|
|
|
|
separateDebugInfo = false;
|
|
|
|
monado = pkgs.applyPatches {
|
|
inherit (oldAttrs.monado) patches postPatch;
|
|
# Force a refetch when the monado rev changes.
|
|
src = pkgs.testers.invalidateFetcherByDrvHash pkgs.fetchFromGitLab {
|
|
inherit (oldAttrs.monado.src) owner repo;
|
|
domain = "gitlab.freedesktop.org";
|
|
# Keep in sync with CMakeLists.txt monado rev
|
|
rev = lib.strings.trim (builtins.readFile ./monado-rev);
|
|
# Nix will output the correct hash when it doesn't match
|
|
hash = "sha256-yGkuD2jAG/ACSGkH1Cz8o23wHLtEqtNCUe2kS5OyC68=";
|
|
};
|
|
};
|
|
|
|
buildInputs = oldAttrs.buildInputs ++ extraBuildInputs;
|
|
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ extraNativeBuildInputs;
|
|
cmakeFlags = (lib.filter (flag: !lib.hasInfix "GIT_" flag) oldAttrs.cmakeFlags) ++ [
|
|
(lib.cmakeFeature "GIT_DESC" "nightly")
|
|
(lib.cmakeFeature "GIT_COMMIT" "nightly")
|
|
];
|
|
}
|
|
)
|
|
);
|
|
in
|
|
{
|
|
formatter = pkgs.nixfmt;
|
|
|
|
packages = {
|
|
default = package;
|
|
dissector = package.overrideAttrs (oldAttrs: {
|
|
pname = "wivrn-dissector";
|
|
cmakeFlags = (lib.filter (flag: !(lib.hasPrefix "-DWIVRN_BUILD" flag)) oldAttrs.cmakeFlags) ++ [
|
|
(lib.cmakeBool "WIVRN_BUILD_CLIENT" false)
|
|
(lib.cmakeBool "WIVRN_BUILD_SERVER" false)
|
|
(lib.cmakeBool "WIVRN_BUILD_DASHBOARD" false)
|
|
(lib.cmakeBool "WIVRN_BUILD_WIVRNCTL" false)
|
|
(lib.cmakeBool "WIVRN_BUILD_DISSECTOR" true)
|
|
];
|
|
buildInputs = oldAttrs.buildInputs ++ [
|
|
(pkgs.symlinkJoin {
|
|
name = "wireshark-dev-out-combined";
|
|
paths = [
|
|
pkgs.wireshark.out
|
|
pkgs.wireshark.dev
|
|
];
|
|
})
|
|
];
|
|
preFixup = null;
|
|
});
|
|
};
|
|
devShells.default = package.overrideAttrs (oldAttrs: {
|
|
buildInputs = oldAttrs.buildInputs ++ devBuildInputs;
|
|
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ devTools;
|
|
});
|
|
};
|
|
};
|
|
}
|