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" ```
86 lines
1.8 KiB
Nix
86 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
pythonOlder,
|
|
installShellFiles,
|
|
setuptools-scm,
|
|
shtab,
|
|
importlib-metadata,
|
|
jaraco-classes,
|
|
jaraco-context,
|
|
jaraco-functools,
|
|
jeepney,
|
|
secretstorage,
|
|
pyfakefs,
|
|
pytestCheckHook,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "keyring";
|
|
version = "25.4.0";
|
|
pyproject = true;
|
|
disabled = pythonOlder "3.8";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "jaraco";
|
|
repo = "keyring";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-B1uU4INod2iSXIftPlDOr7mzWPY3FTpLhUuInl1Hg/M=";
|
|
};
|
|
|
|
build-system = [ setuptools-scm ];
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
shtab
|
|
];
|
|
|
|
dependencies =
|
|
[
|
|
jaraco-classes
|
|
jaraco-context
|
|
jaraco-functools
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
jeepney
|
|
secretstorage
|
|
]
|
|
++ lib.optionals (pythonOlder "3.12") [ importlib-metadata ];
|
|
|
|
postInstall = ''
|
|
installShellCompletion --cmd keyring \
|
|
--bash <($out/bin/keyring --print-completion bash) \
|
|
--zsh <($out/bin/keyring --print-completion zsh)
|
|
'';
|
|
|
|
pythonImportsCheck = [
|
|
"keyring"
|
|
"keyring.backend"
|
|
];
|
|
|
|
nativeCheckInputs = [
|
|
pyfakefs
|
|
pytestCheckHook
|
|
];
|
|
|
|
disabledTestPaths =
|
|
[ "tests/backends/test_macOS.py" ]
|
|
# These tests fail when sandboxing is enabled because they are unable to get a password from keychain.
|
|
++ lib.optional stdenv.hostPlatform.isDarwin "tests/test_multiprocess.py";
|
|
|
|
meta = with lib; {
|
|
description = "Store and access your passwords safely";
|
|
homepage = "https://github.com/jaraco/keyring";
|
|
changelog = "https://github.com/jaraco/keyring/blob/v${version}/NEWS.rst";
|
|
license = licenses.mit;
|
|
mainProgram = "keyring";
|
|
maintainers = with maintainers; [
|
|
lovek323
|
|
dotlambda
|
|
];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|