Skip to content

Commit e662811

Browse files
authored
styluslabs-write: init at 2024-10-12 (#346463)
2 parents 665ebfb + 2089b0d commit e662811

File tree

4 files changed

+115
-8
lines changed

4 files changed

+115
-8
lines changed

pkgs/applications/graphics/write_stylus/default.nix renamed to pkgs/by-name/st/styluslabs-write-bin/package.nix

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ mkDerivation, stdenv, lib, qtbase, qtsvg, libglvnd, libX11, libXi, fetchurl, makeDesktopItem }:
1+
{ stdenv, lib, libsForQt5, libglvnd, libX11, libXi, fetchurl, makeDesktopItem }:
22
let
33
desktopItem = makeDesktopItem {
44
name = "Write";
@@ -10,8 +10,8 @@ let
1010
categories = [ "Office" "Graphics" ];
1111
};
1212
in
13-
mkDerivation rec {
14-
pname = "write_stylus";
13+
stdenv.mkDerivation rec {
14+
pname = "styluslabs-write-bin";
1515
version = "300";
1616

1717
src = fetchurl {
@@ -37,8 +37,8 @@ mkDerivation rec {
3737
'';
3838
preFixup = let
3939
libPath = lib.makeLibraryPath [
40-
qtbase # libQt5PrintSupport.so.5
41-
qtsvg # libQt5Svg.so.5
40+
libsForQt5.qtbase # libQt5PrintSupport.so.5
41+
libsForQt5.qtsvg # libQt5Svg.so.5
4242
stdenv.cc.cc.lib # libstdc++.so.6
4343
libglvnd # libGL.so.1
4444
libX11 # libX11.so.6
@@ -57,6 +57,6 @@ mkDerivation rec {
5757
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
5858
platforms = platforms.linux;
5959
license = lib.licenses.unfree;
60-
maintainers = with maintainers; [ oyren ];
60+
maintainers = with maintainers; [ oyren lukts30 atemu ];
6161
};
6262
}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
lib,
3+
fetchFromGitHub,
4+
stdenv,
5+
pkg-config,
6+
SDL2,
7+
xorg,
8+
libGL,
9+
roboto,
10+
imagemagick,
11+
}:
12+
13+
stdenv.mkDerivation (finalAttrs: {
14+
pname = "styluslabs-write";
15+
version = "2024-10-12";
16+
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+
};
33+
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+
'';
46+
47+
postBuild = ''
48+
popd
49+
'';
50+
51+
strictDeps = true;
52+
53+
nativeBuildInputs = [
54+
imagemagick # magick
55+
pkg-config
56+
];
57+
58+
buildInputs = [
59+
SDL2
60+
xorg.libX11
61+
xorg.libXi
62+
xorg.libXcursor
63+
libGL
64+
];
65+
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
73+
74+
ln -s ../opt/Write $out/bin/Write
75+
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
80+
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+
'';
86+
87+
enableParallelBuilding = true;
88+
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.isLinux;
106+
mainProgram = "Write";
107+
};
108+
})

pkgs/top-level/aliases.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,6 +1731,7 @@ mapAliases {
17311731
wrapLisp_old = throw "Lisp packages have been redesigned. See 'lisp-modules' in the nixpkgs manual."; # Added 2024-05-07
17321732
wmii_hg = wmii;
17331733
wrapGAppsHook = wrapGAppsHook3; # Added 2024-03-26
1734+
write_stylus = styluslabs-write-bin; # Added 2024-10-09
17341735
wxGTK30 = throw "wxGTK30 has been removed from nixpkgs as it has reached end of life"; # Added 2023-03-22
17351736
wxGTK30-gtk2 = wxGTK30; # Added 2022-12-03
17361737
wxGTK30-gtk3 = wxGTK30; # Added 2022-12-03

pkgs/top-level/all-packages.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33495,8 +33495,6 @@ with pkgs;
3349533495

3349633496
wings = callPackage ../applications/graphics/wings { };
3349733497

33498-
write_stylus = libsForQt5.callPackage ../applications/graphics/write_stylus { };
33499-
3350033498
wlc = callPackage ../tools/misc/wlc { };
3350133499

3350233500
wlclock = callPackage ../applications/misc/wlclock { };

0 commit comments

Comments
 (0)