mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
34 lines
1.1 KiB
Nix
34 lines
1.1 KiB
Nix
{ stdenv, lib, fetchFromGitHub, cmake, libusb1, pkg-config, libglut, libGLU, libGL, libXi, libXmu
|
|
, GLUT, Cocoa
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "freenect";
|
|
version = "0.7.5";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "OpenKinect";
|
|
repo = "libfreenect";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-PpJGFWrlQ5sK7TJxQNoPujw1MxWRjphvblwOqnF+mSg=";
|
|
};
|
|
|
|
buildInputs = [ libusb1 libglut libGLU libGL libXi libXmu ]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ GLUT Cocoa ];
|
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
|
|
|
# see https://aur.archlinux.org/cgit/aur.git/commit/PKGBUILD?h=libfreenect&id=0d17db49ba64bcb9e3a4eed61cf55c9a5ceb97f1
|
|
patchPhase = lib.concatMapStrings (x: ''
|
|
substituteInPlace ${x} --replace "{GLUT_LIBRARY}" "{GLUT_LIBRARIES}"
|
|
'') [ "examples/CMakeLists.txt" "wrappers/cpp/CMakeLists.txt" ];
|
|
|
|
meta = {
|
|
description = "Drivers and libraries for the Xbox Kinect device on Windows, Linux, and macOS";
|
|
homepage = "http://openkinect.org";
|
|
license = with lib.licenses; [ gpl2 asl20 ];
|
|
maintainers = with lib.maintainers; [ bennofs ];
|
|
platforms = with lib.platforms; linux ++ darwin ;
|
|
};
|
|
}
|