diff --git a/pills/07-working-derivation.xml b/pills/07-working-derivation.xml
index d1f44e2..9be1faf 100644
--- a/pills/07-working-derivation.xml
+++ b/pills/07-working-derivation.xml
@@ -307,10 +307,15 @@
coreutils.
- Then we meet the
+ Below is a revised version of the simple.nix file, using the inherit
keyword:
+
+
+
+ Here we also take the opportunity to introduce the
inherit
keyword.
inherit foo;
is equivalent to foo = foo;
.
- Similarly, inherit foo bar;
is equivalent to foo = foo; bar = bar;
.
+ Similarly, inherit gcc coreutils;
is equivalent to gcc = gcc; coreutils = coreutils;
.
+ Lastly, inherit (pkgs) gcc coreutils;
is equivalent to gcc = pkgs.gcc; coreutils = pkgs.coreutils;
.
This syntax only makes sense inside sets. There's no magic involved, it's
diff --git a/pills/07/simple.txt b/pills/07/simple.txt
index b975e95..aff3d15 100644
--- a/pills/07/simple.txt
+++ b/pills/07/simple.txt
@@ -1,9 +1,12 @@
-with (import {});
-derivation {
- name = "simple";
- builder = "${bash}/bin/bash";
- args = [ ./simple_builder.sh ];
- inherit gcc coreutils;
- src = ./simple.c;
- system = builtins.currentSystem;
-}
+let
+ pkgs = import {};
+in
+ pkgs.stdenv.mkDerivation {
+ name = "simple";
+ builder = "${pkgs.bash}/bin/bash";
+ args = [ ./simple_builder.sh ];
+ gcc = pkgs.gcc;
+ coreutils = pkgs.coreutils;
+ src = ./simple.c;
+ system = builtins.currentSystem;
+}
\ No newline at end of file
diff --git a/pills/07/simple_inherit.txt b/pills/07/simple_inherit.txt
new file mode 100644
index 0000000..7abbf03
--- /dev/null
+++ b/pills/07/simple_inherit.txt
@@ -0,0 +1,11 @@
+let
+ pkgs = import {};
+in
+ pkgs.stdenv.mkDerivation {
+ name = "simple";
+ builder = "${pkgs.bash}/bin/bash";
+ args = [ ./simple_builder.sh ];
+ inherit (pkgs) gcc coreutils;
+ src = ./simple.c;
+ system = builtins.currentSystem;
+}
\ No newline at end of file