@@ -0,0 +1,63 @@
1+{ stdenv
2+, rustPlatform
3+, fetchFromGitHub
4+, llvmPackages
5+, openssl
6+, pkg-config
7+, installShellFiles
8+, Security
9+, gitMinimal
10+, utillinuxMinimal
11+}:
12+
13+rustPlatform.buildRustPackage rec {
14+ pname = "imag";
15+ version = "0.10.1";
16+
17+ src = fetchFromGitHub {
18+ owner = "matthiasbeyer";
19+ repo = pname;
20+ rev = "v${version}";
21+ sha256 = "0f9915f083z5qqcxyavj0w6m973c8m1x7kfb89pah5agryy5mkaq";
22+ };
23+
24+ nativeBuildInputs = [ installShellFiles pkg-config ];
25+ buildInputs = [ openssl ]
26+ ++ stdenv.lib.optional stdenv.isDarwin Security;
27+ checkInputs = [ gitMinimal utillinuxMinimal ];
28+
29+ LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
30+
31+ cargoSha256 = "0n8cw70qh8g4hfwfaxwwxbrrx5hm2z037z8kdhvdpqkxljl9189x";
32+
33+ checkPhase = ''
34+ export HOME=$TMPDIR
35+ git config --global user.email "nobody@example.com"
36+ git config --global user.name "Nobody"
37+
38+ # UI tests uses executables directly, so we need to build them before
39+ # launching the tests
40+ cargo build
41+ '' + (
42+ # CLI uses the presence of a controlling TTY to check if arguments are
43+ # passed in stdin, or in the command-line, so we use script to create
44+ # a PTY for us.
45+ if !stdenv.isDarwin then ''
46+ script -qfec "cargo test --workspace"
47+ '' else ''
48+ script -q "cargo test --workspace"
49+ ''
50+ );
51+
52+ postInstall = ''
53+ installShellCompletion target/imag.{bash,fish} --zsh target/_imag
54+ '';
55+
56+ meta = with stdenv.lib; {
57+ description = "Commandline personal information management suite";
58+ homepage = "https://imag-pim.org/";
59+ license = licenses.lgpl21;
60+ maintainers = with maintainers; [ filalex77 minijackson ];
61+ platforms = platforms.unix;
62+ };
63+}