nixpkgs/pkgs/by-name/vi/vieb/package.nix
stuebinm ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00

64 lines
1.7 KiB
Nix

{ stdenv, buildNpmPackage, fetchFromGitHub, electron, makeWrapper, python3, makeDesktopItem, nix-update-script, lib }:
buildNpmPackage rec {
pname = "vieb";
version = "11.0.0";
src = fetchFromGitHub {
owner = "Jelmerro";
repo = pname;
rev = version;
hash = "sha256-OBOxT2leZYD3td1+PJdLv7Nph/gY6U9tVC7b/fUmUJw=";
};
postPatch = ''
sed -i '/"electron"/d' package.json
'';
npmDepsHash = "sha256-vgp20qVT4JZ7U24uu9ZPkveXchMNcdbljodALAMAu9s=";
makeCacheWritable = true;
dontNpmBuild = true;
nativeBuildInputs = [ makeWrapper ] ++ lib.optional stdenv.isAarch64 python3;
desktopItem = makeDesktopItem {
name = "vieb";
exec = "vieb %U";
icon = "vieb";
desktopName = "Web Browser";
genericName = "Web Browser";
categories = [ "Network" "WebBrowser" ];
mimeTypes = [
"text/html"
"application/xhtml+xml"
"x-scheme-handler/http"
"x-scheme-handler/https"
];
};
postInstall = ''
install -Dm0644 {${desktopItem},$out}/share/applications/vieb.desktop
pushd $out/lib/node_modules/vieb/app/img/icons
for file in *.png; do
install -Dm0644 $file $out/share/icons/hicolor/''${file//.png}/apps/vieb.png
done
popd
makeWrapper ${electron}/bin/electron $out/bin/vieb \
--add-flags $out/lib/node_modules/vieb/app \
--set npm_package_version ${version}
'';
distPhase = ":"; # disable useless $out/tarballs directory
meta = with lib; {
homepage = "https://vieb.dev/";
changelog = "https://github.com/Jelmerro/Vieb/releases/tag/${version}";
description = "Vim Inspired Electron Browser";
mainProgram = "vieb";
maintainers = with maintainers; [ gebner tejing ];
platforms = platforms.unix;
license = licenses.gpl3Plus;
};
}