Only read overlays ending in .nix

For example, this prevents Nix from barfing on editor backup files in
~/.nixpkgs/overlays.
This commit is contained in:
Eelco Dolstra 2017-01-31 15:20:28 +01:00
parent 05ee54782e
commit 86fe7a40ac
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -29,7 +29,9 @@
dirCheck = dir: dir != "" && pathExists (dir + "/.");
overlays = dir:
let content = readDir dir; in
map (n: import "${dir}/${n}") (sort lessThan (attrNames content));
map (n: import "${dir}/${n}")
(builtins.filter (n: builtins.match ".*\.nix" n != null)
(sort lessThan (attrNames content)));
in
if dirEnv != "" then
if dirCheck dirEnv then overlays dirEnv