2024-08-23 17:39:18 +00:00
|
|
|
{ lib, ... }:
|
|
|
|
let
|
|
|
|
inherit (lib)
|
|
|
|
mkOption
|
|
|
|
types
|
|
|
|
;
|
|
|
|
|
|
|
|
themeType = types.submodule (
|
|
|
|
{ config, ... }: {
|
|
|
|
options = {
|
2024-08-23 17:42:27 +00:00
|
|
|
source = mkOption {
|
2024-08-23 17:39:18 +00:00
|
|
|
type = types.nullOr types.path;
|
|
|
|
description = "The path to the oh-my-posh theme to use.";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = "The name of the theme.";
|
2024-08-23 17:42:27 +00:00
|
|
|
default = if (config.source != null)
|
2024-08-23 17:39:18 +00:00
|
|
|
then
|
2024-08-23 17:42:27 +00:00
|
|
|
lib.strings.removeSuffix ".omp" (lib.strings.removeSuffix ".json" (builtins.baseNameOf config.source))
|
2024-08-23 17:39:18 +00:00
|
|
|
else
|
|
|
|
null;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
ompType = types.submodule (
|
|
|
|
{ config, ... }: {
|
|
|
|
options = {
|
|
|
|
theme = mkOption {
|
|
|
|
type = types.either types.str themeType;
|
|
|
|
description = "The default theme.";
|
|
|
|
default = {};
|
|
|
|
};
|
|
|
|
|
|
|
|
additionalThemes = mkOption {
|
|
|
|
type = types.listOf themeType;
|
|
|
|
description = "A set of additional themes to install.";
|
|
|
|
default = [];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
valhalla.users = mkOption {
|
|
|
|
type = types.attrsOf (types.submodule (
|
|
|
|
{ ... }: {
|
|
|
|
options = {
|
|
|
|
oh-my-posh = mkOption {
|
|
|
|
type = ompType;
|
|
|
|
description = "The Oh My Posh configuration to apply.";
|
|
|
|
default = {};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|