1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 21:50:55 +00:00

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 + "/."); dirCheck = dir: dir != "" && pathExists (dir + "/.");
overlays = dir: overlays = dir:
let content = readDir dir; in 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 in
if dirEnv != "" then if dirEnv != "" then
if dirCheck dirEnv then overlays dirEnv if dirCheck dirEnv then overlays dirEnv