diff options
author | Jade Lovelace <software@lfcode.ca> | 2024-03-16 16:20:20 -0700 |
---|---|---|
committer | Jade Lovelace <software@lfcode.ca> | 2024-03-16 16:20:20 -0700 |
commit | ea4eb0d5743edddb8d92171a8505fb6209340772 (patch) | |
tree | 8deb9bde7dbd2387d03539dc12469f3781fda461 /pkgs/tools/package-management | |
parent | ce8e7baf9bc8e342237ed840b59e23a92e9a0b5f (diff) | |
download | nixlib-ea4eb0d5743edddb8d92171a8505fb6209340772.tar nixlib-ea4eb0d5743edddb8d92171a8505fb6209340772.tar.gz nixlib-ea4eb0d5743edddb8d92171a8505fb6209340772.tar.bz2 nixlib-ea4eb0d5743edddb8d92171a8505fb6209340772.tar.lz nixlib-ea4eb0d5743edddb8d92171a8505fb6209340772.tar.xz nixlib-ea4eb0d5743edddb8d92171a8505fb6209340772.tar.zst nixlib-ea4eb0d5743edddb8d92171a8505fb6209340772.zip |
nix-doc: allow building without plugin
In certain situations, such as running development builds of Nix that might break API, it can be undesirable to have a Nix dependency for nix-doc, and there is still substantial useful functionality (ctags, search) exposed in its binaries. Thus let's make it possible to turn off the plugin build.
Diffstat (limited to 'pkgs/tools/package-management')
-rw-r--r-- | pkgs/tools/package-management/nix-doc/default.nix | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/pkgs/tools/package-management/nix-doc/default.nix b/pkgs/tools/package-management/nix-doc/default.nix index 2c7940b8d87d..3d0069c87dba 100644 --- a/pkgs/tools/package-management/nix-doc/default.nix +++ b/pkgs/tools/package-management/nix-doc/default.nix @@ -1,5 +1,17 @@ -{ lib, stdenv, rustPlatform, fetchFromGitHub, boost, nix, pkg-config }: +{ 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"; @@ -12,17 +24,20 @@ rustPlatform.buildRustPackage rec { }; doCheck = true; - buildInputs = [ boost nix ]; + buildInputs = lib.optionals withPlugin [ boost nix ]; - nativeBuildInputs = [ pkg-config 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 = [ "bindnow" ]; + 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 stdenv.isLinux { + 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; |