mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-04 12:53:05 +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" ```
74 lines
1.7 KiB
Nix
74 lines
1.7 KiB
Nix
{ lib
|
|
, rustPlatform
|
|
, fetchFromGitHub
|
|
, installShellFiles
|
|
, pkg-config
|
|
, oniguruma
|
|
, openssl
|
|
, stdenv
|
|
, darwin
|
|
, python3
|
|
, perl
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "bws";
|
|
version = "0.4.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "bitwarden";
|
|
repo = "sdk";
|
|
rev = "bws-v${version}";
|
|
hash = "sha256-oCAyUTVAUfXBEb2K7vkYBOzcwqCsm2wxEKsYLZcfm6w=";
|
|
};
|
|
|
|
cargoLock = {
|
|
lockFile = ./Cargo.lock;
|
|
outputHashes = {
|
|
"uniffi-0.25.2" = "sha256-YckrtociJV3VKGs5DJ0a1r1Cvq06S/mtr9iL1kLmAi8=";
|
|
};
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
pkg-config
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
perl
|
|
];
|
|
|
|
buildInputs =
|
|
[
|
|
oniguruma
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
openssl
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
|
];
|
|
|
|
env = {
|
|
PYO3_PYTHON = "${python3}/bin/python3";
|
|
RUSTONIG_SYSTEM_LIBONIG = true;
|
|
};
|
|
|
|
cargoBuildFlags = [ "--package" "bws" ];
|
|
|
|
cargoTestFlags = [ "--package" "bws" ];
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd bws \
|
|
--bash <($out/bin/bws completions bash) \
|
|
--fish <($out/bin/bws completions fish) \
|
|
--zsh <($out/bin/bws completions zsh)
|
|
'';
|
|
|
|
meta = {
|
|
changelog = "https://github.com/bitwarden/sdk/blob/${src.rev}/crates/bws/CHANGELOG.md";
|
|
description = "Bitwarden Secrets Manager CLI";
|
|
homepage = "https://bitwarden.com/help/secrets-manager-cli/";
|
|
license = lib.licenses.unfree; # BITWARDEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT
|
|
mainProgram = "bws";
|
|
maintainers = with lib.maintainers; [ dit7ya ];
|
|
};
|
|
}
|