summary refs log tree commit diff
path: root/pkgs/applications/file-managers/nnn
diff options
context:
space:
mode:
authorJK Cueaz <vcs@cueaz.com>2023-07-15 01:40:32 +0900
committercueaz <vcs@cueaz.com>2023-07-30 02:10:55 +0900
commit70680e8dc7369e643a482d11d01613d27f61a3cd (patch)
tree77984f6a6f5ce6997f63af42d4b1106e20a14d18 /pkgs/applications/file-managers/nnn
parent01f286cb66e14c416f742f9a59739678743661bb (diff)
nnn: fix file mime opts on darwin
Resolves: #243503
Signed-off-by: cueaz <vcs@cueaz.com>
Diffstat (limited to 'pkgs/applications/file-managers/nnn')
-rw-r--r--pkgs/applications/file-managers/nnn/darwin-fix-file-mime-opts.patch15
-rw-r--r--pkgs/applications/file-managers/nnn/default.nix4
2 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/applications/file-managers/nnn/darwin-fix-file-mime-opts.patch b/pkgs/applications/file-managers/nnn/darwin-fix-file-mime-opts.patch
new file mode 100644
index 0000000000000..f1bf71e6b9125
--- /dev/null
+++ b/pkgs/applications/file-managers/nnn/darwin-fix-file-mime-opts.patch
@@ -0,0 +1,15 @@
+diff --git a/src/nnn.c b/src/nnn.c
+index b3c0f986..c74e1ec9 100644
+--- a/src/nnn.c
++++ b/src/nnn.c
+@@ -508,9 +508,7 @@ alignas(max_align_t) static char g_pipepath[TMP_LEN_MAX];
+ static runstate g_state;
+ 
+ /* Options to identify file MIME */
+-#if defined(__APPLE__)
+-#define FILE_MIME_OPTS "-bIL"
+-#elif !defined(__sun) /* no MIME option for 'file' */
++#if !defined(__sun) /* no MIME option for 'file' */
+ #define FILE_MIME_OPTS "-biL"
+ #endif
+ 
diff --git a/pkgs/applications/file-managers/nnn/default.nix b/pkgs/applications/file-managers/nnn/default.nix
index 4c3fab6484c94..6386018348a04 100644
--- a/pkgs/applications/file-managers/nnn/default.nix
+++ b/pkgs/applications/file-managers/nnn/default.nix
@@ -34,6 +34,10 @@ stdenv.mkDerivation (finalAttrs: {
   };
 
   patches = [
+    # Nix-specific: ensure nnn passes correct arguments to the Nix file command on Darwin.
+    # By default, nnn expects the macOS default file command, not the one provided by Nix.
+    # However, both commands use different arguments to obtain the MIME type.
+    ./darwin-fix-file-mime-opts.patch
     # FIXME: remove for next release
     (fetchpatch {
       url = "https://github.com/jarun/nnn/commit/20e944f5e597239ed491c213a634eef3d5be735e.patch";