toxic: 0.15.1 -> 0.16.0
[NixPkgs.git] / pkgs / by-name / lo / localsend / package.nix
blob648ea6c6fb6c73cf32359a4d7ad0d951fedb8f52
2   lib,
3   stdenv,
4   fetchurl,
5   fetchFromGitHub,
6   flutter324,
7   makeDesktopItem,
8   copyDesktopItems,
9   nixosTests,
10   pkg-config,
11   libayatana-appindicator,
12   undmg,
13   makeBinaryWrapper,
16 let
17   pname = "localsend";
18   version = "1.16.1";
20   linux = flutter324.buildFlutterApplication rec {
21     inherit pname version;
23     src = fetchFromGitHub {
24       owner = pname;
25       repo = pname;
26       rev = "v${version}";
27       hash = "sha256-9nW1cynvRgX565ZupR+ogfDH9Qem+LQH4XZupVsrEWo=";
28     };
30     sourceRoot = "${src.name}/app";
32     pubspecLock = lib.importJSON ./pubspec.lock.json;
34     gitHashes = {
35       permission_handler_windows = "sha256-+TP3neqlQRZnW6BxHaXr2EbmdITIx1Yo7AEn5iwAhwM=";
36       pasteboard = "sha256-lJA5OWoAHfxORqWMglKzhsL1IFr9YcdAQP/NVOLYB4o=";
37     };
39     nativeBuildInputs = [
40       pkg-config
41       copyDesktopItems
42     ];
44     buildInputs = [ libayatana-appindicator ];
46     postInstall = ''
47       for s in 32 128 256 512; do
48         d=$out/share/icons/hicolor/''${s}x''${s}/apps
49         mkdir -p $d
50         cp ./assets/img/logo-''${s}.png $d/localsend.png
51       done
52     '';
54     extraWrapProgramArgs = ''
55       --prefix LD_LIBRARY_PATH : "$out/app/${pname}/lib"
56     '';
58     desktopItems = [
59       (makeDesktopItem {
60         name = "LocalSend";
61         exec = "localsend_app";
62         icon = "localsend";
63         desktopName = "LocalSend";
64         startupWMClass = "localsend_app";
65         genericName = "An open source cross-platform alternative to AirDrop";
66         categories = [ "Network" ];
67       })
68     ];
70     passthru = {
71       updateScript = ./update.sh;
72       tests.localsend = nixosTests.localsend;
73     };
75     meta = metaCommon // {
76       mainProgram = "localsend_app";
77     };
78   };
80   darwin = stdenv.mkDerivation {
81     inherit pname version;
83     src = fetchurl {
84       url = "https://github.com/localsend/localsend/releases/download/v${version}/LocalSend-${version}.dmg";
85       hash = "sha256-kgq3AoypDdRwk9bKa1zjUJo4tHHUbDZIg0G0Rk9S3n4=";
86     };
88     nativeBuildInputs = [
89       undmg
90       makeBinaryWrapper
91     ];
93     sourceRoot = ".";
95     installPhase = ''
96       mkdir -p $out/Applications
97       cp -r *.app $out/Applications
98       makeBinaryWrapper $out/Applications/LocalSend.app/Contents/MacOS/LocalSend $out/bin/localsend
99     '';
101     meta = metaCommon // {
102       sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
103       platforms = [
104         "x86_64-darwin"
105         "aarch64-darwin"
106       ];
107     };
108   };
110   metaCommon = {
111     description = "Open source cross-platform alternative to AirDrop";
112     homepage = "https://localsend.org/";
113     license = lib.licenses.mit;
114     mainProgram = "localsend";
115     maintainers = with lib.maintainers; [
116       sikmir
117       linsui
118       pandapip1
119     ];
120   };
122 if stdenv.hostPlatform.isDarwin then darwin else linux