From 2501addf2d61a3052128659883fee33435edd669 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Sun, 13 Aug 2023 16:49:04 -0700 Subject: [PATCH] nix-doc: 0.5.9 -> 0.5.10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes https://github.com/NixOS/nixpkgs/issues/237637 and its entire class of problems by making nix-doc save the version it was built for in the library and then bail harmlessly if it is mismatched. ``` dev/nixpkgs2 » nix-build -A nix-doc /nix/store/wv9nm47lplyz4b0pa4549zwrnsp3zvaf-nix-doc-0.5.10 dev/nixpkgs2 » nix-build -A nixVersions.nix_2_14 -o result2 /nix/store/ka0ygdzl9jd0j77y7ls6shngdz9vvqpn-nix-2.14.1 dev/nixpkgs2 » ./result2/bin/nix --plugin-files ./result/lib/libnix_doc_plugin.so repl nix-doc warning: mismatched nix version, not loading Welcome to Nix 2.14.1. Type :? for help. nix-repl> ``` --- .../package-management/nix-doc/default.nix | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/package-management/nix-doc/default.nix b/pkgs/tools/package-management/nix-doc/default.nix index ba5da3595657..f3983b0cd760 100644 --- a/pkgs/tools/package-management/nix-doc/default.nix +++ b/pkgs/tools/package-management/nix-doc/default.nix @@ -1,14 +1,14 @@ -{ lib, rustPlatform, fetchFromGitHub, boost, nix, pkg-config }: +{ lib, stdenv, rustPlatform, fetchFromGitHub, boost, nix, pkg-config }: rustPlatform.buildRustPackage rec { pname = "nix-doc"; - version = "0.5.9"; + version = "0.5.10"; src = fetchFromGitHub { rev = "v${version}"; owner = "lf-"; repo = "nix-doc"; - sha256 = "sha256-uilVJz1MnMF3i/ZXY0bIoSK3uAzfxWuHfhoOSmQgY/I="; + sha256 = "sha256-+T4Bz26roTFiXTM8P8FnJLSdFY2hP26X4nChWWUACN8="; }; doCheck = true; @@ -16,7 +16,20 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ pkg-config nix ]; - cargoSha256 = "sha256-02noJcbtml4MxRCjaWtjOWLTUNOQnKy3GCsil31J6F8="; + # Packaging support for making the nix-doc plugin load cleanly as a no-op on + # the wrong Nix version (disabling bindnow permits loading libraries + # requiring unavailable symbols if they are unreached) + hardeningDisable = [ "bindnow" ]; + # Due to a Rust bug, setting -Z relro-level to anything including "off" on + # macOS will cause link errors + env = lib.optionalAttrs stdenv.isLinux { + # nix-doc does not use nightly features, however, there is no other way to + # set relro-level + RUSTC_BOOTSTRAP = 1; + RUSTFLAGS = "-Z relro-level=partial"; + }; + + cargoSha256 = "sha256-GylSWo4LIsjKnJE9H6iJHZ99UI6UPhAOnAGXk+v8bko="; meta = with lib; { description = "An interactive Nix documentation tool";