Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow optional installation of rust-docs component #253

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions rust-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Comment on lines -134 to 138
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: There is no need to add installDoc as argument of installComponent (no s), as it would be captured like stdenv is.

inherit name;
inherit src;
Expand All @@ -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"
Expand All @@ -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 \
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -261,12 +261,12 @@ 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}";
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 {
Expand Down Expand Up @@ -314,8 +314,9 @@ rec {

rustChannelOf = { sha256 ? null, ... } @ manifest_args: fromManifest
sha256 (manifest_v2_url manifest_args)
{ inherit (self) stdenv lib fetchurl patchelf; }
;
{
inherit (self) stdenv fetchurl patchelf;
};
Comment on lines -317 to +319
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This revert a change from a previous patch which should cause this patch to not work as expected.


# Set of packages which are automagically updated. Do not rely on these for
# reproducible builds.
Expand Down