summary refs log tree commit diff
path: root/pkgs/applications/misc/scli/default.nix
blob: 3605e7c416fdb5e863a42a2ccb6adbb5fd5f1f3b (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
{ lib
, python3
, fetchFromGitHub
, dbus
, signal-cli
, xclip
}:

python3.pkgs.buildPythonApplication rec {
  pname = "scli";
  version = "0.6.4";

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

  propagatedBuildInputs = with python3.pkgs; [
    pyqrcode
    urwid
    urwid-readline
  ];

  dontBuild = true;

  checkPhase = ''
    # scli attempts to write to these directories, make sure they're writeable
    export XDG_DATA_HOME=$(mktemp -d)
    export XDG_CONFIG_HOME=$(mktemp -d)
    ./scli --help > /dev/null # don't spam nix-build log
    test $? == 0
  '';

  installPhase = ''
    mkdir -p $out/bin
    patchShebangs scli
    install -m755 -D scli $out/bin/scli
  '';

  makeWrapperArgs = [
    "--prefix" "PATH" ":" (lib.makeBinPath [ dbus signal-cli xclip ])
  ];

  meta = with lib; {
    description = "Simple terminal user interface for Signal";
    homepage = "https://github.com/isamert/scli";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ alex-eyre ];
  };
}