caprine-bin: init at 2.55.2

This commit is contained in:
Shamrock Lee 2021-01-04 23:47:16 +08:00
parent b20c78750e
commit 00c7a8ee42
4 changed files with 112 additions and 0 deletions

View file

@ -0,0 +1,50 @@
{ lib
, fetchurl
, appimageTools
, gtk3
, gsettings-desktop-schemas
, xorg
, pname
, version
, sha256
, metaCommon ? { }
}:
let
name = "${pname}-${version}";
src = fetchurl {
url = "https://github.com/sindresorhus/caprine/releases/download/v${version}/Caprine-${version}.AppImage";
name = "Caprine-${version}.AppImage";
inherit sha256;
};
extracted = appimageTools.extractType2 { inherit name src; };
in
(appimageTools.wrapType2 {
inherit name src;
profile = ''
export LC_ALL=C.UTF-8
export XDG_DATA_DIRS=${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS
'';
extraPkgs = pkgs: appimageTools.defaultFhsEnvArgs.multiPkgs pkgs;
extraInstallCommands = ''
mv $out/bin/{${name},caprine}
mkdir -p $out/share
"${xorg.lndir}/bin/lndir" -silent "${extracted}/usr/share" "$out/share"
ln -s ${extracted}/caprine.png $out/share/icons/caprine.png
mkdir $out/share/applications
cp ${extracted}/caprine.desktop $out/share/applications/
substituteInPlace $out/share/applications/caprine.desktop \
--replace AppRun caprine
'';
meta = metaCommon // {
platforms = [ "x86_64-linux" ];
mainProgram = "caprine";
};
}) // {
inherit pname version;
}

View file

@ -0,0 +1,35 @@
{ stdenvNoCC
, lib
, fetchurl
, undmg
, pname
, version
, sha256
, metaCommon ? { }
}:
stdenvNoCC.mkDerivation {
inherit pname version;
src = fetchurl {
url = "https://github.com/sindresorhus/caprine/releases/download/v${version}/Caprine-${version}.dmg";
name = "Caprine-${version}.dmg";
inherit sha256;
};
sourceRoot = "Caprine.app";
nativeBuildInputs = [ undmg ];
installPhase = ''
mkdir -p "$out/Applications/Caprine.app"
cp -R . "$out/Applications/Caprine.app"
mkdir "$out/bin"
ln -s "$out/Applications/Caprine.app/Contents/MacOS/Caprine" "$out/bin/caprine"
'';
meta = metaCommon // {
platforms = with lib.platforms; darwin;
mainProgram = "caprine";
};
}

View file

@ -0,0 +1,25 @@
{ lib, callPackage, stdenvNoCC }:
let
pname = "caprine";
version = "2.55.2";
metaCommon = with lib; {
description = "An elegant Facebook Messenger desktop app";
homepage = "https://sindresorhus.com/caprine";
license = licenses.mit;
maintainers = with maintainers; [ ShamrockLee ];
};
x86_64-appimage = callPackage ./build-from-appimage.nix {
inherit pname version metaCommon;
sha256 = "J7eHVXjWSIcTpLMM8FlGKZzVh6XgpQ0d82kxfMbPyZ4=";
};
x86_64-dmg = callPackage ./build-from-dmg.nix {
inherit pname version metaCommon;
sha256 = "du/9N1BFq1s7spPiEDgDbjjcnkA0x1ExhAEpQvmO3aA=";
};
in
(if stdenvNoCC.isDarwin then x86_64-dmg else x86_64-appimage).overrideAttrs (oldAttrs: {
passthru = (oldAttrs.passthru or { }) // { inherit x86_64-appimage x86_64-dmg; };
meta = oldAttrs.meta // {
platforms = x86_64-appimage.meta.platforms ++ x86_64-dmg.meta.platforms;
};
})

View file

@ -24484,6 +24484,8 @@ with pkgs;
canto-daemon = callPackage ../applications/networking/feedreaders/canto-daemon { };
caprine-bin = callPackage ../applications/networking/instant-messengers/caprine-bin { };
carddav-util = callPackage ../tools/networking/carddav-util { };
carla = libsForQt5.callPackage ../applications/audio/carla { };