From 397ffc81e65ec8780f87579e566833d74d776562 Mon Sep 17 00:00:00 2001 From: Guy Chronister Date: Mon, 19 Jan 2026 09:54:41 -0600 Subject: [PATCH] gnuplot: migrate to by-name, switch to finalAttrs, and remove Qt-specific mkDerivation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This refactor performs a mechanical migration of gnuplot to the by-name layout and updates the derivation to the modern finalAttrs style. Key changes: * Move gnuplot from pkgs/tools/graphics/gnuplot/ to pkgs/by-name/gn/gnuplot/ and rename set-gdfontpath-from-fontconfig.sh accordingly. * Replace the old `rec { ... }` form with `stdenv.mkDerivation (finalAttrs: { ... })` following current Nixpkgs conventions. * Remove the unused mkDerivation argument and stop switching the derivation function based on `withQt`. gnuplot does not require libsForQt5.mkDerivation; Qt support is handled entirely through inputs and configure flags. * Replace qttools/qtbase/qtsvg with libsForQt5.qttools/qtbase/qtsvg when `withQt = true`. * Convert `${pname}-${version}` to `${finalAttrs.version}` and update `sha256` → `hash`. * Add by-name variants gnuplot_qt and gnuplot_aquaterm using override wrappers. * Remove the old top-level aliases for gnuplot, gnuplot_qt, and gnuplot_aquaterm from all-packages.nix; by-name exposure now handles them. This change is purely structural and does not modify gnuplot’s build behaviour beyond adopting the standard finalAttrs pattern. --- .../gn/gnuplot/package.nix} | 21 ++++++++----------- .../gnuplot/set-gdfontpath-from-fontconfig.sh | 0 pkgs/by-name/gn/gnuplot_aquaterm/package.nix | 7 +++++++ pkgs/by-name/gn/gnuplot_qt/package.nix | 7 +++++++ pkgs/top-level/all-packages.nix | 7 ------- 5 files changed, 23 insertions(+), 19 deletions(-) rename pkgs/{tools/graphics/gnuplot/default.nix => by-name/gn/gnuplot/package.nix} (90%) rename pkgs/{tools/graphics => by-name/gn}/gnuplot/set-gdfontpath-from-fontconfig.sh (100%) create mode 100644 pkgs/by-name/gn/gnuplot_aquaterm/package.nix create mode 100644 pkgs/by-name/gn/gnuplot_qt/package.nix diff --git a/pkgs/tools/graphics/gnuplot/default.nix b/pkgs/by-name/gn/gnuplot/package.nix similarity index 90% rename from pkgs/tools/graphics/gnuplot/default.nix rename to pkgs/by-name/gn/gnuplot/package.nix index 8a1fb92d513c..2a9c7f13d07d 100644 --- a/pkgs/tools/graphics/gnuplot/default.nix +++ b/pkgs/by-name/gn/gnuplot/package.nix @@ -28,22 +28,19 @@ gnused, coreutils, withQt ? false, - qttools, - wrapQtAppsHook, - qtbase, - qtsvg, + qt5, }: let withX = !aquaterm && !stdenv.hostPlatform.isDarwin; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "gnuplot"; version = "6.0.4"; src = fetchurl { - url = "mirror://sourceforge/gnuplot/gnuplot-${version}.tar.gz"; - sha256 = "sha256-RY2UdpYl5z1fYjJQD0nLrcsrGDOA1D0iZqD5cBrrnFs="; + url = "mirror://sourceforge/gnuplot/gnuplot-${finalAttrs.version}.tar.gz"; + hash = "sha256-RY2UdpYl5z1fYjJQD0nLrcsrGDOA1D0iZqD5cBrrnFs="; }; nativeBuildInputs = [ @@ -52,8 +49,8 @@ stdenv.mkDerivation rec { texinfo ] ++ lib.optionals withQt [ - qttools - wrapQtAppsHook + qt5.qttools + qt5.wrapQtAppsHook ]; buildInputs = [ @@ -74,8 +71,8 @@ stdenv.mkDerivation rec { libxaw ] ++ lib.optionals withQt [ - qtbase - qtsvg + qt5.qtbase + qt5.qtsvg ] ++ lib.optional withWxGTK wxwidgets_3_2; @@ -131,4 +128,4 @@ stdenv.mkDerivation rec { maintainers = [ ]; mainProgram = "gnuplot"; }; -} +}) diff --git a/pkgs/tools/graphics/gnuplot/set-gdfontpath-from-fontconfig.sh b/pkgs/by-name/gn/gnuplot/set-gdfontpath-from-fontconfig.sh similarity index 100% rename from pkgs/tools/graphics/gnuplot/set-gdfontpath-from-fontconfig.sh rename to pkgs/by-name/gn/gnuplot/set-gdfontpath-from-fontconfig.sh diff --git a/pkgs/by-name/gn/gnuplot_aquaterm/package.nix b/pkgs/by-name/gn/gnuplot_aquaterm/package.nix new file mode 100644 index 000000000000..b98f0473a1f5 --- /dev/null +++ b/pkgs/by-name/gn/gnuplot_aquaterm/package.nix @@ -0,0 +1,7 @@ +{ + gnuplot, +}: + +gnuplot.override { + aquaterm = true; +} diff --git a/pkgs/by-name/gn/gnuplot_qt/package.nix b/pkgs/by-name/gn/gnuplot_qt/package.nix new file mode 100644 index 000000000000..dc503dd2a923 --- /dev/null +++ b/pkgs/by-name/gn/gnuplot_qt/package.nix @@ -0,0 +1,7 @@ +{ + gnuplot, +}: + +gnuplot.override { + withQt = true; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index aacd720403d5..8259d7508ad5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2401,13 +2401,6 @@ with pkgs; }; gnupg = gnupg24; - gnuplot = libsForQt5.callPackage ../tools/graphics/gnuplot { }; - - gnuplot_qt = gnuplot.override { withQt = true; }; - - # must have AquaTerm installed separately - gnuplot_aquaterm = gnuplot.override { aquaterm = true; }; - gnused = callPackage ../tools/text/gnused { }; gnutar = callPackage ../tools/archivers/gnutar { };