nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 83 lines 2.4 kB view raw
1{ 2 lib, 3 fetchFromGitHub, 4 python3Packages, 5 file, 6 less, 7 highlight, 8 w3m, 9 imagemagick, 10 imagePreviewSupport ? true, 11 sixelPreviewSupport ? true, 12 neoVimSupport ? true, 13 improvedEncodingDetection ? true, 14 rightToLeftTextSupport ? false, 15 unstableGitUpdater, 16}: 17 18python3Packages.buildPythonApplication { 19 pname = "ranger"; 20 version = "1.9.3-unstable-2025-06-04"; 21 format = "setuptools"; 22 23 src = fetchFromGitHub { 24 owner = "ranger"; 25 repo = "ranger"; 26 rev = "7e38143eaa91c82bed8f309aa167b1e6f2607576"; 27 hash = "sha256-O0DjecncpN+Bv8Ng+keuvU9iVtWAV4a50p959pMvkww="; 28 }; 29 30 LC_ALL = "en_US.UTF-8"; 31 32 nativeCheckInputs = with python3Packages; [ 33 pytestCheckHook 34 astroid 35 pylint 36 ]; 37 propagatedBuildInputs = [ 38 less 39 file 40 ] 41 ++ lib.optionals imagePreviewSupport [ python3Packages.pillow ] 42 ++ lib.optionals sixelPreviewSupport [ imagemagick ] 43 ++ lib.optionals neoVimSupport [ python3Packages.pynvim ] 44 ++ lib.optionals improvedEncodingDetection [ python3Packages.chardet ] 45 ++ lib.optionals rightToLeftTextSupport [ python3Packages.python-bidi ]; 46 47 preConfigure = '' 48 ${lib.optionalString (highlight != null) '' 49 sed -i -e 's|^\s*highlight\b|${highlight}/bin/highlight|' \ 50 ranger/data/scope.sh 51 ''} 52 53 substituteInPlace ranger/__init__.py \ 54 --replace "DEFAULT_PAGER = 'less'" "DEFAULT_PAGER = '${lib.getBin less}/bin/less'" 55 56 # give file previews out of the box 57 substituteInPlace ranger/config/rc.conf \ 58 --replace /usr/share $out/share \ 59 --replace "#set preview_script ~/.config/ranger/scope.sh" "set preview_script $out/share/doc/ranger/config/scope.sh" 60 '' 61 + lib.optionalString imagePreviewSupport '' 62 substituteInPlace ranger/ext/img_display.py \ 63 --replace /usr/lib/w3m ${w3m}/libexec/w3m 64 65 # give image previews out of the box when building with w3m 66 substituteInPlace ranger/config/rc.conf \ 67 --replace "set preview_images false" "set preview_images true" 68 ''; 69 70 passthru.updateScript = unstableGitUpdater { tagPrefix = "v"; }; 71 72 meta = { 73 description = "File manager with minimalistic curses interface"; 74 homepage = "https://ranger.github.io/"; 75 license = lib.licenses.gpl3Only; 76 platforms = lib.platforms.unix; 77 maintainers = with lib.maintainers; [ 78 toonn 79 lucasew 80 ]; 81 mainProgram = "ranger"; 82 }; 83}