Files
nix-flake/modules/options/global.nix
T

84 lines
3.2 KiB
Nix

{ inputs, self, ... }: let
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).";
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 = "";
};
};
})) ];
flake.nixosModules.globalOptions = { lib, ... }: {
options = {
components = {
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.applications.extraPackages = lib.mkOption {
type = lib.types.listOf (lib.types.package);
description = mkExtraPackagesDescription "environment.systemPackages";
default = [];
};
};
};
flake.homeModules.globalOptions = { 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;
};
};
features.applications = {
extraPackages = lib.mkOption {
type = lib.types.listOf (lib.types.package);
description = mkExtraPackagesDescription "home.packages";
default = [];
};
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 = {};
};
};
};
};
}