base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / fo / follow / package.nix
blobe59bc1015a07661795749d01c61403cdc2cd83b4
2   electron,
3   fetchFromGitHub,
4   imagemagick,
5   lib,
6   makeDesktopItem,
7   makeWrapper,
8   nodejs,
9   pnpm,
10   stdenv,
12 stdenv.mkDerivation rec {
13   pname = "follow";
15   version = "0.2.0-beta.2";
17   src = fetchFromGitHub {
18     owner = "RSSNext";
19     repo = "Follow";
20     rev = "v${version}";
21     hash = "sha256-7KSPZj9QG6zksji/eY8jczBDHr/9tStlw26LKVqXTAw=";
22   };
24   nativeBuildInputs = [
25     nodejs
26     pnpm.configHook
27     makeWrapper
28     imagemagick
29   ];
31   pnpmDeps = pnpm.fetchDeps {
32     inherit pname version src;
33     hash = "sha256-FzMjN0rIjYxexf6tix4qi3mnuPkadjKihhN0Pj5y2nU=";
34   };
36   env = {
37     ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
39     # This environment variables inject the production Vite config at build time.
40     # Copy from:
41     # 1. https://github.com/RSSNext/Follow/blob/v0.2.0-beta.2/.github/workflows/build.yml#L18
42     # 2. And logs in the corresponding GitHub Actions: https://github.com/RSSNext/Follow/actions/workflows/build.yml
43     VITE_WEB_URL = "https://app.follow.is";
44     VITE_API_URL = "https://api.follow.is";
45     VITE_IMGPROXY_URL = "https://thumbor.follow.is";
46     VITE_SENTRY_DSN = "https://e5bccf7428aa4e881ed5cb713fdff181@o4507542488023040.ingest.us.sentry.io/4507570439979008";
47     VITE_OPENPANEL_CLIENT_ID = "0e477ab4-d92d-4d6e-b889-b09d86ab908e";
48     VITE_OPENPANEL_API_URL = "https://openpanel.follow.is/api";
49     VITE_FIREBASE_CONFIG = builtins.toJSON {
50       apiKey = "AIzaSyDuM93019tp8VI7wsszJv8ChOs7b1EE5Hk";
51       authDomain = "follow-428106.firebaseapp.com";
52       projectId = "follow-428106";
53       storageBucket = "follow-428106.appspot.com";
54       messagingSenderId = "194977404578";
55       appId = "1:194977404578:web:1920bb0c9ea5e2373669fb";
56       measurementId = "G-SJE57D4F14";
57     };
58   };
60   desktopItem = makeDesktopItem {
61     name = "follow";
62     desktopName = "Follow";
63     comment = "Next generation information browser";
64     icon = "follow";
65     exec = "follow";
66     categories = [ "Utility" ];
67     mimeTypes = [ "x-scheme-handler/follow" ];
68   };
70   icon = src + "/resources/icon.png";
72   buildPhase = ''
73     runHook preBuild
75     pnpm --offline electron-vite build
76     # Remove dev dependencies.
77     pnpm --ignore-scripts prune --prod
78     # Clean up broken symlinks left behind by `pnpm prune`
79     find node_modules/.bin -xtype l -delete
81     runHook postBuild
82   '';
84   installPhase = ''
85     runHook preInstall
87     mkdir -p $out/share/{applications,follow}
88     cp -r . $out/share/follow
89     rm -rf $out/share/follow/{.vscode,.github}
91     makeWrapper "${electron}/bin/electron" "$out/bin/follow" \
92       --inherit-argv0 \
93       --add-flags --disable-gpu-compositing \
94       --add-flags $out/share/follow \
95       --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime}}"
97     install -m 444 -D "${desktopItem}/share/applications/"* \
98         -t $out/share/applications/
100     for size in 16 24 32 48 64 128 256 512; do
101       mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
102       convert -background none -resize "$size"x"$size" ${icon} $out/share/icons/hicolor/"$size"x"$size"/apps/follow.png
103     done
105     runHook postInstall
106   '';
108   meta = {
109     description = "Next generation information browser";
110     homepage = "https://github.com/RSSNext/Follow";
111     license = lib.licenses.gpl3Only;
112     maintainers = with lib.maintainers; [ iosmanthus ];
113     platforms = [ "x86_64-linux" ];
114     mainProgram = "follow";
115   };