2023-02-19 12:57:58 +01:00
|
|
|
{ lib, stdenv, appimageTools, fetchurl, undmg }:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "localsend";
|
2023-09-06 05:12:35 +02:00
|
|
|
version = "1.11.1";
|
|
|
|
|
|
|
|
hashes = {
|
|
|
|
x86_64-linux = "sha256-K4M9cks0FNsCLIqQhSgUAz3tRMKng6JkZ/ZfwG2hZJA=";
|
|
|
|
x86_64-darwin = "sha256-Cixo00I4BBAmUnszsz+CxPX3EY175UTufCmwQmIsEgg=";
|
|
|
|
};
|
2023-02-19 12:57:58 +01:00
|
|
|
|
2023-08-30 04:06:04 +02:00
|
|
|
srcs = rec {
|
2023-02-19 12:57:58 +01:00
|
|
|
x86_64-linux = fetchurl {
|
2023-06-06 22:45:33 +02:00
|
|
|
url = "https://github.com/localsend/localsend/releases/download/v${version}/LocalSend-${version}-linux-x86-64.AppImage";
|
2023-09-06 05:12:35 +02:00
|
|
|
hash = hashes.x86_64-linux;
|
2023-02-19 12:57:58 +01:00
|
|
|
};
|
|
|
|
x86_64-darwin = fetchurl {
|
|
|
|
url = "https://github.com/localsend/localsend/releases/download/v${version}/LocalSend-${version}.dmg";
|
2023-09-06 05:12:35 +02:00
|
|
|
hash = hashes.x86_64-darwin;
|
2023-02-19 12:57:58 +01:00
|
|
|
};
|
2023-08-30 04:06:04 +02:00
|
|
|
aarch64-darwin = x86_64-darwin;
|
2023-02-19 12:57:58 +01:00
|
|
|
};
|
2023-06-06 22:45:33 +02:00
|
|
|
src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system for package localsend: ${stdenv.hostPlatform.system}");
|
2023-02-19 12:57:58 +01:00
|
|
|
|
|
|
|
appimageContents = appimageTools.extract { inherit pname version src; };
|
|
|
|
|
|
|
|
linux = appimageTools.wrapType2 rec {
|
|
|
|
inherit pname version src meta;
|
|
|
|
|
2023-04-24 17:00:57 +02:00
|
|
|
extraPkgs = p: [ p.ayatana-ido p.libayatana-appindicator p.libayatana-indicator p.libdbusmenu p.libepoxy ];
|
2023-02-19 12:57:58 +01:00
|
|
|
|
|
|
|
extraInstallCommands = ''
|
|
|
|
mv $out/bin/${pname}-${version} $out/bin/${pname}
|
|
|
|
|
|
|
|
install -m 444 -D ${appimageContents}/org.localsend.localsend_app.desktop \
|
|
|
|
$out/share/applications/${pname}.desktop
|
|
|
|
substituteInPlace $out/share/applications/${pname}.desktop \
|
2023-06-06 22:45:33 +02:00
|
|
|
--replace 'Exec=localsend_app' "Exec=$out/bin/localsend"
|
2023-02-19 12:57:58 +01:00
|
|
|
|
2023-06-06 22:45:33 +02:00
|
|
|
install -m 444 -D ${appimageContents}/localsend.png \
|
|
|
|
$out/share/icons/hicolor/256x256/apps/localsend.png
|
2023-02-19 12:57:58 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
darwin = stdenv.mkDerivation {
|
|
|
|
inherit pname version src meta;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ undmg ];
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/Applications
|
|
|
|
cp -r *.app $out/Applications
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "An open source cross-platform alternative to AirDrop";
|
|
|
|
homepage = "https://localsend.org/";
|
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ sikmir ];
|
|
|
|
platforms = builtins.attrNames srcs;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
if stdenv.isDarwin
|
|
|
|
then darwin
|
|
|
|
else linux
|