1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00
home-manager/modules/programs/clock-rs.nix
Austin Horstman 86402a17b6 treewide: flatten single file modules
Some files don't need nesting and can be root level again to reduce
conflicts with other PRs.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-06-23 16:20:26 -05:00

62 lines
1.3 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.clock-rs;
tomlFormat = pkgs.formats.toml { };
in
{
meta.maintainers = with lib.maintainers; [ oughie ];
options.programs.clock-rs = {
enable = lib.mkEnableOption "clock-rs";
package = lib.mkPackageOption pkgs "clock-rs" { nullable = true; };
settings = lib.mkOption {
type = tomlFormat.type;
default = { };
description = "The configuration file to be used for clock-rs";
example = lib.literalExpression ''
general = {
color = "magenta";
interval = 250;
blink = true;
bold = true;
};
position = {
horizontal = "start";
vertical = "end";
};
date = {
fmt = "%A, %B %d, %Y";
use_12h = true;
utc = true;
hide_seconds = true;
};
'';
};
};
config = lib.mkIf cfg.enable {
home =
let
configDir =
if pkgs.stdenv.hostPlatform.isDarwin then "Library/Application Support" else config.xdg.configHome;
in
{
packages = lib.mkIf (cfg.package != null) [ cfg.package ];
file."${configDir}/clock-rs/conf.toml" = lib.mkIf (cfg.settings != { }) {
source = tomlFormat.generate "clock-rs-config" cfg.settings;
};
};
};
}