about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Schütz <dev@schuetz-co.de>2021-03-20 12:35:55 +0100
committerRobert Schütz <dev@schuetz-co.de>2021-03-22 09:53:39 +0100
commit49f8234fb4c055bf32aeca7481a2e225647c6a52 (patch)
tree2f67a0a5adde68fe56ada9a97dfb7529db5a8fe8
parent08a7427ee1637ace1811f7303ffb81549b79bc9b (diff)
sc-im: modernize expression and support gnuplot
-rw-r--r--pkgs/applications/misc/sc-im/default.nix53
1 files changed, 33 insertions, 20 deletions
diff --git a/pkgs/applications/misc/sc-im/default.nix b/pkgs/applications/misc/sc-im/default.nix
index 833d1403d247a..ad25e4f8b1ccc 100644
--- a/pkgs/applications/misc/sc-im/default.nix
+++ b/pkgs/applications/misc/sc-im/default.nix
@@ -1,8 +1,20 @@
-{ lib, stdenv, fetchFromGitHub, yacc, ncurses, libxml2, libzip, libxls, pkg-config }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, makeWrapper
+, pkg-config
+, which
+, yacc
+, gnuplot
+, libxls
+, libxml2
+, libzip
+, ncurses
+}:
 
 stdenv.mkDerivation rec {
-  version = "0.8.0";
   pname = "sc-im";
+  version = "0.8.0";
 
   src = fetchFromGitHub {
     owner = "andmarti1424";
@@ -11,33 +23,34 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-/eG2BdkyfEGoSzPu6jT+Bn1RZTGT1D3etGj1tYchm1M=";
   };
 
-  nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ yacc ncurses libxml2 libzip libxls ];
+  sourceRoot = "${src.name}/src";
 
-  buildPhase = ''
-    cd src
+  nativeBuildInputs = [
+    makeWrapper
+    pkg-config
+    which
+    yacc
+  ];
 
-    sed 's/LDLIBS += -lm/& -lncurses/' -i Makefile
+  buildInputs = [
+    gnuplot
+    libxls
+    libxml2
+    libzip
+    ncurses
+  ];
 
-    sed -e "\|^prefix  = /usr/local|   s|/usr/local|$out|" \
-        -e "\|^#LDLIBS += -lxlsreader| s|^#||            " \
-        -e "\|^#CFLAGS += -DXLS|       s|^#||            " \
-        -i Makefile
+  makeFlags = [ "prefix=${placeholder "out"}" ];
 
-    make
-    export DESTDIR=$out
-  '';
-
-  installPhase = ''
-    make install prefix=
+  postInstall = ''
+    wrapProgram "$out/bin/sc-im" --prefix PATH : "${lib.makeBinPath [ gnuplot ]}"
   '';
 
   meta = with lib; {
     homepage = "https://github.com/andmarti1424/sc-im";
-    description = "SC-IM - Spreadsheet Calculator Improvised - SC fork";
+    description = "An ncurses spreadsheet program for terminal";
     license = licenses.bsdOriginal;
-    maintainers = [ ];
+    maintainers = with maintainers; [ dotlambda ];
     platforms = platforms.unix;
   };
-
 }