pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / by-name / lo / localsend / package.nix
blobd84aee26984eebbae57db3bf8bc95388e7de3604
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.15.4";
20   linux = flutter324.buildFlutterApplication rec {
21     inherit pname;
22     version = "1.15.4-unstable-2024-10-26";
24     src = fetchFromGitHub {
25       owner = pname;
26       repo = pname;
27       rev = "d0e864ddf6ebe1c55188b33f8fdccd534d203c75";
28       hash = "sha256-qaW9LoRQge4K/CAQwbjNxmlUkQmxvaZyBJdAjXbbTw4=";
29     };
31     sourceRoot = "${src.name}/app";
33     pubspecLock = lib.importJSON ./pubspec.lock.json;
35     gitHashes = {
36       permission_handler_windows = "sha256-+TP3neqlQRZnW6BxHaXr2EbmdITIx1Yo7AEn5iwAhwM=";
37       pasteboard = "sha256-lJA5OWoAHfxORqWMglKzhsL1IFr9YcdAQP/NVOLYB4o=";
38     };
40     nativeBuildInputs = [
41       pkg-config
42       copyDesktopItems
43     ];
45     buildInputs = [ libayatana-appindicator ];
47     postInstall = ''
48       for s in 32 128 256 512; do
49         d=$out/share/icons/hicolor/''${s}x''${s}/apps
50         mkdir -p $d
51         cp ./assets/img/logo-''${s}.png $d/localsend.png
52       done
53     '';
55     desktopItems = [
56       (makeDesktopItem {
57         name = "LocalSend";
58         exec = "localsend_app";
59         icon = "localsend";
60         desktopName = "LocalSend";
61         startupWMClass = "localsend_app";
62         genericName = "An open source cross-platform alternative to AirDrop";
63         categories = [ "Network" ];
64       })
65     ];
67     passthru = {
68       updateScript = ./update.sh;
69       tests.localsend = nixosTests.localsend;
70     };
72     meta = metaCommon // {
73       mainProgram = "localsend_app";
74     };
75   };
77   darwin = stdenv.mkDerivation {
78     inherit pname version;
80     src = fetchurl {
81       url = "https://github.com/localsend/localsend/releases/download/v${version}/LocalSend-${version}.dmg";
82       hash = "sha256-ZU2aXZNKo01TnXNH0e+r0l4J5HIILmGam3T4+6GaeA4=";
83     };
85     nativeBuildInputs = [
86       undmg
87       makeBinaryWrapper
88     ];
90     sourceRoot = ".";
92     installPhase = ''
93       mkdir -p $out/Applications
94       cp -r *.app $out/Applications
95       makeBinaryWrapper $out/Applications/LocalSend.app/Contents/MacOS/LocalSend $out/bin/localsend
96     '';
98     meta = metaCommon // {
99       sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
100       platforms = [
101         "x86_64-darwin"
102         "aarch64-darwin"
103       ];
104     };
105   };
107   metaCommon = {
108     description = "Open source cross-platform alternative to AirDrop";
109     homepage = "https://localsend.org/";
110     license = lib.licenses.mit;
111     mainProgram = "localsend";
112     maintainers = with lib.maintainers; [
113       sikmir
114       linsui
115       pandapip1
116     ];
117   };
119 if stdenv.hostPlatform.isDarwin then darwin else linux