forked from Losses/rune
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rune.nix
138 lines (118 loc) · 3.64 KB
/
rune.nix
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{
lib
, jq
, stdenv
, fetchzip
, flutter324
, protobuf_26
, protoc-gen-prost
, makeDesktopItem
, moreutils
, cargo
, rustPlatform
, rustc
, alsa-lib
, lmdb
, targetFlutterPlatform ? "linux"
, buildDartApplication
, dart
}:
let
mainPubspecLock = lib.importJSON ./pubspec.lock.json;
cargokitPubspecLock = lib.importJSON ./pubspec.cargokit.lock.json;
protoc-gen-dart = buildDartApplication rec {
pname = "protoc-gen-dart";
version = "21.1.2";
src = fetchzip {
url = "https://github.com/google/protobuf.dart/archive/refs/tags/protoc_plugin-v21.1.2.tar.gz";
sha256 = "sha256-luptbRgOtOBapWmyIJ35GqOClpcmDuKSPu3QoDfp2FU=";
};
sourceRoot = "${src.name}/protoc_plugin";
pubspecLock = lib.importJSON ./pubspec.protoc.lock.json;
meta = with lib; {
description = "Protobuf plugin for generating Dart code";
mainProgram = "protoc-gen-dart";
homepage = "https://pub.dev/packages/protoc_plugin";
license = licenses.bsd3;
};
};
in
flutter324.buildFlutterApplication (rec {
pname = "rune-${targetFlutterPlatform}";
version = "0.0.0-dev.7";
src = fetchzip {
url = "https://github.com/Losses/rune/archive/90a0a8839de55ddc1d3cfda9a50b95567924de69.tar.gz";
sha256 = "sha256-atURF+EqPCSeI+/HvtgvLp6M3O7V8sCyIqfughfuxNo=";
};
gitHashes = {
fluent_ui = "sha256-87wJgWP4DGsVOxc4PhCMDg+ro9faHKZXy2LQtFqbmso=";
};
customSourceBuilders = {
rinf =
{ version, src, ... }:
stdenv.mkDerivation {
pname = "rinf";
inherit version src;
inherit (src) passthru;
patches = [ ./rinf.patch ];
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -r * "$out"
runHook postInstall
'';
};
};
# build_tool hack part 1: join dependencies with the main package
pubspecLock = lib.recursiveUpdate cargokitPubspecLock mainPubspecLock;
inherit targetFlutterPlatform;
nativeBuildInputs = [
jq
moreutils # sponge
protobuf_26
protoc-gen-prost
protoc-gen-dart
cargo
rustc
rustPlatform.cargoSetupHook
alsa-lib
lmdb
];
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
name = "${pname}-${version}";
hash = "sha256-B7SQhGBsCo6xlZQOKx/ZXkdhPg4DyX1w1JUc+RgHU+M=";
};
desktopItem = makeDesktopItem {
name = "Rune";
exec = "player";
icon = "rune";
desktopName = "Rune";
genericName = "Play your favorite music";
categories = ["Audio"];
};
preBuild = ''
echo PATCHING CARGOKIT
# build_tool hack part 2: add build_tool as an actually resolvable package (the location is relative to the rinf package directory)
jq '.packages += [.packages.[] | select(.name == "rinf") | .rootUri += "/cargokit/build_tool" | .name = "build_tool"]' .dart_tool/package_config.json | sponge .dart_tool/package_config.json
echo GENERATING PROTOBUF CODE
packageRun rinf message
'';
postInstall = ''
mkdir -p $out/share/icons/
cp -r $src/assets/icons/* $out/share/icons/
ln -s $out/share/icons/Papirus $out/share/icons/hicolor
ln -s $out/share/icons/Papirus $out/share/icons/Papirus-Dark
ln -s $out/share/icons/Papirus $out/share/icons/Papirus-Light
ln -s $out/share/icons/breeze/apps/1024/rune.png $out/share/icons/rune.png
'';
meta = with lib; {
description = "Experience timeless melodies with a music player that blends classic design with modern technology.";
homepage = "https://github.com/losses/rune";
license = licenses.mpl20;
mainProgram = "player";
maintainers = with maintainers; [ losses ];
platforms = [ "x86_64-linux" ];
sourceProvenance = [ sourceTypes.fromSource ];
};
})