move options to separate modules, set up mkDocs generation
Build docs with nix and Material for mkDocs / build-docs (push) Successful in 1m33s

This commit is contained in:
greyweather committed 2026-09-01 03:08:10 +01:00
1 parent 9f2487e3e1
commit 81e85743de
33 files changed
+385 -276

No files matched your search

+101
View File
@@ -0,0 +1,101 @@
{ inputs, self, ... }: let
mkSharedGlobalOptions = { lib }: {
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).";
default = "/home/grey/nixos";
};
hostName = lib.mkOption {
type = lib.types.str;
description = "This option is used to tell the config the hostname of the current machine, mostly for symlinking the right dotfiles.";
default = "";
};
stateVersion = lib.mkOption {
type = lib.types.str;
description = "This option is used to set the stateVersion value.";
example = "26.11";
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; }) // {
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";
};
};
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"; };
};
};
};
};
flake.homeModules.globalOptions = { lib, ... }: {
options = (mkSharedGlobalOptions { inherit lib; }) // {
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 = {};
};
extraPackages = (mkSharedGlobalOptions { inherit lib; }).features.applications.extraPackages // { description = mkExtraPackagesDescription "home.packages"; };
};
};
};
};
}