3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/networking/instant-messengers/mikutter/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

83 lines
2.3 KiB
Nix

{ lib, 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.4.0.0.tar.gz
# mkdir mikutter
# cd mikutter
# tar xvf ../mikutter.4.0.0.tar.gz
# find . -not -name Gemfile -exec rm {} \;
# find . -type d -exec rmdir -p --ignore-fail-on-non-empty {} \;
# cd ..
# mv mikutter/* .
# rm mikutter.4.0.0.tar.gz
# rm gemset.nix Gemfile.lock; nix-shell -p bundler bundix --run 'bundle lock && bundix'
stdenv.mkDerivation rec {
pname = "mikutter";
version = "4.0.0";
src = fetchurl {
url = "https://mikutter.hachune.net/bin/mikutter.${version}.tar.gz";
sha256 = "0nx14vlp7p69m2vw0s6kbiyymsfq0r2jd4nm0v5c4xb9avkpgc8g";
};
buildInputs = [ alsaUtils libnotify which gtk2 ruby atk gobject-introspection ];
nativeBuildInputs = [ wrapGAppsHook ];
unpackPhase = ''
mkdir source
cd source
unpackFile $src
rm -rf vendor
'';
installPhase = let
env = bundlerEnv {
name = "mikutter-${version}-gems";
gemdir = ./.;
inherit ruby;
};
in ''
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 lib; {
description = "An extensible Twitter client";
homepage = "https://mikutter.hachune.net";
platforms = ruby.meta.platforms;
license = licenses.mit;
broken = true;
};
}