Skip to content

Commit

Permalink
WIP: enable __structuredAttrs in stdenv.mkDerivation
Browse files Browse the repository at this point in the history
This is an attempt at adding support for `__structuredAttrs`.
  • Loading branch information
FRidh committed Jul 31, 2019
1 parent 7a7cf6f commit e9516da
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkgs/stdenv/generic/builder.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
source .attrs.sh

export PATH=
for i in $initialPath; do
if [ "$i" = / ]; then i=; fi
Expand Down
1 change: 1 addition & 0 deletions pkgs/stdenv/generic/default-builder.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
source .attrs.sh
source $stdenv/setup
genericBuild
1 change: 1 addition & 0 deletions pkgs/stdenv/generic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ let
builder = shell;

args = ["-e" ./builder.sh];
__structuredAttrs = true;

setup = setupScript;

Expand Down
1 change: 1 addition & 0 deletions pkgs/stdenv/generic/make-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ in rec {
builder = attrs.realBuilder or stdenv.shell;
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
inherit stdenv;
__structuredAttrs = true;

# The `system` attribute of a derivation has special meaning to Nix.
# Derivations set it to choose what sort of machine could be used to
Expand Down
3 changes: 2 additions & 1 deletion pkgs/stdenv/linux/bootstrap-tools/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
derivation {
name = "bootstrap-tools";

builder = bootstrapFiles.busybox;
builder = "${bootstrapFiles.busybox}";

args = [ "ash" "-e" ./scripts/unpack-bootstrap-tools.sh ];

tarball = bootstrapFiles.bootstrapTools;
# __structuredAttrs = true;

inherit system;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unpack the bootstrap tools tarball.
echo Unpacking the bootstrap tools...
# . ./.attrs.sh
$builder mkdir $out
< $tarball $builder unxz | $builder tar x -C $out

Expand Down
1 change: 1 addition & 0 deletions pkgs/stdenv/linux/make-bootstrap-tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ in with pkgs; rec {
inherit (stdenv.hostPlatform) system; # We cannot "cross test"
builder = bootstrapFiles.busybox;
args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
__structuredAttrs = true;

buildCommand = ''
export PATH=${bootstrapTools}/bin
Expand Down

0 comments on commit e9516da

Please sign in to comment.