From 4a053bfdfd85915a2a659a337bd171bc22c49138 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 23 Aug 2006 14:39:11 +0000 Subject: * A new primop `builtins', which returns an attribute set containing all the primops. This allows Nix expressions to test for new primops and take appropriate action if they're not available. For instance, rather than calling a primop `foo' directly, they could say `if builtins ? foo then builtins.foo ... else ...'. --- tests/lang/eval-okay-builtins.exp | 1 + tests/lang/eval-okay-builtins.nix | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/lang/eval-okay-builtins.exp create mode 100644 tests/lang/eval-okay-builtins.nix (limited to 'tests') diff --git a/tests/lang/eval-okay-builtins.exp b/tests/lang/eval-okay-builtins.exp new file mode 100644 index 000000000..f4f3ba81a --- /dev/null +++ b/tests/lang/eval-okay-builtins.exp @@ -0,0 +1 @@ +Path("/foo") diff --git a/tests/lang/eval-okay-builtins.nix b/tests/lang/eval-okay-builtins.nix new file mode 100644 index 000000000..e9d65e88a --- /dev/null +++ b/tests/lang/eval-okay-builtins.nix @@ -0,0 +1,12 @@ +assert builtins ? currentSystem; +assert !builtins ? __currentSystem; + +let { + + x = if builtins ? dirOf then builtins.dirOf /foo/bar else ""; + + y = if builtins ? fnord then builtins.fnord "foo" else ""; + + body = x + y; + +} -- cgit v1.2.3