Skip to content

Commit

Permalink
miru: darwin support, add maintainer
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Pacini committed Jun 23, 2024
1 parent e0ba5d6 commit 45cfa86
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 28 deletions.
33 changes: 33 additions & 0 deletions pkgs/by-name/mi/miru/darwin.nix
Original file line number Diff line number Diff line change
@@ -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
'';
}
31 changes: 31 additions & 0 deletions pkgs/by-name/mi/miru/linux.nix
Original file line number Diff line number Diff line change
@@ -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}'
'';
}
43 changes: 15 additions & 28 deletions pkgs/by-name/mi/miru/package.nix
Original file line number Diff line number Diff line change
@@ -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 = ''
Expand All @@ -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; }

0 comments on commit 45cfa86

Please sign in to comment.