summary refs log tree commit diff
path: root/pkgs/applications/misc/vifm
diff options
context:
space:
mode:
authorEmmanuel Rosa <emmanuelrosa@protonmail.com>2019-12-02 17:45:04 +0700
committerEmmanuel Rosa <emmanuelrosa@protonmail.com>2019-12-05 05:45:40 +0700
commitc6588dd34103bcef573c2afaba40748076296d6f (patch)
treedf63b1e4d299e37005fa22e849e75281b9b6b42d /pkgs/applications/misc/vifm
parenta2f9bcd1328de9c043d7425e45d06fc05e0b7929 (diff)
downloadnixpkgs-c6588dd34103bcef573c2afaba40748076296d6f.tar
nixpkgs-c6588dd34103bcef573c2afaba40748076296d6f.tar.gz
nixpkgs-c6588dd34103bcef573c2afaba40748076296d6f.tar.bz2
nixpkgs-c6588dd34103bcef573c2afaba40748076296d6f.tar.lz
nixpkgs-c6588dd34103bcef573c2afaba40748076296d6f.tar.xz
nixpkgs-c6588dd34103bcef573c2afaba40748076296d6f.tar.zst
nixpkgs-c6588dd34103bcef573c2afaba40748076296d6f.zip
vifm: add vifm-full package
vifm includes some optional features what are currently no-op due
to missing dependencies. Once such example is `vifm-media`.

vimfm-media is a Linux script included with vifm which can be used to
mount/umount removable media from within vifm. However, vifm-media
has additional dependencies, namely Python, dbus, and a supported
back-end such as udisks2. While vimfm-media is currently installed,
it fails with the error "No supported backend found."

This change adds optional support for vifm-media via the new package
vifm-full; Opening for the opportunity to add whatever optional
dependencies I have not considered in this change in the future,
while not generously increasing the closure size of the original
vifm package.

For reference, vifm has a closure size of 41,164,432 while the new
vifm-full increases this to 382,642,536. Calculated with
`nix path-info -S`

Note: While vifm-media supports numerous back-ends, this change only
adds support for udisks2. In addition, vifm-media is not supported on
MacOS/OSX, for which upstream provides an alternative script.
Diffstat (limited to 'pkgs/applications/misc/vifm')
-rw-r--r--pkgs/applications/misc/vifm/default.nix27
1 files changed, 21 insertions, 6 deletions
diff --git a/pkgs/applications/misc/vifm/default.nix b/pkgs/applications/misc/vifm/default.nix
index 81563254abd..f71e7a7a960 100644
--- a/pkgs/applications/misc/vifm/default.nix
+++ b/pkgs/applications/misc/vifm/default.nix
@@ -1,11 +1,15 @@
-{ stdenv, fetchurl
+{ stdenv, fetchurl, makeWrapper
 , pkgconfig
 , ncurses, libX11
 , utillinux, file, which, groff
+
+  # adds support for handling removable media (vifm-media). Linux only!
+, mediaSupport ? false, python3 ? null, udisks2 ? null, lib ? null 
 }:
 
-stdenv.mkDerivation rec {
-  pname = "vifm";
+let isFullPackage = mediaSupport;
+in stdenv.mkDerivation rec {
+  pname = if isFullPackage then "vifm-full" else "vifm";
   version = "0.10.1";
 
   src = fetchurl {
@@ -13,13 +17,24 @@ stdenv.mkDerivation rec {
     sha256 = "0fyhxh7ndjn8fyjhj14ymkr3pjcs3k1xbs43g7xvvq85vdb6y04r";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig makeWrapper ];
   buildInputs = [ ncurses libX11 utillinux file which groff ];
 
+  postFixup = let
+    path = lib.makeBinPath 
+      [ udisks2 
+        (python3.withPackages (p: [p.dbus-python]))
+      ];
+
+    wrapVifmMedia = "wrapProgram $out/share/vifm/vifm-media --prefix PATH : ${path}";
+  in ''
+    ${if mediaSupport then wrapVifmMedia else ""}
+  '';
+
   meta = with stdenv.lib; {
-    description = "A vi-like file manager";
+    description = ''A vi-like file manager${if isFullPackage then "; Includes support for optional features" else ""}'';
     maintainers = with maintainers; [ raskin ];
-    platforms = platforms.unix;
+    platforms = if mediaSupport then platforms.linux else platforms.unix;
     license = licenses.gpl2;
     downloadPage = "https://vifm.info/downloads.shtml";
     homepage = https://vifm.info/;