nix-doc: disable plugin since it is broken by Lix API changes

We don't intend to fix the API changes in nix-doc, because we should be
able to kill nix-doc in like a week?
This commit is contained in:
jade 2024-03-16 16:30:31 -07:00
parent e61b27f3f6
commit 8b7315c5b9
2 changed files with 65 additions and 4 deletions

64
nix-doc/package.nix Normal file
View file

@ -0,0 +1,64 @@
# Temporary replacement of the nix-doc package with
# https://github.com/NixOS/nixpkgs/pull/296523 so that we can have working Lix
# with nix-doc on 23.11 and 24.05-pre
#
# Can be removed when that commit is in 23.11 and 24.05-pre, or 24.05 is
# released with the commit.
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, boost
, nix
, pkg-config
# Whether to build the nix-doc plugin for Nix
, withPlugin ? true
}:
let
packageFlags = [ "-p" "nix-doc" ] ++ lib.optionals withPlugin [ "-p" "nix-doc-plugin" ];
in
rustPlatform.buildRustPackage rec {
pname = "nix-doc";
version = "0.6.5";
src = fetchFromGitHub {
rev = "v${version}";
owner = "lf-";
repo = "nix-doc";
sha256 = "sha256-9cuNzq+CBA2jz0LkZb7lh/WISIlKklfovGBAbSo1Mgk=";
};
doCheck = true;
buildInputs = lib.optionals withPlugin [ boost nix ];
nativeBuildInputs = lib.optionals withPlugin [ pkg-config nix ];
cargoBuildFlags = packageFlags;
cargoTestFlags = packageFlags;
# 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 = lib.optionals withPlugin [ "bindnow" ];
# Due to a Rust bug, setting -Z relro-level to anything including "off" on
# macOS will cause link errors
env = lib.optionalAttrs (withPlugin && 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-CHagzXTG9AfrFd3WmHanQ+YddMgmVxSuB8vK98A1Mlw=";
meta = with lib; {
description = "An interactive Nix documentation tool";
longDescription = "An interactive Nix documentation tool providing a CLI for function search, a Nix plugin for docs in the REPL, and a ctags implementation for Nix script";
homepage = "https://github.com/lf-/nix-doc";
license = licenses.lgpl3Plus;
maintainers = [ maintainers.lf- ];
platforms = platforms.unix;
mainProgram = "nix-doc";
};
}

View file

@ -48,8 +48,5 @@ in
nix = final.nixVersions.nix_2_18_upstream; nix = final.nixVersions.nix_2_18_upstream;
}; };
nix-doc = prev.nix-doc.overrideAttrs (old: { nix-doc = prev.callPackage ./nix-doc/package.nix { withPlugin = false; };
# for the purposes of nix C++ API for nix-doc, lix is Nix 2.20
NIX_CFLAGS_COMPILE = [ "-DNIX_2_20_0" ];
});
} }