Skip to content

Commit

Permalink
maintainers/scripts/update.nix: use saner nubbing
Browse files Browse the repository at this point in the history
  • Loading branch information
jtojnar committed Mar 13, 2018
1 parent 4f17851 commit 2381bcd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion maintainers/scripts/update.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,22 @@
# TODO: add assert statements

let
/* Remove duplicate elements from the list based on some extracted value. O(n^2) complexity.
*/
nubOn = f: list:
if list == [] then
[]
else
let
x = pkgs.lib.head list;
xs = pkgs.lib.filter (p: f x != f p) (pkgs.lib.drop 1 list);
in
[x] ++ nubOn f xs;

pkgs = import ./../../default.nix { };

packagesWith = cond: return: set:
pkgs.lib.unique
nubOn (pkg: pkg.updateScript)
(pkgs.lib.flatten
(pkgs.lib.mapAttrsToList
(name: pkg:
Expand Down

0 comments on commit 2381bcd

Please sign in to comment.