From 118f7b646310fa34a3f95ded19ca35af032b9347 Mon Sep 17 00:00:00 2001 From: Phillip Cloud Date: Sun, 14 Mar 2021 08:45:09 -0400 Subject: [PATCH 1/2] Allow optional installation of rust-docs component --- rust-overlay.nix | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/rust-overlay.nix b/rust-overlay.nix index 420cf70..312ba99 100644 --- a/rust-overlay.nix +++ b/rust-overlay.nix @@ -131,10 +131,10 @@ let in map (tuple: { name = tuple.name; src = (getFetchUrl pkgs tuple.name tuple.target stdenv fetchurl); }) pkgsTuplesToInstall; - installComponents = stdenv: namesAndSrcs: + installComponents = { stdenv, namesAndSrcs, installDoc }: let inherit (builtins) map; - installComponent = name: src: + installComponent = installDoc: { name, src }: stdenv.mkDerivation { inherit name; inherit src; @@ -147,7 +147,7 @@ let # This code is inspired by patchelf/setup-hook.sh to iterate over all binaries. installPhase = '' patchShebangs install.sh - CFG_DISABLE_LDCONFIG=1 ./install.sh --prefix=$out --verbose + CFG_DISABLE_LDCONFIG=1 ./install.sh --prefix=$out --verbose ${self.lib.optionalString (!installDoc) "--without=rust-docs"} setInterpreter() { local dir="$1" @@ -159,7 +159,7 @@ let if [[ "$i" =~ .build-id ]]; then continue; fi if ! isELF "$i"; then continue; fi echo "setting interpreter of $i" - + if [[ -x "$i" ]]; then # Handle executables patchelf \ @@ -223,7 +223,7 @@ let dontStrip = true; }; in - map (nameAndSrc: (installComponent nameAndSrc.name nameAndSrc.src)) namesAndSrcs; + map (installComponent installDoc) namesAndSrcs; # Manifest files are organized as follow: # { date = "2017-03-03"; @@ -266,7 +266,7 @@ let version' = builtins.match "([^ ]*) [(]([^ ]*) ([^ ]*)[)]" pkg.version; version = "${elemAt version' 0}-${elemAt version' 2}-${elemAt version' 1}"; namesAndSrcs = getComponents pkgs.pkg name targets extensions targetExtensions stdenv fetchurl; - components = installComponents stdenv namesAndSrcs; + components = installComponents { inherit stdenv namesAndSrcs installDoc; }; componentsOuts = builtins.map (comp: (super.lib.strings.escapeNixString (super.lib.getOutput "out" comp))) components; in super.pkgs.symlinkJoin { @@ -312,10 +312,12 @@ rec { }; }; - rustChannelOf = { sha256 ? null, ... } @ manifest_args: fromManifest + rustChannelOf = { sha256 ? null, installDoc ? true, ... } @ manifest_args: fromManifest sha256 (manifest_v2_url manifest_args) - { inherit (self) stdenv lib fetchurl patchelf; } - ; + { + inherit (self) stdenv fetchurl patchelf; + inherit installDoc; + }; # Set of packages which are automagically updated. Do not rely on these for # reproducible builds. From ea3be81df8aff5e7004dc380de9a1f23b4db58e0 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Sun, 5 Sep 2021 08:57:42 -0400 Subject: [PATCH 2/2] Move installDoc to the proper location --- rust-overlay.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rust-overlay.nix b/rust-overlay.nix index 312ba99..9a78c3b 100644 --- a/rust-overlay.nix +++ b/rust-overlay.nix @@ -261,7 +261,7 @@ let pkgs = fromTOML (builtins.readFile manifest); in flip mapAttrs pkgs.pkg (name: pkg: - makeOverridable ({extensions, targets, targetExtensions}: + makeOverridable ({extensions, targets, targetExtensions, installDoc ? false}: let version' = builtins.match "([^ ]*) [(]([^ ]*) ([^ ]*)[)]" pkg.version; version = "${elemAt version' 0}-${elemAt version' 2}-${elemAt version' 1}"; @@ -312,11 +312,10 @@ rec { }; }; - rustChannelOf = { sha256 ? null, installDoc ? true, ... } @ manifest_args: fromManifest + rustChannelOf = { sha256 ? null, ... } @ manifest_args: fromManifest sha256 (manifest_v2_url manifest_args) { inherit (self) stdenv fetchurl patchelf; - inherit installDoc; }; # Set of packages which are automagically updated. Do not rely on these for