summaryrefslogtreecommitdiff
path: root/overlays/pidgin.nix
blob: 4c315f552b9b9aa7d257a019a628090934f4484e (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
final: prev:
let
  mucHistory = prev.fetchpatch {
    url = "https://developer.pidgin.im/raw-attachment/ticket/16524/0001-only-request-unseed-chat-history-from-jabber-group-c.patch";
    sha256 = "083wvmq7417xz55fxxhllqwql1hgjvin2sak08844121yw1jvc44";
  };

  pidginWrapper = { symlinkJoin, pidgin, makeWrapper, plugins }:
    let
      extraArgs = map (x: x.wrapArgs or "") plugins;
      majorVersion = prev.lib.versions.major pidgin.version;
    in symlinkJoin {
      name = "pidgin-with-plugins-${pidgin.version}";

      paths = [ pidgin ] ++ plugins;

      buildInputs = [ makeWrapper ];

      postBuild = ''
        wrapProgram $out/bin/pidgin \
          --suffix-each PURPLE_PLUGIN_PATH ':' "$out/lib/purple-${majorVersion} $out/lib/pidgin" \
          ${toString extraArgs}
        wrapProgram $out/bin/finch \
          --suffix-each PURPLE_PLUGIN_PATH ':' "$out/lib/purple-${majorVersion}" \
          ${toString extraArgs}
      '';
    };
in {
  pidgin-rocketchat = let
    rev = "5c08ad0eacd39914d27b692d7eb42a94a991fb4c";
  in prev.stdenv.mkDerivation {
    pname = "pidgin-rocketchat";
    version = builtins.substring 0 8 rev;
    
    src = prev.fetchFromGitHub {
      owner = "EionRobb";
      repo = "purple-rocketchat";
      inherit rev;
      hash = "sha256-UBIp5tpj4Xfo+mPhY51+rzs+ojKr90zWK+XLiK7XvWM=";
    };

    nativeBuildInputs = with final; [ pidgin json-glib glib discount ];

    installFlags = [
      "ROCKETCHAT_DEST=$(out)/lib/purple-2"
      "ROCKETCHAT_ICONS_DEST=$(out)/share/pixmaps/pidgin/protocols"
    ];
  };
  
  pidgin-with-plugins = pidginWrapper {
    inherit (prev) makeWrapper symlinkJoin;
    plugins = with final; [ purple-lurch pidgin-carbons pidgin-opensteamworks pidgin-xmpp-receipts pidgin-rocketchat ];
    pidgin = prev.pidgin.overrideAttrs (oldAttrs: {
      patches = (oldAttrs.patches or []) ++ [mucHistory];
    });
  };
}