Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

134 lines
3.7 KiB
Nix
Raw Permalink Normal View History

2024-11-03 02:42:16 +08:00
{
lib,
2025-08-14 18:37:18 +08:00
stdenv,
2025-05-30 04:58:49 +08:00
flutter332,
2025-08-14 18:37:18 +08:00
fetchFromGitHub,
2024-11-03 02:42:16 +08:00
autoPatchelfHook,
2025-08-14 18:37:18 +08:00
alsa-lib,
2024-11-03 02:42:16 +08:00
gst_all_1,
2025-08-14 18:37:18 +08:00
libayatana-appindicator,
2024-12-08 19:15:57 +08:00
mimalloc,
mpv-unwrapped,
2025-08-14 18:37:18 +08:00
webkitgtk_4_1,
2025-02-25 20:41:59 +00:00
_experimental-update-script-combinators,
gitUpdater,
2025-08-14 18:37:18 +08:00
runCommand,
yq-go,
2024-11-03 02:42:16 +08:00
}:
2025-02-25 20:41:59 +00:00
2025-08-14 18:37:18 +08:00
let
version = "1.7.6";
2024-11-23 11:20:22 +08:00
2024-11-03 02:42:16 +08:00
src = fetchFromGitHub {
owner = "Predidit";
repo = "Kazumi";
2024-12-08 19:15:57 +08:00
tag = version;
2025-08-14 18:37:18 +08:00
hash = "sha256-avZ0IxxJO9e0xWE58QYkTspDqgwu+nCwzzvV+4rCLOk=";
2024-11-03 02:42:16 +08:00
};
2025-08-14 18:37:18 +08:00
in
flutter332.buildFlutterApplication {
pname = "kazumi";
inherit version src;
2024-11-03 02:42:16 +08:00
pubspecLock = lib.importJSON ./pubspec.lock.json;
2025-08-14 18:37:18 +08:00
gitHashes = lib.importJSON ./gitHashes.json;
2024-11-03 02:42:16 +08:00
2024-12-08 19:15:57 +08:00
customSourceBuilders = {
# unofficial media_kit_libs_linux
media_kit_libs_linux =
{ version, src, ... }:
stdenv.mkDerivation rec {
pname = "media_kit_libs_linux";
inherit version src;
inherit (src) passthru;
postPatch = ''
sed -i '/set(MIMALLOC "mimalloc-/,/add_custom_target/d' libs/linux/media_kit_libs_linux/linux/CMakeLists.txt
sed -i '/set(PLUGIN_NAME "media_kit_libs_linux_plugin")/i add_custom_target("MIMALLOC_TARGET" ALL DEPENDS ${mimalloc}/lib/mimalloc.o)' libs/linux/media_kit_libs_linux/linux/CMakeLists.txt
'';
installPhase = ''
runHook preInstall
2025-08-14 18:37:18 +08:00
cp -r . "$out"
2024-12-08 19:15:57 +08:00
runHook postInstall
'';
};
# unofficial media_kit_video
media_kit_video =
{ version, src, ... }:
stdenv.mkDerivation rec {
pname = "media_kit_video";
inherit version src;
inherit (src) passthru;
postPatch = ''
sed -i '/set(LIBMPV_ZIP_URL/,/if(MEDIA_KIT_LIBS_AVAILABLE)/{//!d; /set(LIBMPV_ZIP_URL/d}' media_kit_video/linux/CMakeLists.txt
sed -i '/if(MEDIA_KIT_LIBS_AVAILABLE)/i set(LIBMPV_HEADER_UNZIP_DIR "${mpv-unwrapped.dev}/include/mpv")' media_kit_video/linux/CMakeLists.txt
2025-08-14 18:37:18 +08:00
sed -i '/if(MEDIA_KIT_LIBS_AVAILABLE)/i set(LIBMPV_PATH "${mpv-unwrapped}/lib")' media_kit_video/linux/CMakeLists.txt
sed -i '/if(MEDIA_KIT_LIBS_AVAILABLE)/i set(LIBMPV_UNZIP_DIR "${mpv-unwrapped}/lib")' media_kit_video/linux/CMakeLists.txt
2024-12-08 19:15:57 +08:00
'';
installPhase = ''
runHook preInstall
2025-08-14 18:37:18 +08:00
cp -r . "$out"
2024-12-08 19:15:57 +08:00
runHook postInstall
'';
};
};
2025-08-14 18:37:18 +08:00
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [
alsa-lib
gst_all_1.gst-libav
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-vaapi
gst_all_1.gstreamer
libayatana-appindicator
mpv-unwrapped
webkitgtk_4_1
];
2024-11-03 02:42:16 +08:00
postInstall = ''
2025-08-14 18:37:18 +08:00
ln -snf ${mpv-unwrapped}/lib/libmpv.so.2 $out/app/$pname/lib/libmpv.so.2
install -Dm 0644 assets/linux/io.github.Predidit.Kazumi.desktop -t $out/share/applications/
install -Dm 0644 assets/images/logo/logo_linux.png $out/share/icons/hicolor/512x512/apps/io.github.Predidit.Kazumi.png
2024-11-03 02:42:16 +08:00
'';
2025-02-25 20:41:59 +00:00
passthru = {
pubspecSource =
runCommand "pubspec.lock.json"
{
2025-08-14 18:37:18 +08:00
inherit src;
nativeBuildInputs = [ yq-go ];
2025-02-25 20:41:59 +00:00
}
''
2025-08-14 18:37:18 +08:00
yq eval --output-format=json --prettyPrint $src/pubspec.lock > "$out"
2025-02-25 20:41:59 +00:00
'';
updateScript = _experimental-update-script-combinators.sequence [
(gitUpdater { })
(_experimental-update-script-combinators.copyAttrOutputToFile "kazumi.pubspecSource" ./pubspec.lock.json)
2025-08-14 18:37:18 +08:00
{
command = [ ./update-gitHashes.py ];
supportedFeatures = [ "silent" ];
}
2025-02-25 20:41:59 +00:00
];
};
2024-12-27 07:51:58 +08:00
2024-11-03 02:42:16 +08:00
meta = {
description = "Watch Animes online with danmaku support";
homepage = "https://github.com/Predidit/Kazumi";
mainProgram = "kazumi";
2025-08-14 18:37:18 +08:00
license = lib.licenses.gpl3Plus;
maintainers = [ ];
2024-12-08 19:15:57 +08:00
platforms = lib.platforms.linux;
2024-11-03 02:42:16 +08:00
};
}