about summary refs log tree commit diff
path: root/pkgs/tools/misc/rtz/default.nix
blob: 3d7670991a5bfeafc779dae4cd8085b6da6a66e4 (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
61
62
63
64
65
66
67
68
69
70
{ lib
, rustPlatform
, fetchFromGitHub
, fetchurl
, pkg-config
, bzip2
, openssl
, zstd
, stdenv
, darwin
}:

rustPlatform.buildRustPackage rec {
  pname = "rtz";
  version = "0.7.0";

  src = fetchFromGitHub {
    owner = "twitchax";
    repo = "rtz";
    rev = "v${version}";
    hash = "sha256-Wfb3FEZHjWYUtRI4Qn3QNunIXuzW1AIEZkIvtVrjBPs=";
  };

  cargoLock = {
    lockFile = ./Cargo.lock;
    outputHashes = {
      "bincode-2.0.0-rc.3" = "sha256-YCoTnIKqRObeyfTanjptTYeD9U2b2c+d4CJFWIiGckI=";
    };
  };

  swagger-ui = fetchurl {
    url = "https://github.com/juhaku/utoipa/raw/master/utoipa-swagger-ui-vendored/res/v5.17.12.zip";
    hash = "sha256-HK4z/JI+1yq8BTBJveYXv9bpN/sXru7bn/8g5mf2B/I=";
  };

  nativeBuildInputs = [
    pkg-config
  ];

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

  buildFeatures = [ "web" ];

  # ${swagger-ui} is read-only and the copy made by the build script
  # is as well. Remove it so that checks can copy it again.
  preCheck = ''
    find target -name $(basename ${swagger-ui}) -delete
  '';

  env = {
    # use local data file instead of requiring network access
    SWAGGER_UI_DOWNLOAD_URL = "file://${swagger-ui}";
  };

  meta = with lib; {
    description = "Tool to easily work with timezone lookups via a binary, a library, or a server";
    homepage = "https://github.com/twitchax/rtz";
    changelog = "https://github.com/twitchax/rtz/releases/tag/${src.rev}";
    license = licenses.mit;
    maintainers = with maintainers; [ figsoda ];
    mainProgram = "rtz";
  };
}