From 147760c141c4eaf02ab42b783d35de1032c3cdbe Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Wed, 15 May 2024 12:34:31 +0200 Subject: cdemu: avoid double-wrapper and nested callPackage --- pkgs/applications/emulators/cdemu/analyzer.nix | 21 +++++++++----- pkgs/applications/emulators/cdemu/base.nix | 32 ---------------------- pkgs/applications/emulators/cdemu/client.nix | 20 ++++++++++---- .../emulators/cdemu/common-drv-attrs.nix | 29 ++++++++++++++++++++ pkgs/applications/emulators/cdemu/daemon.nix | 18 +++++++----- pkgs/applications/emulators/cdemu/gui.nix | 24 ++++++++++------ pkgs/applications/emulators/cdemu/libmirage.nix | 24 ++++++++-------- 7 files changed, 97 insertions(+), 71 deletions(-) delete mode 100644 pkgs/applications/emulators/cdemu/base.nix create mode 100644 pkgs/applications/emulators/cdemu/common-drv-attrs.nix diff --git a/pkgs/applications/emulators/cdemu/analyzer.nix b/pkgs/applications/emulators/cdemu/analyzer.nix index 62288ddc22a4f..9db86e56d0827 100644 --- a/pkgs/applications/emulators/cdemu/analyzer.nix +++ b/pkgs/applications/emulators/cdemu/analyzer.nix @@ -1,14 +1,21 @@ -{ callPackage, makeWrapper, gobject-introspection, cmake, wrapGAppsHook3 +{ stdenv, cmake, pkg-config, callPackage, makeWrapper, gobject-introspection, wrapGAppsHook3 , python3Packages, gtk3, glib, libxml2, gnuplot, gnome, gdk-pixbuf, librsvg, intltool, libmirage }: -callPackage ./base.nix { - version = "3.2.6"; - pname = "image-analyzer"; - hash = "sha256-7I8RUgd+k3cEzskJGbziv1f0/eo5QQXn62wGh/Y5ozc="; - buildInputs = [ glib gtk3 libxml2 gnuplot libmirage gnome.adwaita-icon-theme gdk-pixbuf librsvg +stdenv.mkDerivation { + + inherit (callPackage ./common-drv-attrs.nix { + version = "3.2.6"; + pname = "image-analyzer"; + hash = "sha256-7I8RUgd+k3cEzskJGbziv1f0/eo5QQXn62wGh/Y5ozc="; + }) pname version src meta; + + buildInputs = [ libxml2 gnuplot libmirage gnome.adwaita-icon-theme gdk-pixbuf librsvg python3Packages.pygobject3 python3Packages.matplotlib ]; - nativeBuildInputs = [ gobject-introspection cmake wrapGAppsHook3 intltool ]; + nativeBuildInputs = [ cmake pkg-config wrapGAppsHook3 intltool ]; + + dontWrapGApps = true; postFixup = '' wrapProgram $out/bin/image-analyzer \ + ''${gappsWrapperArgs[@]} \ --set PYTHONPATH "$PYTHONPATH" ''; } diff --git a/pkgs/applications/emulators/cdemu/base.nix b/pkgs/applications/emulators/cdemu/base.nix deleted file mode 100644 index c48e682d963e5..0000000000000 --- a/pkgs/applications/emulators/cdemu/base.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ lib, stdenv, fetchurl, cmake, pkg-config -, pname, version, hash, buildInputs -, nativeBuildInputs ? [ ] -, postFixup ? "" -, extraDrvParams ? { } -}: -stdenv.mkDerivation ( { - inherit pname version buildInputs postFixup; - src = fetchurl { - url = "mirror://sourceforge/cdemu/${pname}-${version}.tar.xz"; - inherit hash; - }; - nativeBuildInputs = nativeBuildInputs ++ [ pkg-config cmake ]; - meta = with lib; { - description = "A suite of tools for emulating optical drives and discs"; - longDescription = '' - CDEmu consists of: - - - a kernel module implementing a virtual drive-controller - - libmirage which is a software library for interpreting optical disc images - - a daemon which emulates the functionality of an optical drive+disc - - textmode and GTK clients for controlling the emulator - - an image analyzer to view the structure of image files - - Optical media emulated by CDemu can be mounted within Linux. Automounting is also allowed. - ''; - homepage = "https://cdemu.sourceforge.io/"; - license = licenses.gpl2Plus; - platforms = platforms.linux; - maintainers = with lib.maintainers; [ bendlas ]; - }; -} // extraDrvParams) diff --git a/pkgs/applications/emulators/cdemu/client.nix b/pkgs/applications/emulators/cdemu/client.nix index 9b703335fd551..1c0e662f5accd 100644 --- a/pkgs/applications/emulators/cdemu/client.nix +++ b/pkgs/applications/emulators/cdemu/client.nix @@ -1,12 +1,20 @@ -{ callPackage, python3Packages, intltool, wrapGAppsNoGuiHook }: -callPackage ./base.nix { - version = "3.2.5"; - pname = "cdemu-client"; - hash = "sha256-py2F61v8vO0BCM18GCflAiD48deZjbMM6wqoCDZsOd8="; - nativeBuildInputs = [ intltool wrapGAppsNoGuiHook ]; +{ stdenv, callPackage, python3Packages, cmake, pkg-config, intltool, wrapGAppsNoGuiHook }: +stdenv.mkDerivation { + + inherit (callPackage ./common-drv-attrs.nix { + version = "3.2.5"; + pname = "cdemu-client"; + hash = "sha256-py2F61v8vO0BCM18GCflAiD48deZjbMM6wqoCDZsOd8="; + }) pname version src meta; + + nativeBuildInputs = [ cmake pkg-config intltool wrapGAppsNoGuiHook ]; buildInputs = with python3Packages; [ dbus-python pygobject3 ]; + + dontWrapGApps = true; postFixup = '' wrapProgram $out/bin/cdemu \ + ''${gappsWrapperArgs[@]} \ --set PYTHONPATH "$PYTHONPATH" ''; + } diff --git a/pkgs/applications/emulators/cdemu/common-drv-attrs.nix b/pkgs/applications/emulators/cdemu/common-drv-attrs.nix new file mode 100644 index 0000000000000..9c43e358981ef --- /dev/null +++ b/pkgs/applications/emulators/cdemu/common-drv-attrs.nix @@ -0,0 +1,29 @@ +{ lib, fetchurl +, pname, version, hash +}: + +{ + inherit pname version; + src = fetchurl { + url = "mirror://sourceforge/cdemu/${pname}-${version}.tar.xz"; + inherit hash; + }; + meta = with lib; { + description = "A suite of tools for emulating optical drives and discs"; + longDescription = '' + CDEmu consists of: + + - a kernel module implementing a virtual drive-controller + - libmirage which is a software library for interpreting optical disc images + - a daemon which emulates the functionality of an optical drive+disc + - textmode and GTK clients for controlling the emulator + - an image analyzer to view the structure of image files + + Optical media emulated by CDemu can be mounted within Linux. Automounting is also allowed. + ''; + homepage = "https://cdemu.sourceforge.io/"; + license = licenses.gpl2Plus; + platforms = platforms.linux; + maintainers = with lib.maintainers; [ bendlas ]; + }; +} diff --git a/pkgs/applications/emulators/cdemu/daemon.nix b/pkgs/applications/emulators/cdemu/daemon.nix index 843504d330690..5382efbff2376 100644 --- a/pkgs/applications/emulators/cdemu/daemon.nix +++ b/pkgs/applications/emulators/cdemu/daemon.nix @@ -1,11 +1,15 @@ -{ callPackage, glib, libao, intltool, libmirage, coreutils }: -callPackage ./base.nix { - version = "3.2.6"; - pname = "cdemu-daemon"; - hash = "sha256-puQE4+91xhRuNjVPZYgN/WO0uO8fVAOdxQWOGQ+FfY8="; - nativeBuildInputs = [ intltool ]; +{ stdenv, callPackage, cmake, pkg-config, glib, libao, intltool, libmirage, coreutils }: +stdenv.mkDerivation { + + inherit (callPackage ./common-drv-attrs.nix { + version = "3.2.6"; + pname = "cdemu-daemon"; + hash = "sha256-puQE4+91xhRuNjVPZYgN/WO0uO8fVAOdxQWOGQ+FfY8="; + }) pname version src meta; + + nativeBuildInputs = [ cmake pkg-config intltool ]; buildInputs = [ glib libao libmirage ]; - extraDrvParams.postInstall = '' + postInstall = '' mkdir -p $out/share/dbus-1/services cp -R ../service-example $out/share/cdemu substitute \ diff --git a/pkgs/applications/emulators/cdemu/gui.nix b/pkgs/applications/emulators/cdemu/gui.nix index a525783fec32e..b4a886471bb94 100644 --- a/pkgs/applications/emulators/cdemu/gui.nix +++ b/pkgs/applications/emulators/cdemu/gui.nix @@ -1,13 +1,21 @@ -{ callPackage, makeWrapper, gobject-introspection, cmake, wrapGAppsHook3 -, python3Packages, gtk3, glib, libnotify, intltool, gnome, gdk-pixbuf, librsvg }: -callPackage ./base.nix { - version = "3.2.6"; - pname = "gcdemu"; - hash = "sha256-w4vzKoSotL5Cjfr4Cu4YhNSWXJqS+n/vySrwvbhR1zA="; - buildInputs = [ python3Packages.pygobject3 gtk3 glib libnotify gnome.adwaita-icon-theme gdk-pixbuf librsvg ]; - nativeBuildInputs = [ cmake wrapGAppsHook3 intltool ]; +{ stdenv, callPackage, cmake, pkg-config, wrapGAppsHook3 +, python3Packages, libnotify, intltool, gnome, gdk-pixbuf, librsvg }: +stdenv.mkDerivation { + + inherit (callPackage ./common-drv-attrs.nix { + version = "3.2.6"; + pname = "gcdemu"; + hash = "sha256-w4vzKoSotL5Cjfr4Cu4YhNSWXJqS+n/vySrwvbhR1zA="; + }) pname version src meta; + + nativeBuildInputs = [ cmake pkg-config wrapGAppsHook3 intltool ]; + buildInputs = [ python3Packages.pygobject3 libnotify gnome.adwaita-icon-theme gdk-pixbuf librsvg ]; + + dontWrapGApps = true; postFixup = '' wrapProgram $out/bin/gcdemu \ + ''${gappsWrapperArgs[@]} \ --set PYTHONPATH "$PYTHONPATH" ''; + } diff --git a/pkgs/applications/emulators/cdemu/libmirage.nix b/pkgs/applications/emulators/cdemu/libmirage.nix index 379f1ea5031f5..0bbd9e1dfbf31 100644 --- a/pkgs/applications/emulators/cdemu/libmirage.nix +++ b/pkgs/applications/emulators/cdemu/libmirage.nix @@ -1,16 +1,18 @@ -{ callPackage, gobject-introspection, cmake, pkg-config +{ stdenv, callPackage, cmake, pkg-config , glib, libsndfile, zlib, bzip2, xz, libsamplerate, intltool , pcre, util-linux, libselinux, libsepol }: -callPackage ./base.nix { - version = "3.2.7"; - pname = "libmirage"; - hash = "sha256-+okkgNeVS8yoKSrQDy4It7PiPlTSiOsUoFxQ1FS9s9M="; +stdenv.mkDerivation { + + inherit (callPackage ./common-drv-attrs.nix { + version = "3.2.7"; + pname = "libmirage"; + hash = "sha256-+okkgNeVS8yoKSrQDy4It7PiPlTSiOsUoFxQ1FS9s9M="; + }) pname version src meta; + + PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_GIRDIR = "${placeholder "out"}/share/gir-1.0"; + PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_TYPELIBDIR = "${placeholder "out"}/lib/girepository-1.0"; buildInputs = [ glib libsndfile zlib bzip2 xz libsamplerate ]; - extraDrvParams = { - PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_GIRDIR = "${placeholder "out"}/share/gir-1.0"; - PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_TYPELIBDIR = "${placeholder "out"}/lib/girepository-1.0"; - nativeBuildInputs = [ cmake gobject-introspection pkg-config intltool ]; - propagatedBuildInputs = [ pcre util-linux libselinux libsepol ]; - }; + nativeBuildInputs = [ cmake pkg-config intltool ]; + propagatedBuildInputs = [ pcre util-linux libselinux libsepol ]; } -- cgit 1.4.1