{ lib, ... }: let inherit (lib) mkEnableOption mkOption types; themeType = types.submodule ( { config, ... }: { options = { source = mkOption { type = types.path; description = "The path to the oh-my-posh theme to use."; }; name = mkOption { type = types.nullOr types.str; description = "The name of the theme."; default = lib.strings.removeSuffix ".omp" (lib.strings.removeSuffix ".json" (builtins.baseNameOf config.source)); }; }; }); commonOptions = { enable = mkEnableOption "Oh My Posh"; }; userOptions = commonOptions // { theme = mkOption { type = types.nullOr (types.either types.str themeType); description = "The default theme."; default = null; }; additionalThemes = mkOption { type = types.listOf themeType; description = "A set of additional themes to install."; default = [ ]; }; }; in { options = { valhalla = { programs.oh-my-posh = commonOptions; users = mkOption { type = types.attrsOf (types.submodule ( { ... }: { options = { programs.oh-my-posh = userOptions; }; })); }; }; }; }