about summary refs log tree commit diff
path: root/pkgs/applications/networking/irc/weechat/scripts/wee-slack
diff options
context:
space:
mode:
authorBenjamin Esham <benjamin@esham.io>2020-03-25 20:08:26 -0700
committerBenjamin Esham <benjamin@esham.io>2020-03-25 20:08:26 -0700
commita2d9581ac8fb7dfb1be01764e8deb7f5e9b4587c (patch)
treeefa9a1bb3fef52d765cf738bd438cd3d0682fb5f /pkgs/applications/networking/irc/weechat/scripts/wee-slack
parent2d48c2fbcdba763690786dcf097da559ceb4908b (diff)
downloadnixlib-a2d9581ac8fb7dfb1be01764e8deb7f5e9b4587c.tar
nixlib-a2d9581ac8fb7dfb1be01764e8deb7f5e9b4587c.tar.gz
nixlib-a2d9581ac8fb7dfb1be01764e8deb7f5e9b4587c.tar.bz2
nixlib-a2d9581ac8fb7dfb1be01764e8deb7f5e9b4587c.tar.lz
nixlib-a2d9581ac8fb7dfb1be01764e8deb7f5e9b4587c.tar.xz
nixlib-a2d9581ac8fb7dfb1be01764e8deb7f5e9b4587c.tar.zst
nixlib-a2d9581ac8fb7dfb1be01764e8deb7f5e9b4587c.zip
weechatScripts.wee-slack: 2.4.0 -> 2.5.0
wee-slack now (optionally) depends on a data file called weemoji.json
that allows it to translate between Slack emoji names (like
"slight_smile") and Unicode codepoints. For convenience, the derivation
now installs this file and patches the script so that the user doesn't
need to do any extra configuration to use it.
Diffstat (limited to 'pkgs/applications/networking/irc/weechat/scripts/wee-slack')
-rw-r--r--pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix10
-rw-r--r--pkgs/applications/networking/irc/weechat/scripts/wee-slack/hardcode-json-file-path.patch12
2 files changed, 20 insertions, 2 deletions
diff --git a/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix b/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix
index 632a485381d0..7b98630e85ee 100644
--- a/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix
+++ b/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "wee-slack";
-  version = "2.4.0";
+  version = "2.5.0";
 
   src = fetchFromGitHub {
     repo = "wee-slack";
     owner = "wee-slack";
     rev = "v${version}";
-    sha256 = "0h425ln5vv76zv41dccapyfbl8qmmflbpwmrd26knqyj8k24zfpr";
+    sha256 = "0sxgi5fg8qvzqmxy7sdma6v0wj93xwh21av10n8nxvdskacw5dxz";
   };
 
   patches = [
@@ -19,13 +19,19 @@ stdenv.mkDerivation rec {
         paths = with python3Packages; [ websocket_client six ];
       }}/${python3Packages.python.sitePackages}";
     })
+    ./hardcode-json-file-path.patch
   ];
 
+  postPatch = ''
+    substituteInPlace wee_slack.py --subst-var out
+  '';
+
   passthru.scripts = [ "wee_slack.py" ];
 
   installPhase = ''
     mkdir -p $out/share
     cp wee_slack.py $out/share/wee_slack.py
+    install -D -m 0444 weemoji.json $out/share/wee-slack/weemoji.json
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/networking/irc/weechat/scripts/wee-slack/hardcode-json-file-path.patch b/pkgs/applications/networking/irc/weechat/scripts/wee-slack/hardcode-json-file-path.patch
new file mode 100644
index 000000000000..7413a9229ce6
--- /dev/null
+++ b/pkgs/applications/networking/irc/weechat/scripts/wee-slack/hardcode-json-file-path.patch
@@ -0,0 +1,12 @@
+--- a/wee_slack.py
++++ b/wee_slack.py
+@@ -4560,8 +4560,7 @@
+ 
+ def load_emoji():
+     try:
+-        DIR = w.info_get('weechat_dir', '')
+-        with open('{}/weemoji.json'.format(DIR), 'r') as ef:
++        with open('@out@/share/wee-slack/weemoji.json', 'r') as ef:
+             emojis = json.loads(ef.read())
+             if 'emoji' in emojis:
+                 print_error('The weemoji.json file is in an old format. Please update it.')