summaryrefslogtreecommitdiff
path: root/pkgs/trash
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2023-09-29 16:13:12 +0200
committerLinnnus <[email protected]>2023-09-29 16:13:12 +0200
commit98d5c9cd995de153feb5de60859cdadcc25cbcca (patch)
tree1e11506ce9e33ffb50958414edeaba5a25719e8c /pkgs/trash
parent64899240dcba0063ebb0563c35ed3be5c66a990f (diff)
Add trash on osx
Diffstat (limited to 'pkgs/trash')
-rw-r--r--pkgs/trash/default.nix38
-rw-r--r--pkgs/trash/trash-dont-hardcode-arch.patch13
2 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/trash/default.nix b/pkgs/trash/default.nix
new file mode 100644
index 0000000..e9e84c9
--- /dev/null
+++ b/pkgs/trash/default.nix
@@ -0,0 +1,38 @@
+{ stdenv
+, fetchFromGitHub
+, perl534Packages
+, darwin
+}:
+
+stdenv.mkDerivation rec {
+ name = "trash";
+ version = "0.9.2";
+
+ src = fetchFromGitHub {
+ owner = "ali-rantakari";
+ repo = "trash";
+ rev = "v${version}";
+ sha256 = "sha256-vibUimY15KTulGVqmmTGtO/+XowoRHykcmL8twdgebQ=";
+ };
+ patches = [ ./trash-dont-hardcode-arch.patch ];
+ buildInputs = [
+ darwin.apple_sdk.frameworks.Cocoa
+ darwin.apple_sdk.frameworks.AppKit
+ darwin.apple_sdk.frameworks.ScriptingBridge
+ perl534Packages.podlators
+ ];
+
+ outputs = [ "out" "man" ];
+
+ buildPhase = ''
+ make trash trash.1
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin $man/share/man/man1
+ mv trash $out/bin
+ mv trash.1 $man/share/man/man1/trash.1
+ # I like to alias as del because trash is so hard spell
+ ln -s $out/bin/trash $out/bin/del
+ '';
+}
diff --git a/pkgs/trash/trash-dont-hardcode-arch.patch b/pkgs/trash/trash-dont-hardcode-arch.patch
new file mode 100644
index 0000000..3c581c1
--- /dev/null
+++ b/pkgs/trash/trash-dont-hardcode-arch.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index e867e91..40b7ecd 100644
+--- a/Makefile
++++ b/Makefile
+@@ -10,7 +10,7 @@ trash: $(SOURCE_FILES)
+ @echo
+ @echo ---- Compiling:
+ @echo ======================================
+- $(CC) -O2 -Wall -Wextra -Wpartial-availability -Wno-unguarded-availability -force_cpusubtype_ALL -mmacosx-version-min=10.7 -arch i386 -arch x86_64 -framework AppKit -framework ScriptingBridge -o $@ $(SOURCE_FILES)
++ $(CC) -O2 -Wall -Wextra -Wpartial-availability -Wno-unguarded-availability -mmacosx-version-min=10.7 -framework AppKit -framework ScriptingBridge -o $@ $(SOURCE_FILES)
+
+ analyze:
+ @echo