nixpkgs/pkgs/by-name/je/jellyfin-web/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.6 KiB
Nix

{
lib,
stdenv,
overrideSDK,
fetchFromGitHub,
buildNpmPackage,
jellyfin,
nix-update-script,
pkg-config,
xcbuild,
pango,
giflib,
darwin,
}:
let
# node-canvas builds code that requires aligned_alloc,
# which on Darwin requires at least the 10.15 SDK
stdenv' =
if stdenv.hostPlatform.isDarwin then
overrideSDK stdenv {
darwinMinVersion = "10.15";
darwinSdkVersion = "11.0";
}
else
stdenv;
buildNpmPackage' = buildNpmPackage.override { stdenv = stdenv'; };
in
buildNpmPackage' rec {
pname = "jellyfin-web";
version = "10.9.11";
src =
assert version == jellyfin.version;
fetchFromGitHub {
owner = "jellyfin";
repo = "jellyfin-web";
rev = "v${version}";
hash = "sha256-zt0Exx/4B5gqiN3fxvQuVh1MqRNNtJG6/G0/reqVHRc=";
};
npmDepsHash = "sha256-kQxfh8o8NBshKmmjQrLdxiOQK83LG+lxhZwzDkEJwEo=";
npmBuildScript = [ "build:production" ];
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcbuild ];
buildInputs =
[ pango ]
++ lib.optionals stdenv.hostPlatform.isDarwin [
giflib
darwin.apple_sdk.frameworks.CoreText
];
installPhase = ''
runHook preInstall
mkdir -p $out/share
cp -a dist $out/share/jellyfin-web
runHook postInstall
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Web Client for Jellyfin";
homepage = "https://jellyfin.org/";
license = licenses.gpl2Plus;
maintainers = with maintainers; [
nyanloutre
minijackson
purcell
jojosch
];
};
}