diff --git a/pkgs/applications/graphics/write_stylus/default.nix b/pkgs/by-name/st/styluslabs-write-bin/package.nix similarity index 83% rename from pkgs/applications/graphics/write_stylus/default.nix rename to pkgs/by-name/st/styluslabs-write-bin/package.nix index be20635c5001..4e5ca2af4942 100644 --- a/pkgs/applications/graphics/write_stylus/default.nix +++ b/pkgs/by-name/st/styluslabs-write-bin/package.nix @@ -1,4 +1,4 @@ -{ mkDerivation, stdenv, lib, qtbase, qtsvg, libglvnd, libX11, libXi, fetchurl, makeDesktopItem }: +{ stdenv, lib, libsForQt5, libglvnd, libX11, libXi, fetchurl, makeDesktopItem }: let desktopItem = makeDesktopItem { name = "Write"; @@ -10,8 +10,8 @@ let categories = [ "Office" "Graphics" ]; }; in -mkDerivation rec { - pname = "write_stylus"; +stdenv.mkDerivation rec { + pname = "styluslabs-write-bin"; version = "300"; src = fetchurl { @@ -37,8 +37,8 @@ mkDerivation rec { ''; preFixup = let libPath = lib.makeLibraryPath [ - qtbase # libQt5PrintSupport.so.5 - qtsvg # libQt5Svg.so.5 + libsForQt5.qtbase # libQt5PrintSupport.so.5 + libsForQt5.qtsvg # libQt5Svg.so.5 stdenv.cc.cc.lib # libstdc++.so.6 libglvnd # libGL.so.1 libX11 # libX11.so.6 @@ -57,6 +57,6 @@ mkDerivation rec { sourceProvenance = with sourceTypes; [ binaryNativeCode ]; platforms = platforms.linux; license = lib.licenses.unfree; - maintainers = with maintainers; [ oyren ]; + maintainers = with maintainers; [ oyren lukts30 atemu ]; }; } diff --git a/pkgs/by-name/st/styluslabs-write/package.nix b/pkgs/by-name/st/styluslabs-write/package.nix new file mode 100644 index 000000000000..6efc8c246513 --- /dev/null +++ b/pkgs/by-name/st/styluslabs-write/package.nix @@ -0,0 +1,108 @@ +{ + lib, + fetchFromGitHub, + stdenv, + pkg-config, + SDL2, + xorg, + libGL, + roboto, + imagemagick, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "styluslabs-write"; + version = "2024-10-12"; + + src = fetchFromGitHub { + owner = "styluslabs"; + repo = "Write"; + rev = "b13572e2dd6a87af35cd3edde92c9144a6dd8a2b"; + hash = "sha256-cL6jU54LTkYu0mLNOgSDgChkDdg7eQaM00hTMas6cTg="; + fetchSubmodules = true; + leaveDotGit = true; + # Delete .git folder for better reproducibility + # TODO: fix GITCOUNT is always 1 but is not used in Linux Build anyway + postFetch = '' + cd $out + git rev-parse --short HEAD > $out/GITREV + git rev-list --count HEAD > $out/GITCOUNT + rm -rf $out/.git + ''; + }; + + hardeningDisable = [ "format" ]; + makeFlags = [ + "DEBUG=0" + "USE_SYSTEM_SDL=1" + ]; + preBuild = '' + makeFlagsArray+=( + "GITREV=$(cat ./GITREV)" + "GITCOUNT=$(cat ./GITCOUNT)" + ) + pushd syncscribble + ''; + + postBuild = '' + popd + ''; + + strictDeps = true; + + nativeBuildInputs = [ + imagemagick # magick + pkg-config + ]; + + buildInputs = [ + SDL2 + xorg.libX11 + xorg.libXi + xorg.libXcursor + libGL + ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/{bin,opt} + install -m555 -D syncscribble/Release/Write $out/opt/ + install -m444 -D scribbleres/Intro.svg $out/opt/ + install -m444 -D scribbleres/fonts/DroidSansFallback.ttf $out/opt/ + ln -s ${roboto}/share/fonts/truetype/Roboto-Regular.ttf $out/opt/Roboto-Regular.ttf + + ln -s ../opt/Write $out/bin/Write + + for i in 16 24 48 64 96 128 256 512; do + mkdir -p $out/share/icons/hicolor/''${i}x''${i}/apps + magick scribbleres/write_512.png -resize ''${i}x''${i} $out/share/icons/hicolor/''${i}x''${i}/apps/${finalAttrs.pname}.png + done + + install -Dm444 scribbleres/linux/Write.desktop -t $out/share/applications + substituteInPlace $out/share/applications/Write.desktop \ + --replace-fail 'Exec=/opt/Write/Write' 'Exec=Write' \ + --replace-fail 'Icon=Write144x144' 'Icon=${finalAttrs.pname}' + ''; + + enableParallelBuilding = true; + + meta = { + homepage = "https://styluslabs.com/"; + description = "Cross-platform (Windows, Mac, Linux, iOS, Android) application for handwritten notes"; + license = with lib.licenses; [ + # miniz, pugixml, stb, ugui, ulib, usvg + mit + # nanovgXC + zlib + # styluslabs-write itself + agpl3Only + ]; + maintainers = with lib.maintainers; [ + lukts30 + atemu + ]; + platforms = with lib.platforms; linux ++ darwin ++ windows; + broken = !stdenv.isLinux; + mainProgram = "Write"; + }; +}) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 087dab080f6b..beb2e4615302 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1731,6 +1731,7 @@ mapAliases { wrapLisp_old = throw "Lisp packages have been redesigned. See 'lisp-modules' in the nixpkgs manual."; # Added 2024-05-07 wmii_hg = wmii; wrapGAppsHook = wrapGAppsHook3; # Added 2024-03-26 + write_stylus = styluslabs-write-bin; # Added 2024-10-09 wxGTK30 = throw "wxGTK30 has been removed from nixpkgs as it has reached end of life"; # Added 2023-03-22 wxGTK30-gtk2 = wxGTK30; # Added 2022-12-03 wxGTK30-gtk3 = wxGTK30; # Added 2022-12-03 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 55f814f4e4c9..0ddceb3983bc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33495,8 +33495,6 @@ with pkgs; wings = callPackage ../applications/graphics/wings { }; - write_stylus = libsForQt5.callPackage ../applications/graphics/write_stylus { }; - wlc = callPackage ../tools/misc/wlc { }; wlclock = callPackage ../applications/misc/wlclock { };