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
46 lines
1.2 KiB
Nix
46 lines
1.2 KiB
Nix
{ lib, stdenv, fetchFromGitHub, fetchpatch, Carbon, Cocoa }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "khd";
|
|
version = "3.0.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "koekeishiya";
|
|
repo = "khd";
|
|
rev = "v${version}";
|
|
sha256 = "0nzfhknv1s71870w2dk9dy56a3g5zsbjphmfrz0vsvi438g099r4";
|
|
};
|
|
|
|
patches = [
|
|
# Fixes build issues, remove with >3.0.0
|
|
(fetchpatch {
|
|
url = "https://github.com/koekeishiya/khd/commit/4765ae0b4c7d4ca56319dc92ff54393cd9e03fbc.patch";
|
|
sha256 = "0kvf5hxi5bf6pf125qib7wn7hys0ag66zzpp4srj1qa87lxyf7np";
|
|
})
|
|
];
|
|
|
|
buildInputs = [ Carbon Cocoa ];
|
|
|
|
buildPhase = ''
|
|
make install
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cp bin/khd $out/bin/khd
|
|
|
|
mkdir -p $out/Library/LaunchDaemons
|
|
cp ${./org.nixos.khd.plist} $out/Library/LaunchDaemons/org.nixos.khd.plist
|
|
substituteInPlace $out/Library/LaunchDaemons/org.nixos.khd.plist --subst-var out
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "A simple modal hotkey daemon for OSX";
|
|
homepage = "https://github.com/koekeishiya/khd";
|
|
downloadPage = "https://github.com/koekeishiya/khd/releases";
|
|
platforms = platforms.darwin;
|
|
maintainers = with maintainers; [ lnl7 ];
|
|
license = licenses.mit;
|
|
};
|
|
}
|