mirror of
https://github.com/NixOS/nix.git
synced 2024-11-30 02:32:26 +00:00
16 lines
427 B
Nix
16 lines
427 B
Nix
with builtins;
|
|
|
|
rec {
|
|
splitLines = s: filter (x: !isList x) (split "\n" s);
|
|
|
|
concatStrings = concatStringsSep "";
|
|
|
|
# FIXME: O(n^2)
|
|
unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
|
|
|
|
nameValuePair = name: value: { inherit name value; };
|
|
|
|
filterAttrs = pred: set:
|
|
listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
|
|
}
|