Commit 2501addf authored by Jade Lovelace's avatar Jade Lovelace Committed by zowoq
Browse files

nix-doc: 0.5.9 -> 0.5.10

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>
```
parent 156e0714
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
{ 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";