Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 flutter332,
4 fetchFromGitHub,
5 gst_all_1,
6 libunwind,
7 orc,
8 webkitgtk_4_1,
9 autoPatchelfHook,
10 xorg,
11 runCommand,
12 yq,
13 saber,
14 _experimental-update-script-combinators,
15 gitUpdater,
16}:
17
18flutter332.buildFlutterApplication rec {
19 pname = "saber";
20 version = "0.26.0";
21
22 src = fetchFromGitHub {
23 owner = "saber-notes";
24 repo = "saber";
25 tag = "v${version}";
26 hash = "sha256-5N4HojdDysLgCPq614ZzJXx/dx3s4F++W35fjYdevRk=";
27 };
28
29 gitHashes = lib.importJSON ./gitHashes.json;
30
31 pubspecLock = lib.importJSON ./pubspec.lock.json;
32
33 nativeBuildInputs = [ autoPatchelfHook ];
34
35 buildInputs = [
36 gst_all_1.gstreamer
37 gst_all_1.gst-plugins-base
38 libunwind
39 orc
40 webkitgtk_4_1
41 xorg.libXmu
42 ];
43
44 postPatch = ''
45 patchShebangs patches/remove_proprietary_dependencies.sh
46 patches/remove_proprietary_dependencies.sh
47 '';
48
49 flutterBuildFlags = [ "--dart-define=DIRTY=false" ];
50
51 postInstall = ''
52 install -Dm0644 flatpak/com.adilhanney.saber.desktop $out/share/applications/saber.desktop
53 install -Dm0644 assets/icon/icon.svg $out/share/icons/hicolor/scalable/apps/com.adilhanney.saber.svg
54 install -Dm0644 flatpak/com.adilhanney.saber.metainfo.xml -t $out/share/metainfo
55 '';
56
57 # Remove libpdfrx.so's reference to the /build/ directory
58 preFixup = ''
59 patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" $out/app/saber/lib/lib*.so
60 '';
61
62 passthru = {
63 pubspecSource =
64 runCommand "pubspec.lock.json"
65 {
66 nativeBuildInputs = [ yq ];
67 inherit (saber) src;
68 }
69 ''
70 cat $src/pubspec.lock | yq > $out
71 '';
72 updateScript = _experimental-update-script-combinators.sequence [
73 (gitUpdater { rev-prefix = "v"; })
74 (_experimental-update-script-combinators.copyAttrOutputToFile "saber.pubspecSource" ./pubspec.lock.json)
75 {
76 command = [ ./update-gitHashes.py ];
77 supportedFeatures = [ "silent" ];
78 }
79 ];
80 };
81
82 meta = {
83 description = "Cross-platform open-source app built for handwriting";
84 homepage = "https://github.com/saber-notes/saber";
85 mainProgram = "saber";
86 license = with lib.licenses; [ gpl3Plus ];
87 maintainers = with lib.maintainers; [ ];
88 platforms = [
89 "aarch64-linux"
90 "x86_64-linux"
91 ];
92 };
93}