2024-03-16 23:20:20 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
rustPlatform,
|
|
|
|
fetchFromGitHub,
|
|
|
|
boost,
|
|
|
|
nix,
|
|
|
|
pkg-config,
|
|
|
|
# Whether to build the nix-doc plugin for Nix
|
2024-08-17 20:13:33 +00:00
|
|
|
withPlugin ? false, # no longer needed for nix 2.24
|
2024-03-16 23:20:20 +00:00
|
|
|
}:
|
2020-08-12 01:19:11 +00:00
|
|
|
|
2024-03-16 23:20:20 +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";
|
2024-02-04 05:36:19 +00:00
|
|
|
version = "0.6.5";
|
2020-08-12 01:19:11 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
rev = "v${version}";
|
|
|
|
owner = "lf-";
|
|
|
|
repo = "nix-doc";
|
2024-02-04 05:36:19 +00:00
|
|
|
sha256 = "sha256-9cuNzq+CBA2jz0LkZb7lh/WISIlKklfovGBAbSo1Mgk=";
|
2020-08-12 01:19:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
doCheck = true;
|
2024-03-16 23:20:20 +00:00
|
|
|
buildInputs = lib.optionals withPlugin [
|
|
|
|
boost
|
|
|
|
nix
|
|
|
|
];
|
2020-08-12 01:19:11 +00:00
|
|
|
|
2024-03-16 23:20:20 +00:00
|
|
|
nativeBuildInputs = lib.optionals withPlugin [
|
|
|
|
pkg-config
|
|
|
|
nix
|
|
|
|
];
|
|
|
|
|
|
|
|
cargoBuildFlags = packageFlags;
|
|
|
|
cargoTestFlags = packageFlags;
|
2020-08-12 01:19:11 +00:00
|
|
|
|
2023-08-13 23:49:04 +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)
|
2024-03-16 23:20:20 +00:00
|
|
|
hardeningDisable = lib.optionals withPlugin [ "bindnow" ];
|
2024-07-29 19:34:19 +00:00
|
|
|
|
|
|
|
# Due to a Rust bug, setting -C relro-level to anything including "off" on
|
2023-08-13 23:49:04 +00:00
|
|
|
# macOS will cause link errors
|
2024-03-16 23:20:20 +00:00
|
|
|
env = lib.optionalAttrs (withPlugin && stdenv.hostPlatform.isLinux) {
|
2024-07-29 19:34:19 +00:00
|
|
|
RUSTFLAGS = "-C relro-level=partial";
|
2023-08-13 23:49:04 +00:00
|
|
|
};
|
|
|
|
|
2024-07-02 09:04:59 +00:00
|
|
|
cargoHash = "sha256-CHagzXTG9AfrFd3WmHanQ+YddMgmVxSuB8vK98A1Mlw=";
|
2020-08-12 01:19:11 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-08-12 01:19:11 +00:00
|
|
|
description = "Interactive Nix documentation tool";
|
2021-07-04 02:42:47 +00:00
|
|
|
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";
|
2021-07-09 18:17:55 +00:00
|
|
|
license = licenses.lgpl3Plus;
|
2024-07-29 19:43:38 +00:00
|
|
|
maintainers = [ maintainers.philiptaron ];
|
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
|
|
|
};
|
|
|
|
}
|