flake: filter source directory to only contain directories and nix files

and not potential patch files which would be tried to be interpreted as nix code
This commit is contained in:
Sandro - 2023-04-04 22:49:47 +02:00
parent 12f7d68519
commit b294b83325
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 2 additions and 1 deletions

View File

@ -8,7 +8,8 @@
outputs = { self, nixpkgs-lib, ... }:
let
inherit (nixpkgs-lib) lib;
ls = dir: lib.attrNames (builtins.readDir (./. + "/${dir}"));
src = builtins.filterSource (path: type: type == "directory" || lib.hasSuffix ".nix" (baseNameOf path)) ./.;
ls = dir: lib.attrNames (builtins.readDir (src + "/${dir}"));
fileList = dir: map (file: ./. + "/${dir}/${file}") (ls dir);
importDirToKey = dir: args: lib.listToAttrs (map
(file: {