@@ -1,7 +1,5 @@
1−{ stdenv, fetchFromGitHub, fetchpatch, coreutils
2−, python3, python3Packages, substituteAll }:
3−
4−assert stdenv.isLinux;
1+{ stdenv, fetchFromGitHub, fetchpatch, python3, python3Packages
2+, lib, makeWrapper, coreutils }:
53
64python3Packages.buildPythonApplication rec {
75 name = "trash-cli-${version}";
@@ -16,12 +14,6 @@ python3Packages.buildPythonApplication rec {
1614 };
1715
1816 patches = [
19− (substituteAll {
20− src = ./nix-paths.patch;
21− df = "${coreutils}/bin/df";
22− libc = "${stdenv.cc.libc.out}/lib/libc.so.6";
23− })
24−
2517 # Fix build on Python 3.6.
2618 (fetchpatch {
2719 url = "https://github.com/andreafrancia/trash-cli/commit/a21b80d1e69783bb09376c3f60dd2f2a10578805.patch";
@@ -30,10 +22,19 @@ python3Packages.buildPythonApplication rec {
3022 ];
3123
3224 buildInputs = with python3Packages; [ nose mock ];
25+ nativeBuildInputs = [ makeWrapper ];
26+
27+ preFixup = ''
28+ for bin in $out/bin/*; do
29+ wrapProgram $bin \
30+ --prefix PATH : ${lib.makeBinPath [ coreutils ]} \
31+ --prefix DYLD_LIBRARY_PATH : ${lib.makeSearchPath "lib" (lib.optional (stdenv.hostPlatform.libc == "glibc") (lib.getDev stdenv.cc.libc))}
32+ done
33+ '';
3334
3435 checkPhase = "nosetests";
3536
36− meta = with stdenv.lib; {
37+ meta = with lib; {
3738 homepage = https://github.com/andreafrancia/trash-cli;
3839 description = "Command line tool for the desktop trash can";
3940 maintainers = [ maintainers.rycee ];