about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/instant-messengers/mikutter/default.nix
blob: 3e2718c9c573ec27de3d8c335fdbf7aee28b7041 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{ stdenv, fetchurl
, bundlerEnv, ruby
, alsaUtils, libnotify, which, wrapGAppsHook, gtk2, atk, gobject-introspection
}:

# how to update:
# find latest version at: http://mikutter.hachune.net/download#download
# run these commands:
#
# wget http://mikutter.hachune.net/bin/mikutter.3.8.7.tar.gz
# tar xvf mikutter.3.8.7.tar.gz
# cd mikutter
# find . -not -name Gemfile -exec rm {} \;
# find . -type d -exec rmdir -p --ignore-fail-on-non-empty {} \;
# cd ..
# mv mikutter/* .
# rm mikutter.3.8.7.tar.gz
# rm gemset.nix Gemfile.lock; nix-shell -p bundler bundix --run 'bundle lock && bundix'

stdenv.mkDerivation rec {
  pname = "mikutter";
  version = "3.8.7";

  src = fetchurl {
    url = "https://mikutter.hachune.net/bin/mikutter.${version}.tar.gz";
    sha256 = "1griypcd1xgyfd9wc3ls32grpw4ig0xxdiygpdinzr3bigfmd7iv";
  };

  env = bundlerEnv {
    name = "mikutter-${version}-gems";
    gemdir = ./.;

    inherit ruby;
  };

  buildInputs = [ alsaUtils libnotify which gtk2 ruby atk gobject-introspection ];
  nativeBuildInputs = [ wrapGAppsHook ];

  postUnpack = ''
    rm -rf $sourceRoot/vendor
  '';

  installPhase = ''
    install -v -D -m644 README $out/share/doc/mikutter/README
    install -v -D -m644 LICENSE $out/share/doc/mikutter/LICENSE
    rm -v README LICENSE

    cp -rv . $out
    mkdir $out/bin/
    # hack wrapGAppsHook wants a file not a symlink
    mv $out/mikutter.rb $out/bin/mikutter

    gappsWrapperArgs+=(
      --prefix PATH : "${ruby}/bin:${alsaUtils}/bin:${libnotify}/bin"
      --prefix GEM_HOME : "${env}/${env.ruby.gemPath}"
      --set DISABLE_BUNDLER_SETUP 1
    )
      # --prefix GIO_EXTRA_MODULES : "$prefix/lib/gio/modules"

    mkdir -p $out/share/mikutter $out/share/applications
    ln -sv $out/core/skin $out/share/mikutter/skin
    substituteAll ${./mikutter.desktop} $out/share/applications/mikutter.desktop
  '';

  postFixup = ''
    mv $out/bin/.mikutter-wrapped $out/mikutter.rb
    substituteInPlace $out/bin/mikutter \
      --replace "$out/bin/.mikutter-wrapped" "$out/mikutter.rb"
  '';

  meta = with stdenv.lib; {
    description = "An extensible Twitter client";
    homepage = https://mikutter.hachune.net;
    platforms = ruby.meta.platforms;
    license = licenses.mit;
  };
}