nixpkgs/pkgs/by-name/wi/wiliwili/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

77 lines
1.7 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
wayland-scanner,
mpv-unwrapped,
openssl,
curl,
libxkbcommon,
dbus,
libffi,
wayland,
egl-wayland,
xorg,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "wiliwili";
version = "1.4.1";
src = fetchFromGitHub {
owner = "xfangfang";
repo = "wiliwili";
rev = "v${finalAttrs.version}";
fetchSubmodules = true;
hash = "sha256-Fl8YV7yBW9dmcpcHCDVvkAzICTopNb4zKziDkR6NEwU=";
};
nativeBuildInputs = [
cmake
pkg-config
] ++ lib.optionals stdenv.hostPlatform.isLinux [
wayland-scanner
];
buildInputs = [
mpv-unwrapped
openssl
curl
libxkbcommon
dbus
] ++ lib.optionals stdenv.hostPlatform.isLinux [
libffi # needed for wayland
wayland
egl-wayland
xorg.libX11
xorg.libXrandr
xorg.libXinerama
xorg.libXcursor
xorg.libXi
];
cmakeFlags = [
(lib.cmakeBool "PLATFORM_DESKTOP" true)
(lib.cmakeBool "INSTALL" true)
(lib.cmakeBool "GLFW_BUILD_WAYLAND" stdenv.hostPlatform.isLinux)
(lib.cmakeBool "GLFW_BUILD_X11" stdenv.hostPlatform.isLinux)
# Otherwise cpr cmake will try to download zlib
(lib.cmakeBool "CPR_FORCE_USE_SYSTEM_CURL" true)
];
meta = {
description = "Third-party Bilibili client with a switch-like UI";
homepage = "https://xfangfang.github.io/wiliwili";
# https://github.com/xfangfang/wiliwili/discussions/355
license = lib.licenses.gpl3Only;
mainProgram = "wiliwili";
maintainers = with lib.maintainers; [ aleksana ];
platforms = with lib.platforms; unix ++ windows;
# Testing on darwin was blocked due to broken swift
# buildInputs should still need some tweaking, but can't be sure
badPlatforms = lib.platforms.darwin;
};
})