forked from Fediversity/fediversity.eu
extract importing Nix files
This commit is contained in:
parent
fbebdbb7a1
commit
c76bc2cbad
|
@ -3,7 +3,7 @@ let
|
||||||
inherit (config) pages;
|
inherit (config) pages;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = with lib.fileset; toList (difference (fileFilter ({ hasExt, ... }: hasExt "nix") ./.) ./default.nix);
|
imports = lib.nixFiles ./.;
|
||||||
|
|
||||||
collections.news.type = config.content-types.article;
|
collections.news.type = config.content-types.article;
|
||||||
|
|
||||||
|
|
11
lib.nix
11
lib.nix
|
@ -65,6 +65,17 @@ rec {
|
||||||
in
|
in
|
||||||
join "/" relativeComponents;
|
join "/" relativeComponents;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Recursively list all Nix files from a directory, except the top-level `default.nix`
|
||||||
|
|
||||||
|
Useful for module system `imports` from a top-level module.
|
||||||
|
**/
|
||||||
|
nixFiles = dir: with lib.fileset;
|
||||||
|
toList (difference
|
||||||
|
(fileFilter ({ hasExt, ... }: hasExt "nix") dir)
|
||||||
|
(dir + "/default.nix")
|
||||||
|
);
|
||||||
|
|
||||||
types = rec {
|
types = rec {
|
||||||
collection = elemType:
|
collection = elemType:
|
||||||
let
|
let
|
||||||
|
|
Reference in a new issue