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" ```
53 lines
1.1 KiB
Nix
53 lines
1.1 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
buildPythonPackage,
|
|
pytest,
|
|
pythonOlder,
|
|
xclip,
|
|
xvfb-run,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "pyclip";
|
|
version = "0.7.0";
|
|
format = "setuptools";
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "spyoungtech";
|
|
repo = pname;
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-0nOkNgT8XCwtXI9JZntkhoMspKQU602rTKBFajVKBoM=";
|
|
};
|
|
|
|
postPatch = ''
|
|
substituteInPlace setup.py \
|
|
--replace docs/README.md README.md
|
|
'';
|
|
|
|
nativeCheckInputs =
|
|
[ pytest ]
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
xclip
|
|
xvfb-run
|
|
];
|
|
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
${lib.optionalString stdenv.hostPlatform.isLinux "xvfb-run -s '-screen 0 800x600x24'"} pytest tests
|
|
runHook postCheck
|
|
'';
|
|
|
|
meta = {
|
|
broken = stdenv.hostPlatform.isDarwin;
|
|
description = "Cross-platform clipboard utilities supporting both binary and text data";
|
|
mainProgram = "pyclip";
|
|
homepage = "https://github.com/spyoungtech/pyclip";
|
|
license = lib.licenses.asl20;
|
|
maintainers = with lib.maintainers; [ mcaju ];
|
|
};
|
|
}
|