Refactor `overlay.nix`
Simplify `overlay.nix` a bit by removing unnecessary filtering on attribute values.main
parent
1ab421bfa7
commit
262dabbaf2
31
overlay.nix
31
overlay.nix
|
@ -1,23 +1,18 @@
|
||||||
# You can use this file as a nixpkgs overlay.
|
# You can use this file as a nixpkgs overlay. This is useful in the
|
||||||
# It's useful in the case where you don't want to add the whole NUR namespace
|
# case where you don't want to add the whole NUR namespace to your
|
||||||
# to your configuration.
|
# configuration.
|
||||||
|
|
||||||
self: super:
|
self: super:
|
||||||
|
|
||||||
let
|
let
|
||||||
filterSet =
|
|
||||||
(f: g: s: builtins.listToAttrs
|
|
||||||
(map
|
|
||||||
(n: { name = n; value = builtins.getAttr n s; })
|
|
||||||
(builtins.filter
|
|
||||||
(n: f n && g (builtins.getAttr n s))
|
|
||||||
(builtins.attrNames s)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
isReserved = n: builtins.elem n ["lib" "overlays" "modules"];
|
|
||||||
in filterSet
|
|
||||||
(n: !(isReserved n)) # filter out non-packages
|
|
||||||
(p: true) # all packages are ok
|
|
||||||
(import ./default.nix { pkgs = super; })
|
|
||||||
|
|
||||||
|
isReserved = n: n == "lib" || n == "overlays" || n == "modules";
|
||||||
|
nameValuePair = n: v: { name = n; value = v; };
|
||||||
|
nurAttrs = import ./default.nix { pkgs = super; };
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
builtins.listToAttrs
|
||||||
|
(map (n: nameValuePair n nurAttrs.${n})
|
||||||
|
(builtins.filter (n: !isReserved n)
|
||||||
|
(builtins.attrNames nurAttrs)))
|
||||||
|
|
Loading…
Reference in New Issue