mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02:00
15 lines
427 B
Nix
15 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));
|
|
}
|