From 943592f69850fd07dd2422da062b1c1ebc45974d Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 31 Jan 2018 14:02:19 -0500 Subject: Add setFunctionArgs lib function. Among other things, this will allow *2nix tools to output plain data while still being composable with the traditional callPackage/.override interfaces. --- nixos/doc/manual/default.nix | 2 +- nixos/lib/testing.nix | 2 +- nixos/modules/misc/nixpkgs.nix | 6 +++--- nixos/modules/profiles/clone-config.nix | 2 +- nixos/tests/make-test.nix | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'nixos') diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index 9bc83be66104..8079a2feb29f 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -12,7 +12,7 @@ let substFunction = x: if builtins.isAttrs x then lib.mapAttrs (name: substFunction) x else if builtins.isList x then map substFunction x - else if builtins.isFunction x then "" + else if lib.isFunction x then "" else x; # Clean up declaration sites to not refer to the NixOS source tree. diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix index 532fff681d37..cf213d906f58 100644 --- a/nixos/lib/testing.nix +++ b/nixos/lib/testing.nix @@ -85,7 +85,7 @@ rec { testScript' = # Call the test script with the computed nodes. - if builtins.isFunction testScript + if lib.isFunction testScript then testScript { inherit nodes; } else testScript; diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 1793c1447d60..b01f54319098 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -4,10 +4,10 @@ with lib; let isConfig = x: - builtins.isAttrs x || builtins.isFunction x; + builtins.isAttrs x || lib.isFunction x; optCall = f: x: - if builtins.isFunction f + if lib.isFunction f then f x else f; @@ -38,7 +38,7 @@ let overlayType = mkOptionType { name = "nixpkgs-overlay"; description = "nixpkgs overlay"; - check = builtins.isFunction; + check = lib.isFunction; merge = lib.mergeOneOption; }; diff --git a/nixos/modules/profiles/clone-config.nix b/nixos/modules/profiles/clone-config.nix index 77d86f8d7405..5b4e68beb6a6 100644 --- a/nixos/modules/profiles/clone-config.nix +++ b/nixos/modules/profiles/clone-config.nix @@ -17,7 +17,7 @@ let # you should use files). moduleFiles = # FIXME: use typeOf (Nix 1.6.1). - filter (x: !isAttrs x && !builtins.isFunction x) modules; + filter (x: !isAttrs x && !lib.isFunction x) modules; # Partition module files because between NixOS and non-NixOS files. NixOS # files may change if the repository is updated. diff --git a/nixos/tests/make-test.nix b/nixos/tests/make-test.nix index f3e26aa7e74d..1b571a008e0f 100644 --- a/nixos/tests/make-test.nix +++ b/nixos/tests/make-test.nix @@ -2,4 +2,4 @@ f: { system ? builtins.currentSystem, ... } @ args: with import ../lib/testing.nix { inherit system; }; -makeTest (if builtins.isFunction f then f (args // { inherit pkgs; inherit (pkgs) lib; }) else f) +makeTest (if lib.isFunction f then f (args // { inherit pkgs; inherit (pkgs) lib; }) else f) -- cgit 1.4.1