summary refs log tree commit diff
path: root/pkgs/tools/system/fakeroot/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/system/fakeroot/default.nix')
-rw-r--r--pkgs/tools/system/fakeroot/default.nix23
1 files changed, 16 insertions, 7 deletions
diff --git a/pkgs/tools/system/fakeroot/default.nix b/pkgs/tools/system/fakeroot/default.nix
index 4ca22cb2385..dd6ab9868aa 100644
--- a/pkgs/tools/system/fakeroot/default.nix
+++ b/pkgs/tools/system/fakeroot/default.nix
@@ -1,4 +1,5 @@
 { lib
+, coreutils
 , stdenv
 , fetchurl
 , fetchpatch
@@ -6,14 +7,15 @@
 , libcap
 , gnused
 , nixosTests
+, testers
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   version = "1.29";
   pname = "fakeroot";
 
   src = fetchurl {
-    url = "http://http.debian.net/debian/pool/main/f/fakeroot/fakeroot_${version}.orig.tar.gz";
+    url = "http://http.debian.net/debian/pool/main/f/fakeroot/fakeroot_${finalAttrs.version}.orig.tar.gz";
     sha256 = "sha256-j7uvt4DJFz46zkoEr7wdkA8zfzIWiDk59cfbNDG+fCA=";
   };
 
@@ -39,16 +41,23 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  buildInputs = [ getopt gnused ]
-    ++ lib.optional (!stdenv.isDarwin) libcap
-    ;
+  buildInputs = lib.optional (!stdenv.isDarwin) libcap;
 
   postUnpack = ''
-    sed -i -e "s@getopt@$(type -p getopt)@g" -e "s@sed@$(type -p sed)@g" ${pname}-${version}/scripts/fakeroot.in
+    sed -i \
+      -e 's@getopt@${getopt}/bin/getopt@g' \
+      -e 's@sed@${gnused}/bin/sed@g' \
+      -e 's@kill@${coreutils}/bin/kill@g' \
+      -e 's@/bin/ls@${coreutils}/bin/ls@g' \
+      -e 's@cut@${coreutils}/bin/cut@g' \
+      fakeroot-${finalAttrs.version}/scripts/fakeroot.in
   '';
 
   passthru = {
     tests = {
+      version = testers.testVersion {
+        package = finalAttrs;
+      };
       # A lightweight *unit* test that exercises fakeroot and fakechroot together:
       nixos-etc = nixosTests.etc.test-etc-fakeroot;
     };
@@ -61,4 +70,4 @@ stdenv.mkDerivation rec {
     maintainers = with lib.maintainers; [viric];
     platforms = lib.platforms.unix;
   };
-}
+})