diff --git a/lib/default.nix b/lib/default.nix index e224279..058ee25 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -33,8 +33,8 @@ in rec { }; oizysHosts = mapAttrs (name: _: mkSystem name) (readDir ../hosts); - oizysPkg = forAllSystems (pkgs: - rec { + oizysPkg = forAllSystems ( + pkgs: rec { oizys = pkgs.callPackage ../oizys {}; default = oizys; } diff --git a/lib/extended.nix b/lib/extended.nix index aa4dc49..1a61136 100644 --- a/lib/extended.nix +++ b/lib/extended.nix @@ -1,5 +1,5 @@ final: prev: let - inherit (final) hasSuffix mkEnableOption mkIf; + inherit (final) hasSuffix mkEnableOption mkIf mkOption types; runes = import ../modules/runes; in rec { enabled = {enable = true;}; @@ -33,4 +33,12 @@ in rec { 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; + description = "enable ${attr} support"; + type = types.bool; + }; + config = mkIf config.oizys.${attr}.enable content; + }; } diff --git a/modules/development/cli.nix b/modules/development/cli.nix index 3f72e82..be0b6e7 100644 --- a/modules/development/cli.nix +++ b/modules/development/cli.nix @@ -5,16 +5,9 @@ config, ... }: let - inherit (lib) mkOption mkIf types; - cfg = config.oizys.cli; -in { - options.oizys.cli.enable = mkOption { - default = true; - description = "Whether to enable cli."; - type = types.bool; - }; - - config = mkIf cfg.enable { + inherit (lib) mkDefaultOizysModule; +in + mkDefaultOizysModule config "cli" { programs.direnv.enable = true; environment.sessionVariables = { DIRENV_LOG_FORMAT = "direnv: %s"; @@ -35,5 +28,4 @@ in { btop inputs.tsm.packages.${pkgs.system}.tsm ]; - }; -} + }