about summary refs log tree commit diff
path: root/pkgs/larbs-news/default.nix
blob: f8b6403a5fba3b928ab7a9c00b35a6684dc9fe10 (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
64
65
66
67
68
{ stdenv, buildEnv, makeWrapper, makeDesktopItem, callPackage,
newsboat, libnotify, entr, mpv, sxiv }:
with stdenv.lib;

let
  pname = "larbs-news";
  version = "1.0";
  voidrice = callPackage ../voidrice.nix { };
  task-spooler = callPackage ../task-spooler { };
  newsboatConfig = "${voidrice}/.config/newsboat/config";

  newsboatWrapped = stdenv.mkDerivation {
    inherit pname version;
    unpackPhase = "true";

    buildInputs = [ makeWrapper ];

    installPhase = ''
      makeWrapper ${newsboat}/bin/newsboat $out/bin/newsboat \
      --add-flags "-C ${newsboatConfig}"
    '';

  };

  desktopItem = makeDesktopItem {
    name = pname;
    genericName = "RSS Reader";
    comment = "Newsboat configuration by Luke Smith";
    exec = "${newsboatWrapped}/bin/newsboat";
    # icon =
    desktopName = pname;
    mimeType = "application/rss+xml";
    categories = "Network";
    terminal = "true";
  };

in
  buildEnv {
    name = pname;

    paths = [
      newsboatWrapped
      task-spooler
      libnotify
      entr
      mpv
      sxiv
    ];

    postBuild = ''
      cp ${voidrice}/.local/bin/statusbar/news $out/bin/news
      cp ${voidrice}/.local/bin/cron/newsup $out/bin/newsup
      cp ${voidrice}/.local/bin/qndl $out/bin/qndl
      cp ${voidrice}/.local/bin/queueandnotify $out/bin/queueandnotify
      cp ${voidrice}/.local/bin/podentr $out/bin/podentr
      cp ${voidrice}/.local/bin/linkhandler $out/bin/linkhandler
      cp -r ${desktopItem}/share/applications $out/share/applications

      sed -i 's:/usr/bin/::g' $out/bin/newsup
    '';

    meta = {
      homepage = "https://github.com/LukeSmithXYZ/voidrice";
      description = "Newsboat RSS reader with vim bindings";
      license = licenses.gpl3;
      platforms = [ "x86_64-linux" "x86_64-darwin" ];
    };
  }