nixpkgs/pkgs/tools/package-management/nix-doc/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.8 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, boost
, nix
, pkg-config
# Whether to build the nix-doc plugin for Nix
, withPlugin ? true
}:
2020-08-12 01:19:11 +00:00
let
packageFlags = [ "-p" "nix-doc" ] ++ lib.optionals withPlugin [ "-p" "nix-doc-plugin" ];
in
2020-08-12 01:19:11 +00:00
rustPlatform.buildRustPackage rec {
pname = "nix-doc";
version = "0.6.5";
2020-08-12 01:19:11 +00:00
src = fetchFromGitHub {
rev = "v${version}";
owner = "lf-";
repo = "nix-doc";
sha256 = "sha256-9cuNzq+CBA2jz0LkZb7lh/WISIlKklfovGBAbSo1Mgk=";
2020-08-12 01:19:11 +00:00
};
doCheck = true;
buildInputs = lib.optionals withPlugin [ boost nix ];
2020-08-12 01:19:11 +00:00
nativeBuildInputs = lib.optionals withPlugin [ pkg-config nix ];
cargoBuildFlags = packageFlags;
cargoTestFlags = packageFlags;
2020-08-12 01:19:11 +00:00
# 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";
};
cargoHash = "sha256-CHagzXTG9AfrFd3WmHanQ+YddMgmVxSuB8vK98A1Mlw=";
2020-08-12 01:19:11 +00:00
meta = with lib; {
2020-08-12 01:19:11 +00:00
description = "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";
2020-08-12 01:19:11 +00:00
homepage = "https://github.com/lf-/nix-doc";
license = licenses.lgpl3Plus;
maintainers = [ ];
2020-08-12 01:19:11 +00:00
platforms = platforms.unix;
2023-11-27 01:17:53 +00:00
mainProgram = "nix-doc";
2020-08-12 01:19:11 +00:00
};
}