From 68622ebcc7e151effd254a86bc704af37ee04ff2 Mon Sep 17 00:00:00 2001 From: ppenguin Date: Tue, 26 Nov 2024 00:58:58 +0100 Subject: [PATCH 1/2] nomacs-qt6: init (master + plugins) cleanup --- pkgs/by-name/no/nomacs-qt6/package.nix | 116 +++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 pkgs/by-name/no/nomacs-qt6/package.nix diff --git a/pkgs/by-name/no/nomacs-qt6/package.nix b/pkgs/by-name/no/nomacs-qt6/package.nix new file mode 100644 index 000000000000..ac25af8e5a54 --- /dev/null +++ b/pkgs/by-name/no/nomacs-qt6/package.nix @@ -0,0 +1,116 @@ +{ + cmake, + exiv2, + fetchFromGitHub, + kdePackages, + lib, + libraw, + libtiff, + opencv4, + pkg-config, + qt6, + stdenv, + withPlugins ? true, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "nomacs"; + rev = "9a3ef35"; + version = "20241125-${finalAttrs.rev}"; + + src = fetchFromGitHub { + owner = "nomacs"; + repo = finalAttrs.pname; + inherit (finalAttrs) rev; + fetchSubmodules = withPlugins; # NOTE: changed to true to get plugins. Does this have side effects? + hash = "sha256-kVRbebyVRXqsc+NfyaXl7h8o9Yk8vdxT3ENeWjCEG78="; + }; + + # NOTE: fetch plugins as submodule (according to the docs it should work via .gitmodules) + # https://github.com/nomacs/nomacs-plugins + # How to _only_ get the plugins submodule? For now we just fetch all and delete everything else + postFetch = '' + rm -rf 3rd-party + ''; + + outputs = + ["out"] + # man pages are not installed on Darwin, see cmake/{Mac,Unix}BuildTarget.cmake + ++ lib.optionals (!stdenv.hostPlatform.isDarwin) ["man"]; + + sourceRoot = "${finalAttrs.src.name}/ImageLounge"; + + nativeBuildInputs = [ + cmake + qt6.wrapQtAppsHook + pkg-config + ]; + + buildInputs = + [ + exiv2 + libraw + libtiff + # Once python stops relying on `propagatedBuildInputs` (https://github.com/NixOS/nixpkgs/issues/272178), deprecate `cxxdev` and switch to `dev`; + # note `dev` is selected by `mkDerivation` automatically, so one should omit `getOutput "dev"`; + # see: https://github.com/NixOS/nixpkgs/pull/314186#issuecomment-2129974277 + (lib.getOutput "cxxdev" opencv4) + ] + # ++ (lib.optional stdenv.hostPlatform.isLinux qt6.qtwayland) # FIXME: is this now automatically propagated??? + # TODO: should we include qt-heif-image-plugin? It's not in nixpkgs yet, but it seems to be Qt5 only? + ++ (with kdePackages; [ + kimageformats + qtbase + qtimageformats + qtsvg + qttools + quazip + ]); + + cmakeFlags = [ + (lib.cmakeBool "ENABLE_OPENCV" true) + (lib.cmakeBool "ENABLE_QUAZIP" true) + (lib.cmakeBool "ENABLE_RAW" true) + (lib.cmakeBool "ENABLE_TIFF" true) + (lib.cmakeBool "ENABLE_TRANSLATIONS" true) + (lib.cmakeBool "USE_SYSTEM_QUAZIP" true) + ]; + + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' + mkdir -p $out/{Applications,lib} + mv $out/nomacs.app $out/Applications/nomacs.app + mv $out/libnomacsCore.dylib $out/lib/libnomacsCore.dylib + ''; + # FIXME: + # why can't we have nomacs look in the "standard" plugin directory??? + # None of the wrap stuff worked... + # Let's just instead move the plugin dir brute force + postFixup = '' + mv $out/lib/nomacs-plugins $out/bin/plugins + ''; + + meta = { + homepage = "https://nomacs.org"; + description = "Qt-based image viewer"; + longDescription = '' + nomacs is a free, open source image viewer, which supports multiple + platforms. You can use it for viewing all common image formats including + RAW and psd images. + + nomacs features semi-transparent widgets that display additional + information such as thumbnails, metadata or histogram. It is able to + browse images in zip or MS Office files which can be extracted to a + directory. Metadata stored with the image can be displayed and you can add + notes to images. A thumbnail preview of the current folder is included as + well as a file explorer panel which allows switching between + folders. Within a directory you can apply a file filter, so that only + images are displayed whose filenames have a certain string or match a + regular expression. Activating the cache allows for instantly switching + between images. + ''; + changelog = "https://github.com/nomacs/nomacs/releases/tag/${finalAttrs.src.rev}"; + license = with lib.licenses; [gpl3Plus]; + mainProgram = "nomacs"; + maintainers = with lib.maintainers; [mindavi]; + inherit (kdePackages.qtbase.meta) platforms; + }; +}) From cf887a6a6373354275178bf358184883a5c83b97 Mon Sep 17 00:00:00 2001 From: ppenguin Date: Sun, 1 Dec 2024 17:41:48 +0100 Subject: [PATCH 2/2] nomacs: add nomad-qt6; enable plugins by default --- pkgs/by-name/no/nomacs-qt6/package.nix | 116 ------------------------- pkgs/by-name/no/nomacs/package.nix | 98 ++++++++++++++------- pkgs/top-level/all-packages.nix | 2 + 3 files changed, 68 insertions(+), 148 deletions(-) delete mode 100644 pkgs/by-name/no/nomacs-qt6/package.nix diff --git a/pkgs/by-name/no/nomacs-qt6/package.nix b/pkgs/by-name/no/nomacs-qt6/package.nix deleted file mode 100644 index ac25af8e5a54..000000000000 --- a/pkgs/by-name/no/nomacs-qt6/package.nix +++ /dev/null @@ -1,116 +0,0 @@ -{ - cmake, - exiv2, - fetchFromGitHub, - kdePackages, - lib, - libraw, - libtiff, - opencv4, - pkg-config, - qt6, - stdenv, - withPlugins ? true, -}: -stdenv.mkDerivation (finalAttrs: { - pname = "nomacs"; - rev = "9a3ef35"; - version = "20241125-${finalAttrs.rev}"; - - src = fetchFromGitHub { - owner = "nomacs"; - repo = finalAttrs.pname; - inherit (finalAttrs) rev; - fetchSubmodules = withPlugins; # NOTE: changed to true to get plugins. Does this have side effects? - hash = "sha256-kVRbebyVRXqsc+NfyaXl7h8o9Yk8vdxT3ENeWjCEG78="; - }; - - # NOTE: fetch plugins as submodule (according to the docs it should work via .gitmodules) - # https://github.com/nomacs/nomacs-plugins - # How to _only_ get the plugins submodule? For now we just fetch all and delete everything else - postFetch = '' - rm -rf 3rd-party - ''; - - outputs = - ["out"] - # man pages are not installed on Darwin, see cmake/{Mac,Unix}BuildTarget.cmake - ++ lib.optionals (!stdenv.hostPlatform.isDarwin) ["man"]; - - sourceRoot = "${finalAttrs.src.name}/ImageLounge"; - - nativeBuildInputs = [ - cmake - qt6.wrapQtAppsHook - pkg-config - ]; - - buildInputs = - [ - exiv2 - libraw - libtiff - # Once python stops relying on `propagatedBuildInputs` (https://github.com/NixOS/nixpkgs/issues/272178), deprecate `cxxdev` and switch to `dev`; - # note `dev` is selected by `mkDerivation` automatically, so one should omit `getOutput "dev"`; - # see: https://github.com/NixOS/nixpkgs/pull/314186#issuecomment-2129974277 - (lib.getOutput "cxxdev" opencv4) - ] - # ++ (lib.optional stdenv.hostPlatform.isLinux qt6.qtwayland) # FIXME: is this now automatically propagated??? - # TODO: should we include qt-heif-image-plugin? It's not in nixpkgs yet, but it seems to be Qt5 only? - ++ (with kdePackages; [ - kimageformats - qtbase - qtimageformats - qtsvg - qttools - quazip - ]); - - cmakeFlags = [ - (lib.cmakeBool "ENABLE_OPENCV" true) - (lib.cmakeBool "ENABLE_QUAZIP" true) - (lib.cmakeBool "ENABLE_RAW" true) - (lib.cmakeBool "ENABLE_TIFF" true) - (lib.cmakeBool "ENABLE_TRANSLATIONS" true) - (lib.cmakeBool "USE_SYSTEM_QUAZIP" true) - ]; - - postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' - mkdir -p $out/{Applications,lib} - mv $out/nomacs.app $out/Applications/nomacs.app - mv $out/libnomacsCore.dylib $out/lib/libnomacsCore.dylib - ''; - # FIXME: - # why can't we have nomacs look in the "standard" plugin directory??? - # None of the wrap stuff worked... - # Let's just instead move the plugin dir brute force - postFixup = '' - mv $out/lib/nomacs-plugins $out/bin/plugins - ''; - - meta = { - homepage = "https://nomacs.org"; - description = "Qt-based image viewer"; - longDescription = '' - nomacs is a free, open source image viewer, which supports multiple - platforms. You can use it for viewing all common image formats including - RAW and psd images. - - nomacs features semi-transparent widgets that display additional - information such as thumbnails, metadata or histogram. It is able to - browse images in zip or MS Office files which can be extracted to a - directory. Metadata stored with the image can be displayed and you can add - notes to images. A thumbnail preview of the current folder is included as - well as a file explorer panel which allows switching between - folders. Within a directory you can apply a file filter, so that only - images are displayed whose filenames have a certain string or match a - regular expression. Activating the cache allows for instantly switching - between images. - ''; - changelog = "https://github.com/nomacs/nomacs/releases/tag/${finalAttrs.src.rev}"; - license = with lib.licenses; [gpl3Plus]; - mainProgram = "nomacs"; - maintainers = with lib.maintainers; [mindavi]; - inherit (kdePackages.qtbase.meta) platforms; - }; -}) diff --git a/pkgs/by-name/no/nomacs/package.nix b/pkgs/by-name/no/nomacs/package.nix index 4c8a1465fc61..91ce841ac804 100644 --- a/pkgs/by-name/no/nomacs/package.nix +++ b/pkgs/by-name/no/nomacs/package.nix @@ -1,55 +1,79 @@ -{ lib -, cmake -, exiv2 -, fetchFromGitHub -, libraw -, libsForQt5 -, libtiff -, opencv4 -, pkg-config -, stdenv +{ + lib, + cmake, + exiv2, + fetchFromGitHub, + libraw, + libsForQt5, + kdePackages, + libtiff, + opencv4, + pkg-config, + stdenv, + qtVersion ? 5, }: - +let + myQt = if qtVersion == 5 then libsForQt5 else kdePackages; + inherit (myQt) wrapQtAppsHook; +in stdenv.mkDerivation (finalAttrs: { pname = "nomacs"; version = "3.19.1"; + hash = "sha256-NRwZ/ShJaLCMFv7QdfRoJY5zQFo18cAVWGRpS3ap3Rw="; src = fetchFromGitHub { owner = "nomacs"; repo = "nomacs"; rev = finalAttrs.version; fetchSubmodules = false; # We'll use our own - hash = "sha256-NRwZ/ShJaLCMFv7QdfRoJY5zQFo18cAVWGRpS3ap3Rw="; + inherit (finalAttrs) hash; }; - outputs = [ "out" ] + plugins = fetchFromGitHub { + owner = "novomesk"; + repo = "nomacs-plugins"; + rev = "40d0f7089b7f108077dac5dede52e8a303b243b3"; + hash = "sha256-7+JMmHaTvWjVTkLwXGtQHnoaC/3vK7haCzNvVIZ9F/g="; + }; + + outputs = + [ "out" ] # man pages are not installed on Darwin, see cmake/{Mac,Unix}BuildTarget.cmake ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ "man" ]; sourceRoot = "${finalAttrs.src.name}/ImageLounge"; + postUnpack = '' + rm -rf $sourceRoot/plugins + mkdir $sourceRoot/plugins + cp -r ${finalAttrs.plugins}/* $sourceRoot/plugins/ + chmod -R +w $sourceRoot/plugins + ''; + nativeBuildInputs = [ cmake - libsForQt5.wrapQtAppsHook + wrapQtAppsHook pkg-config ]; - buildInputs = [ - exiv2 - libraw - libtiff - # Once python stops relying on `propagatedBuildInputs` (https://github.com/NixOS/nixpkgs/issues/272178), deprecate `cxxdev` and switch to `dev`; - # note `dev` is selected by `mkDerivation` automatically, so one should omit `getOutput "dev"`; - # see: https://github.com/NixOS/nixpkgs/pull/314186#issuecomment-2129974277 - (lib.getOutput "cxxdev" opencv4) - ] ++ (with libsForQt5; [ - kimageformats - qtbase - qtimageformats - qtsvg - qttools - quazip - ]); + buildInputs = + [ + exiv2 + libraw + libtiff + # Once python stops relying on `propagatedBuildInputs` (https://github.com/NixOS/nixpkgs/issues/272178), deprecate `cxxdev` and switch to `dev`; + # note `dev` is selected by `mkDerivation` automatically, so one should omit `getOutput "dev"`; + # see: https://github.com/NixOS/nixpkgs/pull/314186#issuecomment-2129974277 + (lib.getOutput "cxxdev" opencv4) + ] + ++ (with myQt; [ + kimageformats + qtbase + qtimageformats + qtsvg + qttools + quazip + ]); cmakeFlags = [ (lib.cmakeBool "ENABLE_OPENCV" true) @@ -65,6 +89,13 @@ stdenv.mkDerivation (finalAttrs: { mv $out/nomacs.app $out/Applications/nomacs.app mv $out/libnomacsCore.dylib $out/lib/libnomacsCore.dylib ''; + # FIXME: + # why can't we have nomacs look in the "standard" plugin directory??? + # None of the wrap stuff worked... + # Let's just instead move the plugin dir brute force + postFixup = '' + mv $out/lib/nomacs-plugins $out/bin/plugins + ''; meta = { homepage = "https://nomacs.org"; @@ -88,7 +119,10 @@ stdenv.mkDerivation (finalAttrs: { changelog = "https://github.com/nomacs/nomacs/releases/tag/${finalAttrs.src.rev}"; license = with lib.licenses; [ gpl3Plus ]; mainProgram = "nomacs"; - maintainers = with lib.maintainers; [ mindavi ]; - inherit (libsForQt5.qtbase.meta) platforms; + maintainers = with lib.maintainers; [ + mindavi + ppenguin + ]; + inherit (myQt.qtbase.meta) platforms; }; }) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 402140f69c27..72b3b63a2e5e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4550,6 +4550,8 @@ with pkgs; nomad_1_9 ; + nomacs-qt6 = nomacs.override { qtVersion = 6; }; + nth = with python3Packages; toPythonApplication name-that-hash; nvchecker = with python3Packages; toPythonApplication (