diff --git a/pkgs/by-name/mi/miru/darwin.nix b/pkgs/by-name/mi/miru/darwin.nix new file mode 100644 index 000000000000..af841bb43bbd --- /dev/null +++ b/pkgs/by-name/mi/miru/darwin.nix @@ -0,0 +1,33 @@ +{ + stdenvNoCC, + fetchurl, + unzip, + makeWrapper, + + pname, + version, + meta, +}: +stdenvNoCC.mkDerivation rec { + inherit pname version meta; + + src = fetchurl { + url = "https://github.com/ThaUnknown/miru/releases/download/v${version}/mac-Miru-${version}-mac.zip"; + hash = "sha256-OakGB5Fz1Tlxa/Uu7xHlKoEF9VRfWFQ9CjsR0eCRyQw="; + }; + + sourceRoot = "."; + + nativeBuildInputs = [ + unzip + makeWrapper + ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/{bin,Applications} + cp -r Miru.app $out/Applications/ + makeWrapper $out/Applications/Miru.app/Contents/MacOS/Miru $out/bin/miru + runHook postInstall + ''; +} diff --git a/pkgs/by-name/mi/miru/linux.nix b/pkgs/by-name/mi/miru/linux.nix new file mode 100644 index 000000000000..f86aee30bfd1 --- /dev/null +++ b/pkgs/by-name/mi/miru/linux.nix @@ -0,0 +1,31 @@ +{ + fetchurl, + appimageTools, + + pname, + version, + meta, +}: + +appimageTools.wrapType2 rec { + inherit pname version meta; + + src = fetchurl { + url = "https://github.com/ThaUnknown/miru/releases/download/v${version}/linux-Miru-${version}.AppImage"; + name = "${pname}-${version}.AppImage"; + sha256 = "sha256-aPutbJthUhZtBYkYuUB5v88OdhOrcnqw4AhnepfO1B4="; + }; + + extraInstallCommands = + let + contents = appimageTools.extractType2 { inherit pname version src; }; + in + '' + mkdir -p "$out/share/applications" + mkdir -p "$out/share/lib/miru" + cp -r ${contents}/{locales,resources} "$out/share/lib/miru" + cp -r ${contents}/usr/* "$out" + cp "${contents}/${pname}.desktop" "$out/share/applications/" + substituteInPlace $out/share/applications/${pname}.desktop --replace 'Exec=AppRun' 'Exec=${pname}' + ''; +} diff --git a/pkgs/by-name/mi/miru/package.nix b/pkgs/by-name/mi/miru/package.nix index 75eb7b4823c5..eeb1b0688dbc 100644 --- a/pkgs/by-name/mi/miru/package.nix +++ b/pkgs/by-name/mi/miru/package.nix @@ -1,39 +1,22 @@ -{ lib -, fetchurl -, appimageTools +{ + stdenv, + lib, + callPackage, }: - -appimageTools.wrapType2 rec { +let pname = "miru"; version = "5.1.4"; - - src = fetchurl { - url = "https://github.com/ThaUnknown/miru/releases/download/v${version}/linux-Miru-${version}.AppImage"; - name = "${pname}-${version}.AppImage"; - sha256 = "sha256-aPutbJthUhZtBYkYuUB5v88OdhOrcnqw4AhnepfO1B4="; - }; - - extraInstallCommands = - let - contents = appimageTools.extractType2 { inherit pname version src; }; - in - '' - mkdir -p "$out/share/applications" - mkdir -p "$out/share/lib/miru" - cp -r ${contents}/{locales,resources} "$out/share/lib/miru" - cp -r ${contents}/usr/* "$out" - cp "${contents}/${pname}.desktop" "$out/share/applications/" - substituteInPlace $out/share/applications/${pname}.desktop --replace 'Exec=AppRun' 'Exec=${pname}' - ''; - meta = with lib; { description = "Stream anime torrents, real-time with no waiting for downloads"; homepage = "https://miru.watch"; license = licenses.gpl3Plus; - maintainers = [ maintainers.d4ilyrun ]; + maintainers = with maintainers; [ + d4ilyrun + matteopacini + ]; mainProgram = "miru"; - platforms = [ "x86_64-linux" ]; + platforms = [ "x86_64-linux" ] ++ platforms.darwin; sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; longDescription = '' @@ -49,4 +32,8 @@ appimageTools.wrapType2 rec { instead of flat out closing MPV. ''; }; -} +in +if stdenv.isDarwin then + callPackage ./darwin.nix { inherit pname version meta; } +else + callPackage ./linux.nix { inherit pname version meta; }