···1111 warn
1212 pipe
1313 ;
1414- inherit (lib.attrsets) mapAttrs;
1414+ inherit (lib.attrsets) mapAttrs attrNames;
1515 inherit (lib) max;
1616in
1717rec {
···18391839 /**
18401840 Remove duplicate elements from the `list`. O(n^2) complexity.
1841184118421842+ :::{.note}
18431843+ If the list only contains strings and order is not important, the complexity can be reduced to O(n log n) by using [`lib.lists.uniqueStrings`](#function-library-lib.lists.uniqueStrings) instead.
18441844+ :::
18451845+18421846 # Inputs
1843184718441848 `list`
···18631867 :::
18641868 */
18651869 unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [ ];
18701870+18711871+ /**
18721872+ Removes duplicate strings from the `list`. O(n log n) complexity.
18731873+18741874+ :::{.note}
18751875+ Order is not preserved.
18761876+18771877+ All elements of the list must be strings without context.
18781878+18791879+ This function fails when the list contains a non-string element or a [string with context](https://nix.dev/manual/nix/latest/language/string-context.html).
18801880+ In that case use [`lib.lists.unique`](#function-library-lib.lists.unique) instead.
18811881+ :::
18821882+18831883+ # Inputs
18841884+18851885+ `list`
18861886+18871887+ : List of strings
18881888+18891889+ # Type
18901890+18911891+ ```
18921892+ uniqueStrings :: [ String ] -> [ String ]
18931893+ ```
18941894+18951895+ # Examples
18961896+ :::{.example}
18971897+ ## `lib.lists.uniqueStrings` usage example
18981898+18991899+ ```nix
19001900+ uniqueStrings [ "foo" "bar" "foo" ]
19011901+ => [ "bar" "foo" ] # order is not preserved
19021902+ ```
19031903+19041904+ :::
19051905+ */
19061906+ uniqueStrings = list: attrNames (groupBy id list);
1866190718671908 /**
18681909 Check if list contains only unique elements. O(n^2) complexity.
···944944 imagemagick7Big = throw "'imagemagick7Big' has been renamed to/replaced by 'imagemagickBig'"; # Converted to throw 2024-10-17
945945 imagemagick7 = throw "'imagemagick7' has been renamed to/replaced by 'imagemagick'"; # Converted to throw 2024-10-17
946946 imagemagick7_light = throw "'imagemagick7_light' has been renamed to/replaced by 'imagemagick_light'"; # Converted to throw 2024-10-17
947947+ imaginer = throw "'imaginer' has been removed due to lack of upstream maintenance"; # Added 2025-08-15
947948 immersed-vr = lib.warnOnInstantiate "'immersed-vr' has been renamed to 'immersed'" immersed; # Added 2024-08-11
948949 inconsolata-nerdfont = lib.warnOnInstantiate "inconsolata-nerdfont is redundant. Use nerd-fonts.inconsolata instead." nerd-fonts.inconsolata; # Added 2024-11-10
949950 incrtcl = tclPackages.incrtcl; # Added 2024-10-02