e7ec2969af
GitOrigin-RevId: 9b19f5e77dd906cb52dade0b7bd280339d2a1f3d
98 lines
2.4 KiB
Nix
98 lines
2.4 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchurl
|
|
, fetchFromGitHub
|
|
, flutter
|
|
, makeDesktopItem
|
|
, pkg-config
|
|
, libayatana-appindicator
|
|
, undmg
|
|
}:
|
|
|
|
let
|
|
pname = "localsend";
|
|
version = "1.12.0";
|
|
|
|
linux = flutter.buildFlutterApplication {
|
|
inherit pname version;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = pname;
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
hash = "sha256-mk0CLZP0x/mEixeAig7X41aFgQzs+kZkBJx6T//3ZKY=";
|
|
};
|
|
|
|
sourceRoot = "source/app";
|
|
|
|
pubspecLock = lib.importJSON ./pubspec.lock.json;
|
|
|
|
gitHashes = {
|
|
"permission_handler_windows" = "sha256-a7bN7/A65xsvnQGXUvZCfKGtslbNWEwTWR8fAIjMwS0=";
|
|
"tray_manager" = "sha256-eF14JGf5jclsKdXfCE7Rcvp72iuWd9wuSZ8Bej17tjg=";
|
|
};
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
buildInputs = [ libayatana-appindicator ];
|
|
|
|
postInstall = ''
|
|
for s in 32 128 256 512; do
|
|
d=$out/share/icons/hicolor/''${s}x''${s}/apps
|
|
mkdir -p $d
|
|
ln -s $out/app/data/flutter_assets/assets/img/logo-''${s}.png $d/localsend.png
|
|
done
|
|
mkdir -p $out/share/applications
|
|
cp $desktopItem/share/applications/*.desktop $out/share/applications
|
|
substituteInPlace $out/share/applications/*.desktop --subst-var out
|
|
'';
|
|
|
|
desktopItem = makeDesktopItem {
|
|
name = "LocalSend";
|
|
exec = "@out@/bin/localsend_app";
|
|
icon = "localsend";
|
|
desktopName = "LocalSend";
|
|
startupWMClass = "localsend";
|
|
genericName = "An open source cross-platform alternative to AirDrop";
|
|
categories = [ "Network" ];
|
|
};
|
|
|
|
meta = meta // {
|
|
mainProgram = "localsend_app";
|
|
};
|
|
};
|
|
|
|
darwin = stdenv.mkDerivation {
|
|
inherit pname version;
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/localsend/localsend/releases/download/v${version}/LocalSend-${version}.dmg";
|
|
hash = "sha256-XKYc3lA7x0Tf1Mf3o7D2RYwYDRDVHoSb/lj9PhKzV5U=";
|
|
};
|
|
|
|
nativeBuildInputs = [ undmg ];
|
|
|
|
sourceRoot = ".";
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/Applications
|
|
cp -r *.app $out/Applications
|
|
'';
|
|
|
|
meta = meta // {
|
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
|
platforms = [ "x86_64-darwin" "aarch64-darwin" ];
|
|
};
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "An open source cross-platform alternative to AirDrop";
|
|
homepage = "https://localsend.org/";
|
|
license = licenses.mit;
|
|
mainProgram = "localsend";
|
|
maintainers = with maintainers; [ sikmir ];
|
|
};
|
|
in
|
|
if stdenv.isDarwin
|
|
then darwin
|
|
else linux
|