aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/applications/misc/imag/default.nix
blob: f3d4e156d6cd2b666869befc15bbe1ec7a8f63d8 (plain)
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
{ stdenv
, rustPlatform
, fetchFromGitHub
, llvmPackages
, openssl
, pkg-config
, installShellFiles
, Security
, gitMinimal
, util-linuxMinimal
}:

rustPlatform.buildRustPackage rec {
  pname = "imag";
  version = "0.10.1";

  src = fetchFromGitHub {
    owner = "matthiasbeyer";
    repo = pname;
    rev = "v${version}";
    sha256 = "0f9915f083z5qqcxyavj0w6m973c8m1x7kfb89pah5agryy5mkaq";
  };

  nativeBuildInputs = [ installShellFiles pkg-config ];
  buildInputs = [ openssl ]
    ++ stdenv.lib.optional stdenv.isDarwin Security;
  checkInputs = [ gitMinimal util-linuxMinimal ];

  LIBCLANG_PATH = "${llvmPackages.libclang}/lib";

  cargoSha256 = "0n8cw70qh8g4hfwfaxwwxbrrx5hm2z037z8kdhvdpqkxljl9189x";

  checkPhase = ''
    export HOME=$TMPDIR
    git config --global user.email "nobody@example.com"
    git config --global user.name "Nobody"

    # UI tests uses executables directly, so we need to build them before
    # launching the tests
    cargo build
  '' + (
    # CLI uses the presence of a controlling TTY to check if arguments are
    # passed in stdin, or in the command-line, so we use script to create
    # a PTY for us.
    if !stdenv.isDarwin then ''
      script -qfec "cargo test --workspace"
    '' else ''
      script -q "cargo test --workspace"
    ''
  );

  postInstall = ''
    installShellCompletion target/imag.{bash,fish} --zsh target/_imag
  '';

  meta = with stdenv.lib; {
    description = "Commandline personal information management suite";
    homepage = "https://imag-pim.org/";
    license = licenses.lgpl21;
    maintainers = with maintainers; [ Br1ght0ne minijackson ];
    platforms = platforms.unix;
  };
}