mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-05 01:53:15 -06:00
refactor to lib
This commit is contained in:
parent
02d34a6aae
commit
c40f5c7f0d
2 changed files with 12 additions and 10 deletions
|
@ -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
|
||||
;
|
||||
}
|
||||
|
|
|
@ -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 ./.;
|
||||
|
|
Loading…
Reference in a new issue