From 70680e8dc7369e643a482d11d01613d27f61a3cd Mon Sep 17 00:00:00 2001 From: JK Cueaz Date: Sat, 15 Jul 2023 01:40:32 +0900 Subject: [PATCH] nnn: fix file mime opts on darwin Resolves: #243503 Signed-off-by: cueaz --- .../nnn/darwin-fix-file-mime-opts.patch | 15 +++++++++++++++ pkgs/applications/file-managers/nnn/default.nix | 4 ++++ 2 files changed, 19 insertions(+) create mode 100644 pkgs/applications/file-managers/nnn/darwin-fix-file-mime-opts.patch 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 000000000000..f1bf71e6b912 --- /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 4c3fab6484c9..6386018348a0 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";