about summary refs log tree commit diff
path: root/pkgs/tools/text
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2023-03-12 09:06:28 +0100
committerVladimír Čunát <v@cunat.cz>2023-03-12 09:06:28 +0100
commit1dd94ad62fddb72cd29636a9f0a0457a2bd60c02 (patch)
treeb80bc5e525784be865b3d5f19b1c97d47a05e64d /pkgs/tools/text
parente3b4b428606521b91c0149ef128f04c7d1be3f6b (diff)
parent32956b5f2a9f1a605bd865be9e3216dc7848d6fd (diff)
Merge branch 'master' into staging-next
Diffstat (limited to 'pkgs/tools/text')
-rw-r--r--pkgs/tools/text/csvquote/csvquote-path.patch14
-rw-r--r--pkgs/tools/text/csvquote/default.nix47
-rw-r--r--pkgs/tools/text/mdbook-katex/default.nix6
3 files changed, 64 insertions, 3 deletions
diff --git a/pkgs/tools/text/csvquote/csvquote-path.patch b/pkgs/tools/text/csvquote/csvquote-path.patch
new file mode 100644
index 0000000000000..a3f87055f2380
--- /dev/null
+++ b/pkgs/tools/text/csvquote/csvquote-path.patch
@@ -0,0 +1,14 @@
+--- a/csvheader
++++ b/csvheader
+@@ -29,10 +29,6 @@ while getopts "d:tq:r:" arg; do
+     esac
+ done
+ 
+-CSVQUOTE=`which csvquote` || CSVQUOTE="./csvquote"
+-if [ ! -f $CSVQUOTE ]; then
+-    echo "csvquote program not found. exiting"
+-    exit 1
+-fi
++CSVQUOTE=@out@/bin/csvquote
+ 
+ $CSVQUOTE $@ | head -n 1 | tr "$DEL" '\n' | nl -ba | $CSVQUOTE -u -d "$DEL" -q "$QUO" -r "$REC"
diff --git a/pkgs/tools/text/csvquote/default.nix b/pkgs/tools/text/csvquote/default.nix
new file mode 100644
index 0000000000000..2812de2084121
--- /dev/null
+++ b/pkgs/tools/text/csvquote/default.nix
@@ -0,0 +1,47 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, patsh
+}:
+
+stdenv.mkDerivation rec {
+  pname = "csvquote";
+  version = "0.1.5";
+
+  src = fetchFromGitHub {
+    owner = "dbro";
+    repo = "csvquote";
+    rev = "v${version}";
+    hash = "sha256-847JAoDEfA9K4LB8z9cqSw+GTImqmITBylB/4odLDb0=";
+  };
+
+  patches = [
+    # patch csvheader to use csvquote from the derivation
+    ./csvquote-path.patch
+  ];
+
+  nativeBuildInputs = [
+    patsh
+  ];
+
+  makeFlags = [
+    "BINDIR=$(out)/bin"
+  ];
+
+  preInstall = ''
+    mkdir -p "$out/bin"
+  '';
+
+  postInstall = ''
+    substituteAllInPlace $out/bin/csvheader
+    patsh $out/bin/csvheader -fs ${builtins.storeDir}
+  '';
+
+  meta = with lib; {
+    description = "Enables common unix utlities like cut, awk, wc, head to work correctly with csv data containing delimiters and newlines";
+    homepage = "https://github.com/dbro/csvquote";
+    license = licenses.mit;
+    maintainers = with maintainers; [ figsoda ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/tools/text/mdbook-katex/default.nix b/pkgs/tools/text/mdbook-katex/default.nix
index bb0db2740d33f..40999bc71ebb2 100644
--- a/pkgs/tools/text/mdbook-katex/default.nix
+++ b/pkgs/tools/text/mdbook-katex/default.nix
@@ -2,14 +2,14 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "mdbook-katex";
-  version = "0.3.9";
+  version = "0.3.10";
 
   src = fetchCrate {
     inherit pname version;
-    hash = "sha256-FsKHGw/6n/8eCJh1XatNsw3iCzD+siHdJ3i0dNKD5Go=";
+    hash = "sha256-oGefjf4URmE0i6mOjpZfBcSh280O+IvrAhu3vFAyntQ=";
   };
 
-  cargoHash = "sha256-nyLWbwruzQeyPGkVuMiRCTHtFE+E9nQ57ZMXxqIcLxE=";
+  cargoHash = "sha256-tkMdxkJcvmDSH2ree1nol1JlKKhI5G4x9x5Hs0peKI8=";
 
   OPENSSL_DIR = "${lib.getDev openssl}";
   OPENSSL_LIB_DIR = "${lib.getLib openssl}/lib";