vifm: 0.13 -> 0.14 (#380559)
[NixPkgs.git] / pkgs / by-name / st / styluslabs-write / package.nix
blob2da1066ae97509fa1974c2619805fc8fe705e156
2   lib,
3   fetchFromGitHub,
4   stdenv,
5   pkg-config,
6   SDL2,
7   xorg,
8   libGL,
9   roboto,
10   imagemagick,
13 stdenv.mkDerivation (finalAttrs: {
14   pname = "styluslabs-write";
15   version = "2024-10-12";
17   src = fetchFromGitHub {
18     owner = "styluslabs";
19     repo = "Write";
20     rev = "b13572e2dd6a87af35cd3edde92c9144a6dd8a2b";
21     hash = "sha256-cL6jU54LTkYu0mLNOgSDgChkDdg7eQaM00hTMas6cTg=";
22     fetchSubmodules = true;
23     leaveDotGit = true;
24     # Delete .git folder for better reproducibility
25     # TODO: fix GITCOUNT is always 1 but is not used in Linux Build anyway
26     postFetch = ''
27       cd $out
28       git rev-parse --short HEAD > $out/GITREV
29       git rev-list --count HEAD > $out/GITCOUNT
30       rm -rf $out/.git
31     '';
32   };
34   hardeningDisable = [ "format" ];
35   makeFlags = [
36     "DEBUG=0"
37     "USE_SYSTEM_SDL=1"
38   ];
39   preBuild = ''
40     makeFlagsArray+=(
41       "GITREV=$(cat ./GITREV)"
42       "GITCOUNT=$(cat ./GITCOUNT)"
43     )
44     pushd syncscribble
45   '';
47   postBuild = ''
48     popd
49   '';
51   strictDeps = true;
53   nativeBuildInputs = [
54     imagemagick # magick
55     pkg-config
56   ];
58   buildInputs = [
59     SDL2
60     xorg.libX11
61     xorg.libXi
62     xorg.libXcursor
63     libGL
64   ];
66   installPhase = ''
67     runHook preInstall
68     mkdir -p $out/{bin,opt}
69     install -m555 -D syncscribble/Release/Write $out/opt/
70     install -m444 -D scribbleres/Intro.svg $out/opt/
71     install -m444 -D scribbleres/fonts/DroidSansFallback.ttf $out/opt/
72     ln -s ${roboto}/share/fonts/truetype/Roboto-Regular.ttf $out/opt/Roboto-Regular.ttf
74     ln -s ../opt/Write $out/bin/Write
76     for i in 16 24 48 64 96 128 256 512; do
77       mkdir -p $out/share/icons/hicolor/''${i}x''${i}/apps
78       magick scribbleres/write_512.png -resize ''${i}x''${i} $out/share/icons/hicolor/''${i}x''${i}/apps/${finalAttrs.pname}.png
79     done
81     install -Dm444 scribbleres/linux/Write.desktop -t $out/share/applications
82     substituteInPlace $out/share/applications/Write.desktop \
83         --replace-fail 'Exec=/opt/Write/Write' 'Exec=Write' \
84         --replace-fail 'Icon=Write144x144' 'Icon=${finalAttrs.pname}'
85   '';
87   enableParallelBuilding = true;
89   meta = {
90     homepage = "https://styluslabs.com/";
91     description = "Cross-platform (Windows, Mac, Linux, iOS, Android) application for handwritten notes";
92     license = with lib.licenses; [
93       # miniz, pugixml, stb, ugui, ulib, usvg
94       mit
95       # nanovgXC
96       zlib
97       # styluslabs-write itself
98       agpl3Only
99     ];
100     maintainers = with lib.maintainers; [
101       lukts30
102       atemu
103     ];
104     platforms = with lib.platforms; linux ++ darwin ++ windows;
105     broken = !stdenv.hostPlatform.isLinux;
106     mainProgram = "Write";
107   };