about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/text/hyx/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/text/hyx/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/text/hyx/default.nix23
1 files changed, 17 insertions, 6 deletions
diff --git a/nixpkgs/pkgs/tools/text/hyx/default.nix b/nixpkgs/pkgs/tools/text/hyx/default.nix
index 83fdabb8f46f..c2b055be7df9 100644
--- a/nixpkgs/pkgs/tools/text/hyx/default.nix
+++ b/nixpkgs/pkgs/tools/text/hyx/default.nix
@@ -1,14 +1,25 @@
 { lib, stdenv, fetchurl }:
-
+let
+  # memstream — POSIX memory streams for BSD
+  memstream = fetchurl {
+    url = "https://piumarta.com/software/memstream/memstream-0.1.tar.gz";
+    sha256 = "0kvdb897g7nyviaz72arbqijk2g2wa61cmi3l5yh48rzr49r3a3a";
+  };
+in
 stdenv.mkDerivation rec {
-  name = "hyx-0.1.5";
+  pname = "hyx";
+  version = "2020-06-09";
 
   src = fetchurl {
-    url = "https://yx7.cc/code/hyx/${name}.tar.xz";
-    sha256 = "0gd8fbdyw12jwffa5dgcql4ry22xbdhqdds1qwzk1rkcrkgnc1mg";
+    url = "https://yx7.cc/code/hyx/hyx-${lib.replaceStrings [ "-" ] [ "." ] version}.tar.xz";
+    sha256 = "1x8dmll93hrnj24kn5knpwj36y6r1v2ygwynpjwrg2hwd4c1a8hi";
   };
 
-  patches = [ ./no-wall-by-default.patch ];
+  postUnpack = lib.optionalString stdenv.isDarwin ''
+    tar --strip=1 -C $sourceRoot -xf ${memstream} --wildcards "memstream-0.1/memstream.[hc]"
+  '';
+
+  patches = lib.optional stdenv.isDarwin ./memstream.patch;
 
   installPhase = ''
     install -vD hyx $out/bin/hyx
@@ -19,6 +30,6 @@ stdenv.mkDerivation rec {
     homepage = "https://yx7.cc/code/";
     license = licenses.mit;
     maintainers = with maintainers; [ fpletz ];
-    platforms = platforms.linux;
+    platforms = with platforms; linux ++ darwin;
   };
 }