nixpkgs/pkgs/by-name/vi/vieb/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

66 lines
1.8 KiB
Nix

{ stdenv, buildNpmPackage, fetchFromGitHub, electron, makeWrapper, python3, makeDesktopItem, lib }:
buildNpmPackage rec {
pname = "vieb";
version = "12.0.0";
src = fetchFromGitHub {
owner = "Jelmerro";
repo = pname;
rev = version;
hash = "sha256-/gMAGmTsaS9B0qHXHq2Z/77LgcAMKjF6Mt7OiJ9l4wU=";
};
postPatch = ''
sed -i '/"electron"/d' package.json
'';
npmDepsHash = "sha256-sGDygjb9+tIBHykMUb3UGZrCF8btkFVObTdyx4Y3Q2c=";
makeCacheWritable = true;
dontNpmBuild = true;
env.ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
nativeBuildInputs = [ makeWrapper ] ++ lib.optional stdenv.hostPlatform.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;
};
}