about summary refs log tree commit diff
path: root/pkgs/tools/misc/ncdu_2
diff options
context:
space:
mode:
authorAtemu <atemu.main@gmail.com>2021-12-26 01:38:11 +0100
committerAtemu <atemu.main@gmail.com>2022-03-31 11:50:03 +0200
commitb153524b48e737fcb11795656c06064206019000 (patch)
tree60e8f51cfcfbee1d8c2f385592fd2ab0247b1338 /pkgs/tools/misc/ncdu_2
parentce8cbe3c01fd8ee2de526ccd84bbf9b82397a510 (diff)
ncdu2: init at 2.0
Diffstat (limited to 'pkgs/tools/misc/ncdu_2')
-rw-r--r--pkgs/tools/misc/ncdu_2/c-import-order.patch17
-rw-r--r--pkgs/tools/misc/ncdu_2/default.nix33
2 files changed, 50 insertions, 0 deletions
diff --git a/pkgs/tools/misc/ncdu_2/c-import-order.patch b/pkgs/tools/misc/ncdu_2/c-import-order.patch
new file mode 100644
index 0000000000000..a094f3237ad6b
--- /dev/null
+++ b/pkgs/tools/misc/ncdu_2/c-import-order.patch
@@ -0,0 +1,17 @@
+diff --git a/src/ui.zig b/src/ui.zig
+index 8401910..50171a7 100644
+--- a/src/ui.zig
++++ b/src/ui.zig
+@@ -8,11 +8,11 @@ const main = @import("main.zig");
+ const util = @import("util.zig");
+
+ pub const c = @cImport({
++    @cDefine("_XOPEN_SOURCE", "1");
+     @cInclude("stdio.h");
+     @cInclude("string.h");
+     @cInclude("curses.h");
+     @cInclude("time.h");
+-    @cDefine("_X_OPEN_SOURCE", "1");
+     @cInclude("wchar.h");
+     @cInclude("locale.h");
+ });
diff --git a/pkgs/tools/misc/ncdu_2/default.nix b/pkgs/tools/misc/ncdu_2/default.nix
new file mode 100644
index 0000000000000..a703cf3eca6c2
--- /dev/null
+++ b/pkgs/tools/misc/ncdu_2/default.nix
@@ -0,0 +1,33 @@
+{ lib, stdenv, fetchurl, fetchpatch, zig, ncurses }:
+
+stdenv.mkDerivation rec {
+  pname = "ncdu";
+  version = "2.0";
+
+  src = fetchurl {
+    url = "https://dev.yorhel.nl/download/${pname}-${version}.tar.gz";
+    sha256 = "sha256-Zs2mgEdnsukbeM/cqCX5/a9qCkxuQAYloBrVWVQYR8w=";
+  };
+
+  patches = [
+    ./c-import-order.patch # https://code.blicky.net/yorhel/ncdu/issues/183
+  ];
+
+  XDG_CACHE_HOME="Cache"; # FIXME This should be set in stdenv
+
+  nativeBuildInputs = [
+    zig
+  ];
+
+  buildInputs = [ ncurses ];
+
+  PREFIX = placeholder "out";
+
+  meta = with lib; {
+    description = "Disk usage analyzer with an ncurses interface";
+    homepage = "https://dev.yorhel.nl/ncdu";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ pSub SuperSandro2000 ];
+  };
+}