From b3218a102fbfce135e780bb273998b97ebbaaf19 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 12 Aug 2023 09:59:44 +0100 Subject: [PATCH] duperemove: encode absolute path to `lscpu` Without the change `duperemove` fails to run in parallel if `PATH` is missing `lscpu` as: $ PATH= ./result/bin/duperemove /tmp sh: line 1: lscpu: No such file or directory Gathering file list... No dedupe candidates found. Noticed when wrote a minimal systemd timer for `duperemove`. --- pkgs/tools/filesystems/duperemove/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/filesystems/duperemove/default.nix b/pkgs/tools/filesystems/duperemove/default.nix index 98e652a05f9d..2bdcc811db0f 100644 --- a/pkgs/tools/filesystems/duperemove/default.nix +++ b/pkgs/tools/filesystems/duperemove/default.nix @@ -1,5 +1,6 @@ { lib, stdenv, fetchFromGitHub, libgcrypt -, pkg-config, glib, linuxHeaders ? stdenv.cc.libc.linuxHeaders, sqlite }: +, pkg-config, glib, linuxHeaders ? stdenv.cc.libc.linuxHeaders, sqlite +, util-linux }: stdenv.mkDerivation rec { pname = "duperemove"; @@ -12,6 +13,11 @@ stdenv.mkDerivation rec { sha256 = "sha256-WjUM52IqMDvBzeGHo7p4JcvMO5iPWPVOr8GJ3RSsnUs="; }; + postPatch = '' + substituteInPlace util.c --replace \ + "lscpu" "${lib.getBin util-linux}/bin/lscpu" + ''; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ libgcrypt glib linuxHeaders sqlite ];