diff --git a/lib/default.nix b/lib/default.nix index e420808..0475709 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,6 +1,6 @@ inputs: let - inherit (inputs) nixpkgs self zig2nix; + inherit (inputs) nixpkgs self; lib = nixpkgs.lib.extend (import ./extended.nix); inherit (builtins) diff --git a/lib/extended.nix b/lib/extended.nix index f5d14a6..3485703 100644 --- a/lib/extended.nix +++ b/lib/extended.nix @@ -1,5 +1,6 @@ final: prev: let + inherit (builtins) listToAttrs substring; inherit (final) concatStringsSep hasSuffix @@ -8,9 +9,8 @@ let mkOption types ; - inherit (builtins) listToAttrs substring; in -rec { +let enabled = { enable = true; }; @@ -37,13 +37,13 @@ rec { }) attrs ); - isNixFile = path: hasSuffix ".nix" path; mkIfIn = name: list: prev.mkIf (builtins.elem name list); mkOizysModule = config: attr: content: { options.oizys.${attr}.enable = mkEnableOption "enable ${attr} support"; config = mkIf config.oizys.${attr}.enable content; }; + mkDefaultOizysModule = config: attr: content: { options.oizys.${attr}.enable = mkOption { default = true; @@ -61,4 +61,19 @@ rec { (substring 4 2 longDate) (substring 6 2 longDate) ]); + isNixFile = path: hasSuffix ".nix" path; + +in +{ + inherit + enabled + disabled + enableAttrs + disableAttrs + mkOizysModule + mkDefaultOizysModule + mkDate + isNixFile + mkIfIn + ; } diff --git a/modules/languages/default.nix b/modules/languages/default.nix index 3d4e30c..2ba33a9 100644 --- a/modules/languages/default.nix +++ b/modules/languages/default.nix @@ -1,18 +1,20 @@ { lib, ... }: let - inherit (builtins) filter; inherit (lib) - isNixFile mkOption types + isNixFile literalExpression mdDoc ; inherit (lib.filesystem) listFilesRecursive; + inherit (builtins) filter; + + listNixFilesRecursive = + dir: filter (f: (f != ./default.nix) && (isNixFile f)) (listFilesRecursive dir); in { - imports = filter (f: (f != ./default.nix) && (isNixFile f)) (listFilesRecursive ./.); - + imports = listNixFilesRecursive ./.; options.oizys.languages = mkOption { type = with types; (listOf str); description = mdDoc ''