commit 38534f14dbada22e01573780f9bfd94b62858d53
parent d258655c4bc056896ff61e0d04db03e49d325f86
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date:   Fri, 27 Dec 2019 17:07:18 +0300
Add cfiles
Diffstat:
3 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/default.nix b/default.nix
@@ -11,12 +11,16 @@
 with pkgs;
 
 let sources = import ./nix/sources.nix;
-in {
+in rec {
   # The `lib`, `modules`, and `overlay` names are special
   lib = import ./lib { inherit pkgs; }; # functions
   modules = import ./modules; # NixOS modules
   overlays = import ./overlays; # nixpkgs overlays
 
+  cfiles = callPackage ./pkgs/cfiles {
+    inherit ueberzug;
+    inherit (sources) cfiles;
+  };
   csvquote = callPackage ./pkgs/csvquote {
     inherit (sources) csvquote;
   };
diff --git a/nix/sources.json b/nix/sources.json
@@ -35,6 +35,18 @@
         "url": "https://github.com/tumic0/GPXSee-maps/archive/8d53800eb0ce4d9240a145959bccb94513128a17.tar.gz",
         "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
     },
+    "cfiles": {
+        "branch": "master",
+        "description": "A ncurses file manager written in C with vim like keybindings",
+        "homepage": "",
+        "owner": "mananapr",
+        "repo": "cfiles",
+        "rev": "ee3f001225764cf38161bafd463c30cf64249de4",
+        "sha256": "07skhabq6ddvm3gwxw8fzb4z7m2zghv3dd96z2ygxpfx8w6h7rpn",
+        "type": "tarball",
+        "url": "https://github.com/mananapr/cfiles/archive/ee3f001225764cf38161bafd463c30cf64249de4.tar.gz",
+        "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
+    },
     "csvquote": {
         "branch": "master",
         "description": "Enables common unix utlities like cut, awk, wc, head to work correctly with csv data containing delimiters and newlines",
diff --git a/pkgs/cfiles/default.nix b/pkgs/cfiles/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, pkg-config, ncurses, w3m, ueberzug, cfiles }:
+
+stdenv.mkDerivation rec {
+  pname = "cfiles";
+  version = stdenv.lib.substring 0 7 src.rev;
+  src = cfiles;
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ ncurses w3m ueberzug ];
+
+  prePatch = ''
+    substituteInPlace Makefile \
+      --replace "prefix = usr" "prefix=$out"
+    substituteInPlace scripts/clearimg \
+      --replace "/usr/lib/w3m/w3mimgdisplay" "${w3m}/bin/w3mimgdisplay"
+    substituteInPlace scripts/displayimg \
+      --replace "/usr/lib/w3m/w3mimgdisplay" "${w3m}/bin/w3mimgdisplay"
+    substituteInPlace scripts/displayimg_uberzug \
+      --replace "ueberzug" "${ueberzug}/bin/ueberzug"
+  '';
+
+  meta = with stdenv.lib; {
+    description = cfiles.description;
+    homepage = "https://github.com/mananapr/cfiles";
+    license = licenses.mit;
+    #maintainers = with maintainers; [ sikmir ];
+    platforms = platforms.unix;
+  };
+}