107 lines
4.0 KiB
Nix
107 lines
4.0 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, config, ... }: {
|
|
options.info = {
|
|
rootPath = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "Used to tell the config the absolute path to this flake's root directory, in order to perform actual symlinking (not in `/nix/store` but directly in the directory specified here).";
|
|
defaultText = "/home/<config.info.userName>/flake";
|
|
};
|
|
|
|
userName = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "Used to tell the config the name of the primary user (the user that this flake should focus on for things like Home Manager configurations, etc).";
|
|
default = "grey";
|
|
};
|
|
|
|
hostName = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "Used to tell the config the hostname of the current machine, mostly for symlinking the right dotfiles.";
|
|
default = "";
|
|
};
|
|
};
|
|
|
|
config = {
|
|
info.rootPath = lib.mkDefault "/home/${config.info.userName}/flake";
|
|
};
|
|
})) ];
|
|
|
|
flake.nixosModules.globalOptions = { lib, ... }: {
|
|
options = {
|
|
info.stateVersion = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "Used to set the `system.stateVersion` value.";
|
|
example = "26.11";
|
|
default = "";
|
|
};
|
|
|
|
components = {
|
|
bootLoader = {
|
|
selection = lib.mkOption {
|
|
type = inputs.helpers.mkEnumFromDirContents "${self}/modules/components/boot-loaders";
|
|
description = "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 = "Defines the timeout length that the bootloader should use (the wait time for keyboard input before selecting the default entry).";
|
|
default = 5;
|
|
};
|
|
|
|
maxGenerations = lib.mkOption {
|
|
type = lib.types.int;
|
|
description = "Limits 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 = {
|
|
/* hostPlatform = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "Tells the config the platform string that should be used to generate `pkgs`, since `nixpkgs.hostPlatform` does not exist in a standalone Home Manager setup.";
|
|
default = "x86_64-linux";
|
|
}; */
|
|
|
|
stateVersion = lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "Used to set the `home.stateVersion` value.";
|
|
example = "26.11";
|
|
default = "";
|
|
};
|
|
|
|
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 = {};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
} |