refactor to lib

This commit is contained in:
Daylin Morgan 2024-06-26 10:19:26 -05:00
parent 02d34a6aae
commit c40f5c7f0d
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 12 additions and 10 deletions

View file

@ -1,6 +1,6 @@
final: prev:
let
inherit (builtins) listToAttrs substring;
inherit (builtins) listToAttrs substring filter;
inherit (final)
concatStringsSep
hasSuffix
@ -9,6 +9,7 @@ let
mkOption
types
;
inherit (final.filesystem) listFilesRecursive;
in
let
enabled = {
@ -61,7 +62,11 @@ let
(substring 4 2 longDate)
(substring 6 2 longDate)
]);
isNixFile = path: hasSuffix ".nix" path;
isNixFile = p: hasSuffix ".nix" p;
isDefaultNixFile = p: hasSuffix "default.nix" p;
filterNotDefaultNixFile = paths: filter (p: !(isDefaultNixFile p) && (isNixFile p)) paths;
listNixFilesRecursive = dir: filterNotDefaultNixFile (listFilesRecursive dir);
in
{
@ -73,7 +78,8 @@ in
mkOizysModule
mkDefaultOizysModule
mkDate
isNixFile
mkIfIn
isNixFile
listNixFilesRecursive
;
}

View file

@ -3,15 +3,11 @@ let
inherit (lib)
mkOption
types
isNixFile
literalExpression
mdDoc
;
inherit (lib.filesystem) listFilesRecursive;
inherit (builtins) filter;
listNixFilesRecursive =
dir: filter (f: (f != ./default.nix) && (isNixFile f)) (listFilesRecursive dir);
mdDoc
listNixFilesRecursive
;
in
{
imports = listNixFilesRecursive ./.;