blob: 35feec1bf524fec082191582d1046b7b0ef69759 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
{
lib,
fetchFromGitHub,
flutter324,
autoPatchelfHook,
buildGoModule,
libayatana-appindicator,
}:
let
version = "1.6.11";
src = fetchFromGitHub {
owner = "GopeedLab";
repo = "gopeed";
tag = "v${version}";
hash = "sha256-ayPqLRWYSa0rSHqGFS4xp3wUVAl4tfsSPs/SQcUQD60=";
};
metaCommon = {
description = "Modern download manager that supports all platforms";
homepage = "https://github.com/GopeedLab/gopeed";
license = with lib.licenses; [ gpl3Plus ];
maintainers = with lib.maintainers; [ ];
platforms = lib.platforms.linux;
};
libgopeed = buildGoModule {
inherit version src;
pname = "libgopeed";
vendorHash = "sha256-rJriTQF4tf7sZXcEDS6yZXk3xUI8Cav8OC7o4egpfIw=";
buildPhase = ''
runHook preBuild
mkdir -p $out/lib $out/bin
go build -tags nosqlite -ldflags="-w -s -X github.com/GopeedLab/gopeed/pkg/base.Version=v${version}" -buildmode=c-shared -o $out/lib/libgopeed.so github.com/GopeedLab/gopeed/bind/desktop
go build -ldflags="-w -s" -o $out/bin/host github.com/GopeedLab/gopeed/cmd/host
runHook postBuild
'';
meta = metaCommon;
};
in
flutter324.buildFlutterApplication {
inherit version src;
pname = "gopeed";
sourceRoot = "${src.name}/ui/flutter";
pubspecLock = lib.importJSON ./pubspec.lock.json;
gitHashes = {
install_plugin = "sha256-3FM08D2pbtWmitf8R4pAylVqum7IfbWh6pOIEhJdySk=";
permission_handler_windows = "sha256-MRTmuH0MfhGaMEb9bRotimAPRlFyl3ovtJUJ2WK7+DA=";
};
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ libayatana-appindicator ];
preBuild = ''
mkdir -p linux/bundle/lib
cp ${libgopeed}/lib/libgopeed.so linux/bundle/lib/libgopeed.so
cp ${libgopeed}/bin/host assets/exec/host
'';
postInstall = ''
install -Dm644 linux/assets/com.gopeed.Gopeed.desktop $out/share/applications/gopeed.desktop
install -Dm644 assets/icon/icon_512.png $out/share/icons/hicolor/512x512/apps/com.gopeed.Gopeed.png
install -Dm644 assets/icon/icon_1024.png $out/share/icons/hicolor/1024x1024/apps/com.gopeed.Gopeed.png
'';
preFixup = ''
patchelf --add-needed libgopeed.so \
--add-rpath $out/app/gopeed/lib $out/app/gopeed/gopeed
'';
passthru = {
inherit libgopeed;
updateScript = ./update.sh;
};
meta = metaCommon // {
mainProgram = "gopeed";
};
}
|