mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
`literalExpression` is intended just to signify code that needs to stay a string that gets represented exactly as-is for docs. It has been misused heavily and people get confused repeatedly on when or not to use it because of the rampant misuse.
57 lines
1.2 KiB
Nix
57 lines
1.2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.programs.topgrade;
|
|
|
|
tomlFormat = pkgs.formats.toml { };
|
|
in
|
|
{
|
|
|
|
meta.maintainers = [ lib.hm.maintainers.msfjarvis ];
|
|
|
|
options.programs.topgrade = {
|
|
enable = lib.mkEnableOption "topgrade";
|
|
|
|
package = lib.mkPackageOption pkgs "topgrade" { };
|
|
|
|
settings = lib.mkOption {
|
|
inherit (tomlFormat) type;
|
|
default = { };
|
|
defaultText = lib.literalExpression "{ }";
|
|
example = {
|
|
misc = {
|
|
assume_yes = true;
|
|
disable = [
|
|
"flutter"
|
|
"node"
|
|
];
|
|
set_title = false;
|
|
cleanup = true;
|
|
};
|
|
commands = {
|
|
"Run garbage collection on Nix store" = "nix-collect-garbage";
|
|
};
|
|
};
|
|
description = ''
|
|
Configuration written to
|
|
{file}`$XDG_CONFIG_HOME/topgrade.toml`.
|
|
|
|
See <https://github.com/r-darwish/topgrade/wiki/Step-list> for the full list
|
|
of options.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
home.packages = [ cfg.package ];
|
|
|
|
xdg.configFile."topgrade.toml" = lib.mkIf (cfg.settings != { }) {
|
|
source = tomlFormat.generate "topgrade-config" cfg.settings;
|
|
};
|
|
};
|
|
}
|