nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 flutter338,
4 fetchFromGitHub,
5 imagemagick,
6 alsa-lib,
7 libass,
8 mpv-unwrapped,
9 runCommand,
10 yq-go,
11 _experimental-update-script-combinators,
12 nix-update-script,
13 dart,
14}:
15
16let
17 pname = "interstellar";
18
19 version = "0.11.1";
20
21 src = fetchFromGitHub {
22 owner = "interstellar-app";
23 repo = "interstellar";
24 tag = "v${version}";
25 hash = "sha256-ZhZBy/KECz/Gs3RSuuXmTtI5pKPBMFQNG/kS8JvEaFc=";
26 };
27in
28flutter338.buildFlutterApplication {
29 inherit pname version src;
30
31 pubspecLock = lib.importJSON ./pubspec.lock.json;
32
33 gitHashes = lib.importJSON ./git-hashes.json;
34
35 nativeBuildInputs = [ imagemagick ];
36
37 buildInputs = [
38 alsa-lib
39 libass
40 mpv-unwrapped
41 ];
42
43 # run build_runner to make model .part files and language locale gen
44 preBuild = ''
45 packageRun build_runner build --delete-conflicting-outputs
46 '';
47
48 postInstall = ''
49 for size in 16 22 24 32 36 48 64 72 96 128 192 256 512 1024; do
50 mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
51 magick $src/assets/icons/logo.png -resize "$size"x"$size" $out/share/icons/hicolor/"$size"x"$size"/apps/interstellar.png
52 done
53 install -D --mode=0644 linux/appimage/interstellar.desktop --target-directory $out/share/applications
54 '';
55
56 extraWrapProgramArgs = ''
57 --prefix LD_LIBRARY_PATH : $out/app/${pname}/lib
58 '';
59
60 passthru = {
61 pubspecSource =
62 runCommand "pubspec.lock.json"
63 {
64 inherit src;
65 nativeBuildInputs = [ yq-go ];
66 }
67 ''
68 yq eval --output-format=json --prettyPrint $src/pubspec.lock > "$out"
69 '';
70 updateScript = _experimental-update-script-combinators.sequence [
71 (nix-update-script { })
72 (
73 (_experimental-update-script-combinators.copyAttrOutputToFile "interstellar.pubspecSource" ./pubspec.lock.json)
74 // {
75 supportedFeatures = [ ];
76 }
77 )
78 {
79 command = [
80 dart.fetchGitHashesScript
81 "--input"
82 ./pubspec.lock.json
83 "--output"
84 ./git-hashes.json
85 ];
86 supportedFeatures = [ ];
87 }
88 ];
89 };
90
91 meta = {
92 description = "App for Mbin/Lemmy/PieFed, connecting you to the fediverse";
93 homepage = "https://interstellar.jwr.one";
94 license = lib.licenses.agpl3Plus;
95 mainProgram = "interstellar";
96 platforms = lib.platforms.linux;
97 maintainers = with lib.maintainers; [ JollyDevelopment ];
98 };
99}