about summary refs log tree commit diff
path: root/pkgs/tools/security/bws/default.nix
blob: 292e2d3b3030f5865d27b243a84769950732cad8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ lib
, rustPlatform
, fetchFromGitHub
, 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 = [
    perl
    pkg-config
  ];

  buildInputs =
    [
      oniguruma
      openssl
    ]
    ++ lib.optionals stdenv.isDarwin [
      darwin.apple_sdk.frameworks.Security
    ];

  env = {
    PYO3_PYTHON = "${python3}/bin/python3";
    RUSTONIG_SYSTEM_LIBONIG = true;
  };

  buildAndTestSubdir = "crates/bws";

  meta = {
    changelog = "https://github.com/bitwarden/sdk/blob/${src.rev}/CHANGELOG.md";
    description = "Bitwarden Secrets Manager CLI";
    homepage = "https://github.com/bitwarden/sdk";
    license = lib.licenses.unfree; # BITWARDEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT
    mainProgram = "bws";
    maintainers = with lib.maintainers; [ dit7ya ];
  };
}