From 1f4163d8394b5fa933368d10853f106bebe9c18d Mon Sep 17 00:00:00 2001 From: hlolli Date: Mon, 31 May 2021 01:16:46 +0200 Subject: [PATCH 1/7] fix deprecated sandbox.h features, causing impure syscalls on aarch64-darwin --- pkgs/tools/typesetting/lowdown/default.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/typesetting/lowdown/default.nix b/pkgs/tools/typesetting/lowdown/default.nix index b9b5e806a4ec..2de00702a388 100644 --- a/pkgs/tools/typesetting/lowdown/default.nix +++ b/pkgs/tools/typesetting/lowdown/default.nix @@ -24,12 +24,20 @@ stdenv.mkDerivation rec { ''; # Fix lib extension so that fixDarwinDylibNames detects it - postInstall = lib.optionalString stdenv.isDarwin '' + postInstall = lib.optionalString (stdenv.isDarwin && !stdenv.isAarch64) '' mv $lib/lib/liblowdown.{so,dylib} ''; patches = lib.optional (!stdenv.hostPlatform.isStatic) ./shared.patch; + patchPhase = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) '' + substituteInPlace main.c \ + --replace '#elif HAVE_SANDBOX_INIT' '#elif 0' + ''; + + doInstallCheck = stdenv.hostPlatform == stdenv.buildPlatform; + installCheckPhase = "echo '# TEST' > test.md; $out/bin/lowdown test.md"; + doCheck = stdenv.hostPlatform == stdenv.buildPlatform; checkTarget = "regress"; @@ -41,4 +49,3 @@ stdenv.mkDerivation rec { platforms = platforms.unix; }; } - From b62962b2746ac9b21d5d22583cd30e1bbdb63964 Mon Sep 17 00:00:00 2001 From: hlolli Date: Mon, 31 May 2021 02:18:05 +0200 Subject: [PATCH 2/7] remove unneccecary substitute and aarch64 platform check --- pkgs/tools/typesetting/lowdown/default.nix | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkgs/tools/typesetting/lowdown/default.nix b/pkgs/tools/typesetting/lowdown/default.nix index 2de00702a388..8c55985a404c 100644 --- a/pkgs/tools/typesetting/lowdown/default.nix +++ b/pkgs/tools/typesetting/lowdown/default.nix @@ -14,6 +14,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ which ] ++ lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ]; + preConfigure = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) + "echo 'HAVE_SANDBOX_INIT=0' > configure.local"; + configurePhase = '' runHook preConfigure ./configure PREFIX=''${!outputDev} \ @@ -24,17 +27,12 @@ stdenv.mkDerivation rec { ''; # Fix lib extension so that fixDarwinDylibNames detects it - postInstall = lib.optionalString (stdenv.isDarwin && !stdenv.isAarch64) '' + postInstall = lib.optionalString (stdenv.isDarwin) '' mv $lib/lib/liblowdown.{so,dylib} ''; patches = lib.optional (!stdenv.hostPlatform.isStatic) ./shared.patch; - patchPhase = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) '' - substituteInPlace main.c \ - --replace '#elif HAVE_SANDBOX_INIT' '#elif 0' - ''; - doInstallCheck = stdenv.hostPlatform == stdenv.buildPlatform; installCheckPhase = "echo '# TEST' > test.md; $out/bin/lowdown test.md"; From 259bf508105c7007c366090ab75c31dba503256b Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 30 May 2021 22:10:20 -0400 Subject: [PATCH 3/7] lowdown: remove extra brackets --- pkgs/tools/typesetting/lowdown/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/typesetting/lowdown/default.nix b/pkgs/tools/typesetting/lowdown/default.nix index 8c55985a404c..e7280f06529e 100644 --- a/pkgs/tools/typesetting/lowdown/default.nix +++ b/pkgs/tools/typesetting/lowdown/default.nix @@ -27,7 +27,7 @@ stdenv.mkDerivation rec { ''; # Fix lib extension so that fixDarwinDylibNames detects it - postInstall = lib.optionalString (stdenv.isDarwin) '' + postInstall = lib.optionalString stdenv.isDarwin '' mv $lib/lib/liblowdown.{so,dylib} ''; From db89e667afcca79a329afd3a71b22a7177014124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hl=C3=B6=C3=B0ver=20Sigur=C3=B0sson?= Date: Mon, 31 May 2021 08:41:18 +0200 Subject: [PATCH 4/7] Update pkgs/tools/typesetting/lowdown/default.nix Co-authored-by: Dmitry Kalinkin --- pkgs/tools/typesetting/lowdown/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/typesetting/lowdown/default.nix b/pkgs/tools/typesetting/lowdown/default.nix index e7280f06529e..257f02e0dd3a 100644 --- a/pkgs/tools/typesetting/lowdown/default.nix +++ b/pkgs/tools/typesetting/lowdown/default.nix @@ -34,7 +34,12 @@ stdenv.mkDerivation rec { patches = lib.optional (!stdenv.hostPlatform.isStatic) ./shared.patch; doInstallCheck = stdenv.hostPlatform == stdenv.buildPlatform; - installCheckPhase = "echo '# TEST' > test.md; $out/bin/lowdown test.md"; + installCheckPhase = '' + runHook preInstallCheck + echo '# TEST' > test.md + lowdown test.md + runHook postInstallCheck + ''; doCheck = stdenv.hostPlatform == stdenv.buildPlatform; checkTarget = "regress"; From 33e9bc9b4388f7733442daccca8ae94e5f1db573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hl=C3=B6=C3=B0ver=20Sigur=C3=B0sson?= Date: Mon, 31 May 2021 08:41:51 +0200 Subject: [PATCH 5/7] Update pkgs/tools/typesetting/lowdown/default.nix Co-authored-by: Dmitry Kalinkin --- pkgs/tools/typesetting/lowdown/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/typesetting/lowdown/default.nix b/pkgs/tools/typesetting/lowdown/default.nix index 257f02e0dd3a..174052b9aecb 100644 --- a/pkgs/tools/typesetting/lowdown/default.nix +++ b/pkgs/tools/typesetting/lowdown/default.nix @@ -14,7 +14,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ which ] ++ lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ]; - preConfigure = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) + preConfigure = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) '' + echo 'HAVE_SANDBOX_INIT=0' > configure.local + '' "echo 'HAVE_SANDBOX_INIT=0' > configure.local"; configurePhase = '' From 05ddbbe148deac00c8ecbaae5c9ffe4d9124f3e7 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Mon, 31 May 2021 02:43:09 -0400 Subject: [PATCH 6/7] lowdown: fix preConfigure --- pkgs/tools/typesetting/lowdown/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/tools/typesetting/lowdown/default.nix b/pkgs/tools/typesetting/lowdown/default.nix index 174052b9aecb..6e8da3dd110b 100644 --- a/pkgs/tools/typesetting/lowdown/default.nix +++ b/pkgs/tools/typesetting/lowdown/default.nix @@ -16,8 +16,7 @@ stdenv.mkDerivation rec { preConfigure = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) '' echo 'HAVE_SANDBOX_INIT=0' > configure.local - '' - "echo 'HAVE_SANDBOX_INIT=0' > configure.local"; + ''; configurePhase = '' runHook preConfigure From 47c2be0ad02b8a73bfd9c7e892fd7d3f3cfcff7d Mon Sep 17 00:00:00 2001 From: hlolli Date: Mon, 31 May 2021 08:46:09 +0200 Subject: [PATCH 7/7] cleanup from github suggestions --- pkgs/tools/typesetting/lowdown/default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/typesetting/lowdown/default.nix b/pkgs/tools/typesetting/lowdown/default.nix index 174052b9aecb..e45eda3326a1 100644 --- a/pkgs/tools/typesetting/lowdown/default.nix +++ b/pkgs/tools/typesetting/lowdown/default.nix @@ -16,8 +16,7 @@ stdenv.mkDerivation rec { preConfigure = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) '' echo 'HAVE_SANDBOX_INIT=0' > configure.local - '' - "echo 'HAVE_SANDBOX_INIT=0' > configure.local"; + ''; configurePhase = '' runHook preConfigure @@ -39,7 +38,7 @@ stdenv.mkDerivation rec { installCheckPhase = '' runHook preInstallCheck echo '# TEST' > test.md - lowdown test.md + $out/bin/lowdown test.md runHook postInstallCheck '';