nixpkgs/pkgs/tools/inputmethods/libinput-gestures/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

55 lines
1.6 KiB
Nix

{ lib, stdenv, fetchFromGitHub, makeWrapper,
libinput, wmctrl, python3,
coreutils, xdotool ? null,
extraUtilsPath ? lib.optional (xdotool != null) xdotool
}:
stdenv.mkDerivation rec {
pname = "libinput-gestures";
version = "2.39";
src = fetchFromGitHub {
owner = "bulletmark";
repo = "libinput-gestures";
rev = version;
sha256 = "0bzyi55yhr9wyar9mnd09cr6pi88jkkp0f9lndm0a9jwi1xr4bdf";
};
patches = [
./0001-hardcode-name.patch
./0002-paths.patch
];
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ python3 ];
postPatch =
''
substituteInPlace libinput-gestures-setup --replace /usr/ /
substituteInPlace libinput-gestures \
--replace /etc "$out/etc" \
--subst-var-by libinput "${libinput}/bin/libinput" \
--subst-var-by wmctrl "${wmctrl}/bin/wmctrl"
'';
installPhase =
''
runHook preInstall
${stdenv.shell} libinput-gestures-setup -d "$out" install
runHook postInstall
'';
postFixup =
''
rm "$out/bin/libinput-gestures-setup"
substituteInPlace "$out/share/applications/libinput-gestures.desktop" --replace "/usr" "$out"
chmod +x "$out/share/applications/libinput-gestures.desktop"
wrapProgram "$out/bin/libinput-gestures" --prefix PATH : "${lib.makeBinPath ([coreutils] ++ extraUtilsPath)}"
'';
meta = with lib; {
homepage = "https://github.com/bulletmark/libinput-gestures";
description = "Gesture mapper for libinput";
license = licenses.gpl3Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ teozkr ];
};
}