mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-09 20:33: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:
|
final: prev:
|
||||||
let
|
let
|
||||||
inherit (builtins) listToAttrs substring;
|
inherit (builtins) listToAttrs substring filter;
|
||||||
inherit (final)
|
inherit (final)
|
||||||
concatStringsSep
|
concatStringsSep
|
||||||
hasSuffix
|
hasSuffix
|
||||||
|
@ -9,6 +9,7 @@ let
|
||||||
mkOption
|
mkOption
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
inherit (final.filesystem) listFilesRecursive;
|
||||||
in
|
in
|
||||||
let
|
let
|
||||||
enabled = {
|
enabled = {
|
||||||
|
@ -61,7 +62,11 @@ let
|
||||||
(substring 4 2 longDate)
|
(substring 4 2 longDate)
|
||||||
(substring 6 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
|
in
|
||||||
{
|
{
|
||||||
|
@ -73,7 +78,8 @@ in
|
||||||
mkOizysModule
|
mkOizysModule
|
||||||
mkDefaultOizysModule
|
mkDefaultOizysModule
|
||||||
mkDate
|
mkDate
|
||||||
isNixFile
|
|
||||||
mkIfIn
|
mkIfIn
|
||||||
|
isNixFile
|
||||||
|
listNixFilesRecursive
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,11 @@ let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkOption
|
mkOption
|
||||||
types
|
types
|
||||||
isNixFile
|
|
||||||
literalExpression
|
literalExpression
|
||||||
mdDoc
|
|
||||||
;
|
|
||||||
inherit (lib.filesystem) listFilesRecursive;
|
|
||||||
inherit (builtins) filter;
|
|
||||||
|
|
||||||
listNixFilesRecursive =
|
mdDoc
|
||||||
dir: filter (f: (f != ./default.nix) && (isNixFile f)) (listFilesRecursive dir);
|
listNixFilesRecursive
|
||||||
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = listNixFilesRecursive ./.;
|
imports = listNixFilesRecursive ./.;
|
||||||
|
|
Loading…
Reference in a new issue