nixpkgs/pkgs/by-name/ff/ff2mpv-go/package.nix
Bruno BELANYI c1272a1529 ff2mpv-go: use 'PATH' to invoke 'mpv'
Patching in the full-path to the binary is more robust, unfortunately
this means that a user of `ff2mpv-go` can't use their own wrapped `mpv`
without overriding the package.

As a practical example: using home-manager to configure `mpv` with
additional scripts will *not* work with the package as it was previously
written.

With this commit, we now rely on `PATH` lookups to find the `mpv`
binary, this should prioritize a user's customized `mpv`.
2023-12-31 15:49:04 +00:00

40 lines
900 B
Nix

{ lib
, buildGoModule
, fetchgit
, makeWrapper
, mpv
}:
buildGoModule rec {
pname = "ff2mpv-go";
version = "1.0.1";
src = fetchgit {
url = "https://git.clsr.net/util/ff2mpv-go/";
rev = "v${version}";
hash = "sha256-e/AuOA3isFTyBf97Zwtr16yo49UdYzvktV5PKB/eH/s=";
};
nativeBuildInputs = [
makeWrapper
];
vendorHash = null;
postInstall = ''
mkdir -p "$out/lib/mozilla/native-messaging-hosts"
$out/bin/ff2mpv-go --manifest > "$out/lib/mozilla/native-messaging-hosts/ff2mpv.json"
'';
postFixup = ''
wrapProgram $out/bin/ff2mpv-go --suffix PATH ":" ${lib.makeBinPath [ mpv ]}
'';
meta = with lib; {
description = "Native messaging host for ff2mpv written in Go";
homepage = "https://git.clsr.net/util/ff2mpv-go/";
license = licenses.publicDomain;
maintainers = with maintainers; [ ambroisie ];
mainProgram = "ff2mpv-go";
};
}