mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-21 04:13:12 +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" ```
108 lines
2.2 KiB
Nix
108 lines
2.2 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
pkg-config,
|
|
cython_0,
|
|
docutils,
|
|
kivy-garden,
|
|
mesa,
|
|
mtdev,
|
|
SDL2,
|
|
SDL2_image,
|
|
SDL2_ttf,
|
|
SDL2_mixer,
|
|
Accelerate,
|
|
ApplicationServices,
|
|
AVFoundation,
|
|
libcxx,
|
|
withGstreamer ? true,
|
|
gst_all_1,
|
|
packaging,
|
|
pillow,
|
|
pygments,
|
|
requests,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "kivy";
|
|
version = "2.3.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "kivy";
|
|
repo = "kivy";
|
|
rev = version;
|
|
hash = "sha256-QJ490vjpEj/JSE9OzSvDpkCruaTFdlThUHIEAMm0BZ4=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
cython_0
|
|
docutils
|
|
];
|
|
|
|
buildInputs =
|
|
[
|
|
SDL2
|
|
SDL2_image
|
|
SDL2_ttf
|
|
SDL2_mixer
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
mesa
|
|
mtdev
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
Accelerate
|
|
ApplicationServices
|
|
AVFoundation
|
|
libcxx
|
|
]
|
|
++ lib.optionals withGstreamer (
|
|
with gst_all_1;
|
|
[
|
|
# NOTE: The degree to which gstreamer actually works is unclear
|
|
gstreamer
|
|
gst-plugins-base
|
|
gst-plugins-good
|
|
gst-plugins-bad
|
|
]
|
|
);
|
|
|
|
propagatedBuildInputs = [
|
|
kivy-garden
|
|
packaging
|
|
pillow
|
|
pygments
|
|
requests
|
|
];
|
|
|
|
KIVY_NO_CONFIG = 1;
|
|
KIVY_NO_ARGS = 1;
|
|
KIVY_NO_FILELOG = 1;
|
|
# prefer pkg-config over hardcoded framework paths
|
|
USE_OSX_FRAMEWORKS = 0;
|
|
# work around python distutils compiling C++ with $CC (see issue #26709)
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
|
|
|
|
postPatch = lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
substituteInPlace kivy/lib/mtdev.py \
|
|
--replace "LoadLibrary('libmtdev.so.1')" "LoadLibrary('${mtdev}/lib/libmtdev.so.1')"
|
|
'';
|
|
|
|
/*
|
|
We cannot run tests as Kivy tries to import itself before being fully
|
|
installed.
|
|
*/
|
|
doCheck = false;
|
|
pythonImportsCheck = [ "kivy" ];
|
|
|
|
meta = with lib; {
|
|
description = "Library for rapid development of hardware-accelerated multitouch applications";
|
|
homepage = "https://pypi.python.org/pypi/kivy";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ risson ];
|
|
};
|
|
}
|