1
1
forked from extern/flakelight

Allow escaping nix filenames with +

This allows having a dir for which loadNixDir generates a "default" attr
without making the dir importable, by naming the file `+default.nix`
instead of `default.nix`.
This commit is contained in:
Archit Gupta 2023-04-15 01:45:39 -07:00
parent b2d353f042
commit 426480067c

View File

@ -8,8 +8,8 @@ let
inherit (nixpkgs.lib) attrNames attrVals composeManyExtensions filter
filterAttrs foldAttrs foldl genAttrs hasSuffix listToAttrs mapAttrs
mapAttrsToList mapAttrs' mergeAttrs nameValuePair optional optionalAttrs
optionalString parseDrvName pathExists pipe recursiveUpdate removeSuffix
zipAttrsWith;
optionalString parseDrvName pathExists pipe recursiveUpdate removePrefix
removeSuffix zipAttrsWith;
exports = { inherit mkFlake loadNixDir systems; };
@ -283,8 +283,10 @@ let
attrNames
(filter (hasSuffix ".nix"))
(map (removeSuffix ".nix"))
(map (removePrefix "+"))
])
(p: import (path + "/${p}.nix"));
(p: import (path +
(if pathExists (path + "/${p}.nix") then "/${p}.nix" else "/+${p}.nix")));
systems = rec {
linuxDefault = [