diff --git a/pkgs/by-name/gs/gsmartcontrol/fix-paths.patch b/pkgs/by-name/gs/gsmartcontrol/fix-paths.patch deleted file mode 100644 index b8ec19eb2563..000000000000 --- a/pkgs/by-name/gs/gsmartcontrol/fix-paths.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/data/gsmartcontrol-root.in b/data/gsmartcontrol-root.in ---- a/data/gsmartcontrol-root.in -+++ b/data/gsmartcontrol-root.in -@@ -8,7 +8,7 @@ - # Run gsmartcontrol with root, asking for root password first. - # export GSMARTCONTROL_SU to override a su command (e.g. "kdesu -c"). - --EXEC_BIN="@prefix@/sbin/gsmartcontrol"; -+EXEC_BIN="@prefix@/bin/gsmartcontrol"; - prog_name="gsmartcontrol" - - -@@ -118,7 +118,7 @@ - # Add @prefix@/sbin as well (freebsd seems to require it). - # Note that beesu won't show a GUI login box if /usr/sbin is before /usr/bin, - # so add it first as well. --EXTRA_PATHS="/usr/bin:/usr/sbin:/usr/local/sbin:@prefix@/sbin"; -+EXTRA_PATHS="/usr/bin:/usr/sbin:/usr/local/sbin:@prefix@/bin"; - export PATH="$EXTRA_PATHS:$PATH" - - -diff --git a/src/Makefile.am b/src/Makefile.am ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -24,7 +24,7 @@ - # endif - - --sbin_PROGRAMS = gsmartcontrol -+bin_PROGRAMS = gsmartcontrol - - gsmartcontrol_LDADD = $(top_builddir)/src/applib/libapplib.a \ - $(top_builddir)/src/libdebug/libdebug.a \ diff --git a/pkgs/by-name/gs/gsmartcontrol/nixos-update-drivedb-message.patch b/pkgs/by-name/gs/gsmartcontrol/nixos-update-drivedb-message.patch new file mode 100644 index 000000000000..5163bcc56aae --- /dev/null +++ b/pkgs/by-name/gs/gsmartcontrol/nixos-update-drivedb-message.patch @@ -0,0 +1,18 @@ +diff --git a/src/gui/gsc_main_window.cpp b/src/gui/gsc_main_window.cpp +index a5a6ac9..2d7a1f7 100644 +--- a/src/gui/gsc_main_window.cpp ++++ b/src/gui/gsc_main_window.cpp +@@ -955,8 +955,13 @@ void GscMainWindow::run_update_drivedb() + if (smartctl_binary.is_absolute()) { + update_binary_path = smartctl_binary.parent_path() / update_binary_path; + } +- argv = {"xterm", "-hold", "-e", hz::fs_path_to_string(update_binary_path)}; ++ ++ gui_show_error_dialog( ++ _("Error Updating Drive Database"), ++ _("Updating drivedb from GSmartControl is unavailable in nixpkgs because smartmontools in the Nix store is immutable. Please update your NixOS or nixpkgs channel/flake inputs to get a newer drive database."), ++ this); ++ return; + } + + try { diff --git a/pkgs/by-name/gs/gsmartcontrol/package.nix b/pkgs/by-name/gs/gsmartcontrol/package.nix index 27bff9bb23b3..cbb3dde6c8a6 100644 --- a/pkgs/by-name/gs/gsmartcontrol/package.nix +++ b/pkgs/by-name/gs/gsmartcontrol/package.nix @@ -3,12 +3,12 @@ stdenv, fetchFromGitHub, smartmontools, + adwaita-icon-theme, cmake, gtkmm3, + makeWrapper, pkg-config, - wrapGAppsHook3, - pcre-cpp, - adwaita-icon-theme, + # xterm, }: stdenv.mkDerivation (finalAttrs: { @@ -22,6 +22,10 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-eLzwFZ1PYqijFTxos9Osf7A2v4C8toM+TGV4/bU82NE="; }; + patches = [ + ./nixos-update-drivedb-message.patch + ]; + postPatch = '' substituteInPlace data/gsmartcontrol.in.desktop \ --replace-fail "@CMAKE_INSTALL_FULL_BINDIR@/" "" @@ -30,21 +34,24 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake pkg-config - wrapGAppsHook3 + makeWrapper ]; buildInputs = [ gtkmm3 - pcre-cpp adwaita-icon-theme ]; enableParallelBuilding = true; - preFixup = '' - gappsWrapperArgs+=( - --prefix PATH : "${lib.makeBinPath [ smartmontools ]}" - ) + postFixup = '' + wrapProgram $out/bin/gsmartcontrol \ + --prefix PATH : ${ + lib.makeBinPath [ + smartmontools + # xterm # For `update-smart-drivedb`, which does not make sense in NixOS as it tries to overwrite /usr/share/smartmontools/drivedb.h + ] + } ''; meta = {