move options back out to their config files, improve documentation

This commit is contained in:
greyweather committed 2026-09-02 00:05:28 +01:00
1 parent 70ac7954ad
commit 9c13923c2e
30 files changed
+344 -233

No files matched your search

Generated
+4 -4
View File
@@ -187,11 +187,11 @@
]
},
"locked": {
"lastModified": 1788129603,
"narHash": "sha256-NIj3G63MeCajZr70RGl1xNsdsAa+0QgH+lq00doGjDY=",
"lastModified": 1788303756,
"narHash": "sha256-KwDkCX7JBWVjDCoP1CqF3HCMpM8Uy1anD0pKzAZ2Aaw=",
"ref": "refs/heads/main",
"rev": "3131ebbfcdbbf49f073d0f81ea987300cf422a2e",
"revCount": 12,
"rev": "fef3a464ef4db019bd654446b15eca1f9b31fd44",
"revCount": 48,
"type": "git",
"url": "https://git.greyweather.dev/greyweather/nix-helper-flake"
},
+5 -1
View File
@@ -1,8 +1,12 @@
{ inputs, self, ... }: {
flake.nixosModules.global = { pkgs, config, lib, ... }: {
boot.loader.grub = lib.mkIf (config.components.bootLoader == "grub") {
boot.loader.grub = lib.mkIf (config.components.bootLoader.selection == "grub") {
enable = true;
useOSProber = true;
configurationLimit = config.components.bootLoader.maxGenerations;
extraConfig = ''
timeout ${config.components.bootLoader.timeout}
'';
};
};
}
+5 -2
View File
@@ -1,8 +1,11 @@
{ inputs, self, ... }: {
flake.nixosModules.global = { pkgs, config, lib, ... }: {
boot.loader.limine = lib.mkIf (config.components.bootLoader == "limine") {
boot.loader.limine = lib.mkIf (config.components.bootLoader.selection == "limine") {
enable = true;
maxGenerations = 10;
maxGenerations = config.components.bootLoader.maxGenerations;
extraConfig = ''
timeout: ${if config.components.bootLoader.timeout == -1 then "no" else builtins.toString (config.components.bootLoader.timeout)}
'';
};
};
}
+85 -30
View File
@@ -2,6 +2,15 @@
mkDocsDerivation = { pkgs, doBuild ? true }: let
inherit (pkgs) lib stdenv mkdocs python314Packages;
indexMd = let
rawText = ''
## Welcome!
This site is rebuilt with every generation, and holds a complete record of all options declared within this flake.
'';
in pkgs.runCommand "index.md" {} ''
echo "${rawText}" >> $out
'';
mkOptionsDocFromModule = commandName: module: let
eval = lib.evalModules {
modules = [ module ];
@@ -9,49 +18,63 @@
};
optionsDoc = pkgs.nixosOptionsDoc {
inherit (eval) options;
options = builtins.removeAttrs eval.options ["_module"];
};
in pkgs.runCommand commandName {} ''
cat ${optionsDoc.optionsCommonMark} >> $out
'';
indexMd = let
rawText = ''
## Welcome!
This site is rebuilt with every generation, and holds a complete record of all options declared within this flake.
Visit [NixOS](nixos-options.md) or [Home Manager](home-options.md) to see the available options.
'';
in pkgs.runCommand "index.md" {} ''
echo "${rawText}" >> $out
'';
nixos-global-options = mkOptionsDocFromModule "nixos-global-options.md" self.nixosModules.globalOptions;
nixos-graphics-options = mkOptionsDocFromModule "nixos-graphics-options.md" self.nixosModules.graphicsOptions;
nixos-gaming-options = mkOptionsDocFromModule "nixos-gaming-options.md" self.nixosModules.gamingOptions;
nixosOptionsMd = mkOptionsDocFromModule "nixos-options.md" self.nixosModules.options;
homeOptionsMd = mkOptionsDocFromModule "home-options.md" self.homeModules.options;
home-global-options = mkOptionsDocFromModule "home-global-options.md" self.homeModules.globalOptions;
home-audio-options = mkOptionsDocFromModule "home-audio-options.md" self.homeModules.audioOptions;
home-graphics-options = mkOptionsDocFromModule "home-graphics-options.md" self.homeModules.graphicsOptions;
home-gaming-options = mkOptionsDocFromModule "home-gaming-options.md" self.homeModules.gamingOptions;
mkDocsConfig = ''
site_name: flake options
nav:
- Home: 'index.md'
- Options:
- NixOS: 'nixos-options.md'
- Home Manager: 'home-options.md'
- NixOS:
- Global: 'nixos-global-options.md'
- Capabilities:
- Graphics: 'nixos-graphics-options.md'
- Gaming: 'nixos-gaming-options.md'
- Home Manager:
- Global: 'home-global-options.md'
- Capabilities:
- Audio: 'home-audio-options.md'
- Graphics: 'home-graphics-options.md'
- Gaming: 'home-gaming-options.md'
theme:
name: material
palette:
scheme: slate
markdown_extensions:
- admonition
- pymdownx.details
- pymdownx.superfences
'';
mkDocsYml = pkgs.runCommand "mkdocs.yml" {} ''
echo "${mkDocsConfig}" >> $out
'';
in stdenv.mkDerivation {
src = self;
unpackPhase = "true";
name = if doBuild then "docs" else "docs-md";
buildInput = [
mkDocsYml
indexMd
nixosOptionsMd
homeOptionsMd
nixos-global-options
nixos-graphics-options
nixos-gaming-options
home-global-options
home-audio-options
home-graphics-options
home-gaming-options
];
nativeBuildInputs = [
mkdocs
@@ -64,8 +87,13 @@
ln -s ${mkDocsYml} "./mkdocs.yml"
mkdir docs
ln -s ${indexMd} "./docs/index.md"
ln -s ${nixosOptionsMd} "./docs/nixos-options.md"
ln -s ${homeOptionsMd} "./docs/home-options.md"
ln -s ${nixos-global-options} "./docs/nixos-global-options.md"
ln -s ${nixos-graphics-options} "./docs/nixos-graphics-options.md"
ln -s ${nixos-gaming-options} "./docs/nixos-gaming-options.md"
ln -s ${home-global-options} "./docs/home-global-options.md"
ln -s ${home-audio-options} "./docs/home-audio-options.md"
ln -s ${home-graphics-options} "./docs/home-graphics-options.md"
ln -s ${home-gaming-options} "./docs/home-gaming-options.md"
# generate the site
${if doBuild then "mkdocs build" else ""}
'';
@@ -75,24 +103,51 @@
cp -r . $out
'';
};
containerAttrs = { pkgs, port }: {
image = "docker.io/library/nginx:latest";
volumes = [
"${mkDocsDerivation { inherit pkgs; }}:/usr/share/nginx/html"
];
ports = [
"${port}:80"
];
};
in {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.documentation = let
defaultPort = "8080";
in {
enable = lib.mkOption {
type = lib.types.bool;
description = "This option enables documentation for the flake, which is generated with Material for mkDocs and hosted by nginx at localhost:${defaultPort} by default.";
default = true;
};
port = lib.mkOption {
type = lib.types.str;
description = "This option sets the port used by the nginx server hosting the local documentation site.";
default = defaultPort;
};
};
})) ];
perSystem = { pkgs, ... }: {
packages.docs = mkDocsDerivation { inherit pkgs; };
packages.docs-md = mkDocsDerivation { inherit pkgs; doBuild = false; };
};
flake.homeModules.graphics = { pkgs, ... }: {
services.podman = {
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
virtualisation.oci-containers = lib.mkIf (config.features.documentation.enable && !config.features.nixos.home-manager.enable) {
backend = "docker";
containers.flake-docs-nginx = containerAttrs { inherit (config.features.documentation) port; inherit pkgs; };
};
};
flake.homeModules.graphics = { pkgs, config, lib, ... }: {
services.podman = lib.mkIf (config.features.documentation.enable) {
enable = true;
containers.flake-docs-nginx = {
image = "docker.io/library/nginx:latest";
volumes = [
"${mkDocsDerivation { inherit pkgs; }}:/usr/share/nginx/html"
];
ports = [
"8080:80"
];
};
containers.flake-docs-nginx = containerAttrs { inherit (config.features.documentation) port; inherit pkgs; };
};
};
}
@@ -29,6 +29,10 @@
};
};
in {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "globalOptions" ({ lib, ... }: {
options.features.applications.cli.color-converter.enable = lib.mkEnableOption "`color-converter`";
})) ];
flake.nixosModules.global = { pkgs, lib, config, ... }: {
config = lib.mkIf (config.features.applications.cli.color-converter.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
home-manager.users.grey.features.applications.cli.color-converter.enable = lib.mkDefault true;
@@ -1,4 +1,8 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "globalOptions" ({ lib, ... }: {
options.features.applications.cli.fastfetch.enable = lib.mkEnableOption "`fastfetch`";
})) ];
flake.nixosModules.global = { pkgs, lib, config, ... }: {
config = lib.mkIf (config.features.applications.cli.fastfetch.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
home-manager.users.grey.features.applications.cli.fastfetch.enable = lib.mkDefault true;
+26 -10
View File
@@ -1,27 +1,43 @@
{ inputs, self, ... }: let
mkNhAttrs = flake: {
mkNhAttrs = config: {
enable = true;
inherit flake;
clean = {
enable = true;
dates = "Sun 05:00";
extraArgs = "--keep 5 --keep-since 3d";
};
flake = config.info.rootPath;
clean = config.features.applications.cli.nh.clean;
};
in {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "globalOptions" ({ lib, ... }: {
options.features.applications.cli.nh = {
enable = lib.mkEnableOption "NH: Yet another Nix CLI helper";
clean = {
enable = lib.mkEnableOption "automatic cleaning of the system with `nh clean`";
dates = lib.mkOption {
type = lib.types.str;
description = "This option defines when the cleaning job should run, in the format of [`systemd.time` calendar events](https://www.man7.org/linux/man-pages/man7/systemd.time.7.html#CALENDAR_EVENTS).";
default = "daily";
example = "Sun 05:00";
};
extraArgs = lib.mkOption {
type = lib.types.str;
description = "This option sets any extra arguments that should be passed to the `nh clean` command when it is called by this automated service.";
default = "--keep 10 --keep-since 7d";
};
};
};
})) ];
flake.nixosModules.global = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.applications.cli.nh.enable) {
programs.nh = mkNhAttrs config.info.rootPath;
programs.nh = mkNhAttrs config;
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
features.applications.cli.nh.enable = lib.mkDefault true;
features.applications.cli.nh = lib.mkDefault config.features.applications.cli.nh;
};
};
};
flake.homeModules.global = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.applications.cli.nh.enable && config.info.isStandalone) {
programs.nh = mkNhAttrs config.info.rootPath;
programs.nh = mkNhAttrs config;
};
};
}
+27 -1
View File
@@ -1,4 +1,26 @@
{ inputs, self, ... }: {
{ inputs, self, ... }: let
autostartOptionAttrs = { lib }: {
type = lib.types.bool;
description = "Controls whether an `equibop.desktop` file is generated and placed into `$XDG_CONFIG_HOME/autostart`.";
default = false;
};
in {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui.equibop.enable = lib.mkEnableOption "Equibop";
})) ];
flake.nixosModules.graphicsOption = { lib, ... }: {
options.features.applications.gui.equibop.autostart = let
attrs = autostartOptionAttrs { inherit lib; };
in lib.mkOption {
inherit (attrs) type default;
description = ''
${attrs.description}
${inputs.helpers.mkRedundantOptionDescription "features.nixos.home-manager.enable" "true"}
'';
};
};
flake.nixosModules.graphics = { pkgs, lib, config, ...}: {
config = inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
home-manager.users.grey.features.applications.gui.equibop = lib.mkDefault config.features.applications.gui.equibop;
@@ -7,6 +29,10 @@
};
};
flake.homeModules.graphicsOptions = { lib, ... }: {
options.features.applications.gui.equibop.autostart = lib.mkOption (autostartOptionAttrs { inherit lib; });
};
flake.homeModules.graphics = { pkgs, lib, config, ... }: {
config = lib.mkIf (config.features.applications.gui.equibop.enable) {
programs.equibop.enable = true;
@@ -1,4 +1,8 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui.floorp.enable = lib.mkEnableOption "Floorp Browser";
})) ];
flake.nixosModules.graphics = { pkgs, lib, config, ... }: {
config = lib.mkIf (config.features.applications.gui.floorp.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
home-manager.users.grey.features.applications.gui.floorp.enable = lib.mkDefault true;
@@ -64,6 +64,13 @@
};
};
in {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui = {
fluxer.enable = lib.mkEnableOption "Fluxer";
fluxer-canary.enable = lib.mkEnableOption "Fluxer Canary";
};
})) ];
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.applications.gui.fluxer.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
home-manager.users.grey.features.applications.gui.fluxer.enable = lib.mkDefault true;
@@ -1,4 +1,8 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui.kitty.enable = lib.mkEnableOption "Kitty Terminal";
}))];
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
config = let
in lib.mkIf (config.features.applications.gui.kitty.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
@@ -1,4 +1,8 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui.nautilus.enable = lib.mkEnableOption "Nautilus";
})) ];
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.applications.gui.nautilus.enable) {
environment.systemPackages = with pkgs; [
@@ -1,4 +1,8 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui.remmina.enable = lib.mkEnableOption "Remmina";
})) ];
flake.nixosModules.graphics = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.applications.gui.remmina.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
home-manager.users.grey.features.applications.gui.remmina.enable = lib.mkDefault true;
+31 -1
View File
@@ -1,4 +1,27 @@
{ inputs, self, ... }: {
{ inputs, self, ... }: let
spicetifyEnableOptionAttrs = { lib }: {
type = lib.types.bool;
description = "Whether to enable Spicetify, a modified version of Spotify that supports plugins and themes.";
default = false;
};
spicetifyThemeOptionAttrs = { pkgs, lib }: {
type = inputs.nixpkgs.lib.types.nullOr (inputs.nixpkgs.lib.types.enum (builtins.attrNames inputs.spicetify.legacyPackages.${pkgs.stdenv.hostPlatform.system}.themes));
description = "This option is used to select a theme for Spicetify to use, from the list of available packages themes.";
default = null;
};
in {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui.spotify.enable = lib.mkEnableOption "Spotify";
})) ];
flake.nixosModules.graphicsOptions = { lib, pkgs, ... }: {
options.features.applications.gui.spotify.spicetify = {
enable = inputs.helpers.mkRedundantOption "features.nixos.home-manager.enable" "true" (spicetifyEnableOptionAttrs { inherit lib; });
theme = inputs.helpers.mkRedundantOption "features.nixos.home-manager.enable" "true" (spicetifyThemeOptionAttrs { inherit pkgs lib; });
};
};
flake.nixosModules.graphics = { pkgs, config, lib, ... }: let
spicePkgs = inputs.spicetify.legacyPackages.${pkgs.stdenv.hostPlatform.system};
in {
@@ -12,6 +35,13 @@
});
};
flake.homeModules.graphicsOptions = { lib, pkgs, ... }: {
options.features.applications.gui.spotify.spicetify = {
enable = lib.mkOption (spicetifyEnableOptionAttrs { inherit lib; });
theme = lib.mkOption (spicetifyThemeOptionAttrs { inherit pkgs lib; });
};
};
flake.homeModules.graphics = { pkgs, config, lib, ... }: let
spicePkgs = inputs.spicetify.legacyPackages.${pkgs.stdenv.hostPlatform.system};
in {
@@ -1,4 +1,8 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.applications.gui.vscode.enable = lib.mkEnableOption "VS Code";
})) ];
flake.nixosModules.graphics = { config, pkgs, lib, ... }: {
config = lib.mkIf (config.features.applications.gui.vscode.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) {
home-manager.users.grey.features.applications.gui.vscode.enable = lib.mkDefault true;
@@ -1,4 +1,8 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "gamingOptions" ({ lib, ... }: {
options.features.hardware.steam-controller.enable = lib.mkEnableOption "tweaks and configurations that assist when using Valve's Steam Controller";
})) ];
flake.nixosModules.gaming = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.hardware.steam-controller.enable) {
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
+4
View File
@@ -3,6 +3,10 @@
inputs.home-manager.flakeModules.home-manager
];
flake.nixosModules.globalOptions = { lib, ... }: {
options.features.nixos.home-manager.enable = lib.mkEnableOption "Home Manager (as a NixOS module)";
};
flake.nixosModules.global = { pkgs, lib, config, ... }: {
imports = [
inputs.home-manager.nixosModules.default
+4
View File
@@ -1,4 +1,8 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options.features.nixos.stylix.enable = lib.mkEnableOption "Stylix";
})) ];
flake.nixosModules.graphics = { pkgs, lib, config, ... }: {
imports = [
inputs.stylix.nixosModules.stylix
@@ -1,4 +1,8 @@
{ inputs, self, ... }: {
flake.homeModules.audioOptions = { lib, ...}: {
options.features.services.easyeffects.enable = lib.mkEnableOption "Easy Effects";
};
flake.homeModules.audio = { pkgs, config, lib, ...}: {
config = lib.mkIf (config.features.services.easyeffects.enable) {
services.easyeffects.enable = true;
+8 -2
View File
@@ -1,10 +1,16 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "globalOptions" ({ lib, ... }: {
options.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";
};
})) ];
flake.nixosModules.global = { config, pkgs, lib, ... }: {
programs.${config.features.shells.defaultShell}.enable = true;
users.defaultUserShell = pkgs.${config.features.shells.defaultShell};
users.users."grey".shell = pkgs.${config.features.shells.defaultShell};
features.shells.${config.features.shells.defaultShell}.enable = true;
};
}
+9 -2
View File
@@ -1,6 +1,13 @@
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "globalOptions" ({ lib, ... }: {
options.features.shells.zsh = {
enable = lib.mkEnableOption "`zsh`";
antidote.enable = lib.mkEnableOption "Antidote, a plugin manager for `zsh`";
};
})) ];
flake.nixosModules.global = { config, pkgs, lib, ... }: {
config = lib.mkIf (config.features.shells.zsh.enable) {
config = lib.mkIf (config.features.shells.zsh.enable || config.features.shells.defaultShell == "zsh") {
programs.zsh.enable = true;
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
@@ -11,7 +18,7 @@
};
flake.homeModules.global = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.shells.zsh.enable) {
config = lib.mkIf (config.features.shells.zsh.enable || config.features.shells.defaultShell == "zsh") {
home.shell.enableZshIntegration = true;
programs.kitty.shellIntegration.enableZshIntegration = true;
+1
View File
@@ -17,6 +17,7 @@
packages = with pkgs; [
speedtest-go
bitwarden-cli
] ++ config.features.applications.extraPackages
++ (if config.info.isStandalone then [
pkgs.home-manager
+2 -5
View File
@@ -14,7 +14,7 @@
};
components = {
bootLoader = "limine";
bootLoader.selection = "limine";
displayManager = "ly";
windowManagers = "niri";
shells = "noctalia";
@@ -26,10 +26,7 @@
stylix.enable = true;
};
shells.zsh = {
enable = true;
antidote.enable = true;
};
shells.zsh.antidote.enable = true;
applications = {
gui = {
+30
View File
@@ -0,0 +1,30 @@
{ inputs, self, ... }: {
flake.nixosConfigurations.sakamoto = inputs.nixpkgs.lib.nixosSystem {
modules = with self.nixosModules; [
global
sakamoto
];
};
flake.nixosModules.sakamoto = { pkgs, config, lib, ... }: {
info = {
hostName = "sakamoto";
stateVersion = "26.11";
};
components.bootLoader = {
selection = "grub";
timeout = 0;
};
features = {
shells.defaultShell = "bash";
applications = {
cli = {
nh.enable = true;
};
};
};
};
}
+1 -4
View File
@@ -35,10 +35,7 @@
};
features = {
shells.zsh = {
enable = true;
antidote.enable = true;
};
shells.zsh.antidote.enable = true;
services = {
easyeffects.enable = true;
-5
View File
@@ -1,5 +0,0 @@
{ inputs, self, ... }: {
flake.homeModules.audioOptions = { lib, ...}: {
options.features.services.easyeffects.enable = lib.mkEnableOption "easyeffects";
};
}
-17
View File
@@ -1,17 +0,0 @@
{ inputs, self, ... }: {
flake.nixosModules.gamingOptions = { lib, ... }: {
options.features.hardware.steam-controller.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable tweaks and configurations that assist when using Valve's Steam Controller";
};
};
flake.homeModules.gamingOptions = { lib, ... }: {
options.features.hardware.steam-controller.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable tweaks and configurations that assist when using Valve's Steam Controller";
};
};
}
+40 -57
View File
@@ -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 = {};
};
};
};
+19 -74
View File
@@ -1,82 +1,27 @@
{ inputs, self, ... }: let
mkSharedGraphicsOptions = { pkgs, lib }: {
components = {
windowManagers = lib.mkOption {
type = inputs.helpers.mkOptionalListOfType (inputs.helpers.mkEnumFromDirContents "${self}/modules/components/window-managers");
description = "This option defines the window manager(s) that should be installed, enabling any config associated with it in the process. It can be either a list or just one value.";
default = [];
};
shells = lib.mkOption {
type = inputs.helpers.mkOptionalListOfType (inputs.helpers.mkEnumFromDirContents "${self}/modules/components/shells");
description = "This option defines the graphical shell(s) that should be installed (e.g. Noctalia, DMS), enabling any config associated with it in the process. It can be either a list or just one value.";
default = [];
};
};
features = {
applications.gui = {
equibop = {
enable = lib.mkEnableOption "equibop";
autostart = lib.mkOption {
type = lib.types.bool;
description = "This option controls whether an `equibop.desktop` file is generated and placed into `$XDG_CONFIG_HOME/autostart`.";
default = false;
};
{ inputs, self, ... }: {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "graphicsOptions" ({ lib, ... }: {
options = {
components = {
windowManagers = lib.mkOption {
type = inputs.helpers.mkOptionalListOfType (inputs.helpers.mkEnumFromDirContents "${self}/modules/components/window-managers");
description = "This option defines the window manager(s) that should be installed, enabling any config associated with it in the process. It can be either a list or just one value.";
default = [];
};
floorp.enable = lib.mkEnableOption "floorp";
fluxer.enable = lib.mkEnableOption "fluxer";
fluxer-canary.enable = lib.mkEnableOption "fluxer-canary";
kitty.enable = lib.mkEnableOption "kitty";
nautilus.enable = lib.mkEnableOption "nautilus";
remmina.enable = lib.mkEnableOption "remmina";
spotify = {
enable = lib.mkEnableOption "spotify";
spicetify = {
enable = lib.mkEnableOption "spicetify";
theme = lib.mkOption {
type = lib.types.nullOr (lib.types.enum (builtins.attrNames inputs.spicetify.legacyPackages.${pkgs.stdenv.hostPlatform.system}.themes));
description = "This option is used to select a theme for Spicetify to use, from the list of available packages themes.";
default = null;
};
};
};
vscode.enable = lib.mkEnableOption "vscode";
};
nixos.stylix.enable = lib.mkEnableOption "stylix";
};
};
redundantOptionWarn = name: value: "The functionality of this option completely depends on `${name}` being `${value}`, and will not be evaluated otherwise.";
in {
flake.nixosModules.graphicsOptions = { pkgs, lib, ... }: {
options = (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }) // {
components = (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }).components // {
displayManager = lib.mkOption {
type = inputs.helpers.mkEnumFromDirContents "${self}/modules/components/display-managers";
description = "This option defines the bootloader that should be used, enabling any config associated with it in the process.";
default = "lightdm";
shells = lib.mkOption {
type = inputs.helpers.mkOptionalListOfType (inputs.helpers.mkEnumFromDirContents "${self}/modules/components/shells");
description = "This option defines the graphical shell(s) that should be installed (e.g. Noctalia, DMS), enabling any config associated with it in the process. It can be either a list or just one value.";
default = [];
};
};
features = (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }).features // {
applications.gui = {
equibop.enable.description = (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }).features.applications.gui.equibop.enable.description + "\n" + (redundantOptionWarn "features.nixos.home-manager.enable" "true");
spotify.spicetify.theme.description = (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }).features.applications.gui.spotify.spicetify.theme.description + "\n" + (redundantOptionWarn "features.nixos.home-manager.enable" "true");
} // (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }).features.applications.gui;
};
};
};
})) ];
flake.homeModules.graphicsOptions = { pkgs, lib, ... }: {
options = mkSharedGraphicsOptions { inherit pkgs; inherit lib; };
flake.nixosModules.graphicsOptions = { lib, ... }: {
options.components.displayManager = lib.mkOption {
type = inputs.helpers.mkEnumFromDirContents "${self}/modules/components/display-managers";
description = "This option defines the bootloader that should be used, enabling any config associated with it in the process.";
default = "lightdm";
};
};
}
-18
View File
@@ -1,18 +0,0 @@
{ inputs, self, ... }: {
flake.nixosModules.options = { ... }: {
imports = with self.nixosModules; [
globalOptions
graphicsOptions
gamingOptions
];
};
flake.homeModules.options = { ... }: {
imports = with self.homeModules; [
globalOptions
audioOptions
graphicsOptions
gamingOptions
];
};
}