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:
parent
b2d353f042
commit
426480067c
@ -8,8 +8,8 @@ let
|
|||||||
inherit (nixpkgs.lib) attrNames attrVals composeManyExtensions filter
|
inherit (nixpkgs.lib) attrNames attrVals composeManyExtensions filter
|
||||||
filterAttrs foldAttrs foldl genAttrs hasSuffix listToAttrs mapAttrs
|
filterAttrs foldAttrs foldl genAttrs hasSuffix listToAttrs mapAttrs
|
||||||
mapAttrsToList mapAttrs' mergeAttrs nameValuePair optional optionalAttrs
|
mapAttrsToList mapAttrs' mergeAttrs nameValuePair optional optionalAttrs
|
||||||
optionalString parseDrvName pathExists pipe recursiveUpdate removeSuffix
|
optionalString parseDrvName pathExists pipe recursiveUpdate removePrefix
|
||||||
zipAttrsWith;
|
removeSuffix zipAttrsWith;
|
||||||
|
|
||||||
exports = { inherit mkFlake loadNixDir systems; };
|
exports = { inherit mkFlake loadNixDir systems; };
|
||||||
|
|
||||||
@ -283,8 +283,10 @@ let
|
|||||||
attrNames
|
attrNames
|
||||||
(filter (hasSuffix ".nix"))
|
(filter (hasSuffix ".nix"))
|
||||||
(map (removeSuffix ".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 {
|
systems = rec {
|
||||||
linuxDefault = [
|
linuxDefault = [
|
||||||
|
Loading…
Reference in New Issue
Block a user