ncdu.scm 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
  3. ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  4. ;;; Copyright © 2022, 2023 Efraim Flashner <efraim@flashner.co.il>
  5. ;;;
  6. ;;; This file is part of GNU Guix.
  7. ;;;
  8. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  9. ;;; under the terms of the GNU General Public License as published by
  10. ;;; the Free Software Foundation; either version 3 of the License, or (at
  11. ;;; your option) any later version.
  12. ;;;
  13. ;;; GNU Guix is distributed in the hope that it will be useful, but
  14. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;;; GNU General Public License for more details.
  17. ;;;
  18. ;;; You should have received a copy of the GNU General Public License
  19. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  20. (define-module (gnu packages ncdu)
  21. #:use-module (gnu packages)
  22. #:use-module (gnu packages ncurses)
  23. #:use-module (guix licenses)
  24. #:use-module (guix packages)
  25. #:use-module (guix download)
  26. #:use-module (guix utils)
  27. #:use-module (guix gexp)
  28. #:use-module (guix build-system gnu)
  29. #:use-module (gnu packages perl)
  30. #:use-module (gnu packages zig))
  31. (define-public ncdu-1
  32. ;; This old version is ‘LTS’. Version 2 works fine and has more features,
  33. ;; but Zig is still a fast-moving target and doesn't support cross-compilation
  34. ;; yet, so we'll keep both for just a little longer.
  35. (package
  36. (name "ncdu")
  37. (version "1.18.1")
  38. (source (origin
  39. (method url-fetch)
  40. (uri (string-append "https://dev.yorhel.nl/download/ncdu-"
  41. version ".tar.gz"))
  42. (sha256
  43. (base32
  44. "01946cqp5z38srbpq08d75f1n0cgpfyn8h8ppbaawnnq57ms23vw"))))
  45. (build-system gnu-build-system)
  46. (inputs (list ncurses))
  47. (synopsis "Ncurses-based disk usage analyzer")
  48. (description
  49. "Ncdu is a disk usage analyzer with an ncurses interface, aimed to be
  50. run on a remote server where you don't have an entire graphical setup, but have
  51. to do with a simple SSH connection. ncdu aims to be fast, simple and easy to
  52. use, and should be able to run in any minimal POSIX-like environment with
  53. ncurses installed.")
  54. (license (x11-style
  55. (string-append "https://g.blicky.net/ncdu.git/plain/COPYING?id=v"
  56. version)))
  57. (home-page "https://dev.yorhel.nl/ncdu")))
  58. (define-public ncdu
  59. (package
  60. (inherit ncdu-1)
  61. (name "ncdu")
  62. (version "2.2.2")
  63. (source (origin
  64. (method url-fetch)
  65. (uri (string-append "https://dev.yorhel.nl/download/ncdu-"
  66. version ".tar.gz"))
  67. (sha256
  68. (base32
  69. "14zrmcxnrczamqjrib99jga05ixk0dzfav3pd6s1h8vm9q121nch"))
  70. (modules '((guix build utils)))
  71. (snippet
  72. #~(begin
  73. ;; Delete a pregenerated man page. We'll build it ourselves.
  74. (delete-file "ncdu.1")))))
  75. (arguments
  76. (list
  77. #:make-flags
  78. #~(list (string-append "PREFIX=" #$output)
  79. (string-append "CC=" #$(cc-for-target))
  80. ;; XXX By default, zig builds with -march=native!
  81. (string-append "ZIG_FLAGS=-Drelease-fast -Dcpu=baseline"))
  82. #:phases
  83. #~(modify-phases %standard-phases
  84. (delete 'configure) ; No configure script.
  85. (add-before 'build 'pre-build
  86. (lambda _
  87. (setenv "ZIG_GLOBAL_CACHE_DIR"
  88. (mkdtemp "/tmp/zig-cache-XXXXXX"))))
  89. (add-after 'build 'build-manpage
  90. (lambda _
  91. (invoke "make" "doc")))
  92. (replace 'check
  93. (lambda* (#:key tests? #:allow-other-keys)
  94. (when tests?
  95. (invoke "zig" "test" "build.zig")))))))
  96. (native-inputs
  97. (list perl zig-0.10))))
  98. (define-public ncdu-2
  99. (deprecated-package "ncdu2" ncdu))