move options back out to their config files, improve documentation
This commit is contained in:
30 files changed
+344
-233
No files matched your search
+40
-57
@@ -1,6 +1,8 @@
|
||||
{ inputs, self, ... }: let
|
||||
mkSharedGlobalOptions = { lib }: {
|
||||
info = {
|
||||
mkExtraPackagesDescription = optionName: "This option is equivalent to `${optionName}`, and exists purely for convenience.";
|
||||
in {
|
||||
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "globalOptions" ({ lib, ... }: {
|
||||
options.info = {
|
||||
rootPath = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "This option is used to tell the config the global path to the flake's root directory, in order to perform impure actions (in a Nix sense, not morally impure, I promise).";
|
||||
@@ -20,80 +22,61 @@
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
})) ];
|
||||
|
||||
features = {
|
||||
applications = {
|
||||
cli = {
|
||||
color-converter.enable = lib.mkEnableOption "color-converter";
|
||||
fastfetch.enable = lib.mkEnableOption "fastfetch";
|
||||
nh.enable = lib.mkEnableOption "nh";
|
||||
};
|
||||
|
||||
extraPackages = lib.mkOption {
|
||||
type = lib.types.listOf (lib.types.package);
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
|
||||
shells = {
|
||||
zsh = {
|
||||
enable = lib.mkEnableOption "zsh";
|
||||
antidote.enable = lib.mkEnableOption "antidote";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mkExtraPackagesDescription = optionName: "This options is equivalent to `${optionName}`, and exists purely for convenience.";
|
||||
in {
|
||||
flake.nixosModules.globalOptions = { lib, ... }: {
|
||||
options = (mkSharedGlobalOptions { inherit lib; }) // {
|
||||
options = {
|
||||
components = {
|
||||
bootLoader = lib.mkOption {
|
||||
type = inputs.helpers.mkEnumFromDirContents "${self}/modules/components/boot-loaders";
|
||||
description = "This option defines the bootloader that should be used, enabling any config associated with it in the process.";
|
||||
default = "grub";
|
||||
bootLoader = {
|
||||
selection = lib.mkOption {
|
||||
type = inputs.helpers.mkEnumFromDirContents "${self}/modules/components/boot-loaders";
|
||||
description = "This option defines the bootloader that should be used, enabling any config associated with it in the process.";
|
||||
default = "grub";
|
||||
};
|
||||
|
||||
timeout = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
description = "This option defines the timeout length that the bootloader should use, which controls the wait time for keyboard input before selecting the default entry.";
|
||||
default = 5;
|
||||
};
|
||||
|
||||
maxGenerations = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
description = "This option defines how many entries should be displayed in the bootloader, which can be useful when there are many NixOS generations present before garbage-collection.";
|
||||
default = 10;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
features = (mkSharedGlobalOptions { inherit lib; }).features // {
|
||||
shells = {
|
||||
defaultShell = lib.mkOption {
|
||||
type = inputs.helpers.mkEnumFromDirContents "${self}/modules/features/shells";
|
||||
description = "This option controls the shell that should be used as the default, enabling that shell in the process.";
|
||||
default = "zsh";
|
||||
};
|
||||
} // (mkSharedGlobalOptions { inherit lib; }).features.shells;
|
||||
|
||||
nixos.home-manager.enable = lib.mkEnableOption "home-manager";
|
||||
|
||||
applications = (mkSharedGlobalOptions { inherit lib; }).features.applications // {
|
||||
extraPackages = (mkSharedGlobalOptions { inherit lib; }).features.applications.extraPackages // { description = mkExtraPackagesDescription "environment.systemPackages"; };
|
||||
};
|
||||
features.applications.extraPackages = lib.mkOption {
|
||||
type = lib.types.listOf (lib.types.package);
|
||||
description = mkExtraPackagesDescription "environment.systemPackages";
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
flake.homeModules.globalOptions = { lib, ... }: {
|
||||
options = (mkSharedGlobalOptions { inherit lib; }) // {
|
||||
options = {
|
||||
info = {
|
||||
isStandalone = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = "This option tells the config whether this home-manager config is part of a larger NixOS config or not, and is read-only.";
|
||||
default = true;
|
||||
readOnly = true;
|
||||
};
|
||||
} // (mkSharedGlobalOptions { inherit lib; }).info;
|
||||
};
|
||||
|
||||
features = (mkSharedGlobalOptions { inherit lib; }).features // {
|
||||
applications = (mkSharedGlobalOptions { inherit lib; }).features.applications // {
|
||||
shellScripts = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.str);
|
||||
description = "This option is a set of multiline strings, which are processed into executable bash scripts in `$XDG_BIN_HOME`. The shebang (`#!/bin/bash`) is added afterwards, and shouldn't be included in definitions.";
|
||||
default = {};
|
||||
};
|
||||
features.applications = {
|
||||
extraPackages = lib.mkOption {
|
||||
type = lib.types.listOf (lib.types.package);
|
||||
description = mkExtraPackagesDescription "home.packages";
|
||||
default = [];
|
||||
};
|
||||
|
||||
extraPackages = (mkSharedGlobalOptions { inherit lib; }).features.applications.extraPackages // { description = mkExtraPackagesDescription "home.packages"; };
|
||||
shellScripts = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.str);
|
||||
description = "This option is a set of multiline strings, which are processed into executable bash scripts in `$XDG_BIN_HOME`. The shebang (`#!/bin/bash`) is added afterwards, and shouldn't be included in definitions.";
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user