aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/lib/options.nix
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/lib/options.nix')
-rw-r--r--infra/libkookie/nixpkgs/lib/options.nix41
1 files changed, 35 insertions, 6 deletions
diff --git a/infra/libkookie/nixpkgs/lib/options.nix b/infra/libkookie/nixpkgs/lib/options.nix
index 5b7482c80937..87cd8b797969 100644
--- a/infra/libkookie/nixpkgs/lib/options.nix
+++ b/infra/libkookie/nixpkgs/lib/options.nix
@@ -1,11 +1,40 @@
# Nixpkgs/NixOS option handling.
{ lib }:
-with lib.trivial;
-with lib.lists;
-with lib.attrsets;
-with lib.strings;
-
+let
+ inherit (lib)
+ all
+ collect
+ concatLists
+ concatMap
+ elemAt
+ filter
+ foldl'
+ head
+ isAttrs
+ isBool
+ isDerivation
+ isFunction
+ isInt
+ isList
+ isString
+ length
+ mapAttrs
+ optional
+ optionals
+ take
+ ;
+ inherit (lib.attrsets)
+ optionalAttrs
+ ;
+ inherit (lib.strings)
+ concatMapStrings
+ concatStringsSep
+ ;
+ inherit (lib.types)
+ mkOptionType
+ ;
+in
rec {
/* Returns true when the given argument is an option
@@ -110,7 +139,7 @@ rec {
# Return early if we only have one element
# This also makes it work for functions, because the foldl' below would try
# to compare the first element with itself, which is false for functions
- else if length defs == 1 then (elemAt defs 0).value
+ else if length defs == 1 then (head defs).value
else (foldl' (first: def:
if def.value != first.value then
throw "The option `${showOption loc}' has conflicting definition values:${showDefs [ first def ]}"