summaryrefslogtreecommitdiff
path: root/overlays/pidgin.nix
blob: 3c9fb93c4c24b2e53baf47c6e05bccc683aafd2f (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
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-with-plugins = pidginWrapper {
    inherit (prev) makeWrapper symlinkJoin;
    plugins = with final; [ purple-lurch pidgin-carbons pidgin-opensteamworks pidgin-xmpp-receipts ];
    pidgin = prev.pidgin.overrideAttrs (oldAttrs: {
      patches = (oldAttrs.patches or []) ++ [mucHistory];
    });
  };
}