From 2187cf9bab2dde492e055f4c134aa650972951bd Mon Sep 17 00:00:00 2001 From: lukts30 Date: Wed, 9 Oct 2024 20:51:30 +0200 Subject: [PATCH 1/2] write_stylus: rename to styluslabs-write-bin --- .../st/styluslabs-write-bin/package.nix} | 12 ++++++------ pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 2 -- 3 files changed, 7 insertions(+), 8 deletions(-) rename pkgs/{applications/graphics/write_stylus/default.nix => by-name/st/styluslabs-write-bin/package.nix} (83%) 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/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 88b828c32cbe..761c445f9841 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1699,6 +1699,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 787f20384e3c..72c1e28d02f9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33635,8 +33635,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 { }; From 2089b0d9617d6966fd5b62f8b8dab5dfedbc7613 Mon Sep 17 00:00:00 2001 From: lukts30 Date: Tue, 15 Oct 2024 22:39:00 +0200 Subject: [PATCH 2/2] styluslabs-write: init at 2024-10-12 --- pkgs/by-name/st/styluslabs-write/package.nix | 108 +++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 pkgs/by-name/st/styluslabs-write/package.nix 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"; + }; +})