mirror of
https://github.com/nix-community/home-manager
synced 2024-12-24 10:49:48 +01:00
topgrade: add module (#1924)
This commit is contained in:
parent
55ef8d3a10
commit
137a584e22
9 changed files with 130 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -150,6 +150,9 @@
|
|||
|
||||
/modules/programs/texlive.nix @rycee
|
||||
|
||||
/modules/programs/topgrade.nix @msfjarvis
|
||||
/tests/modules/programs/topgrade @msfjarvis
|
||||
|
||||
/modules/programs/waybar.nix @berbiche
|
||||
/tests/modules/programs/waybar @berbiche
|
||||
|
||||
|
|
|
@ -71,4 +71,14 @@
|
|||
githubId = 46252070;
|
||||
name = "Sara Johnsson";
|
||||
};
|
||||
msfjarvis = {
|
||||
email = "me@msfjarvis.dev";
|
||||
github = "msfjarvis";
|
||||
githubId = "13348378";
|
||||
name = "Harsh Shandilya";
|
||||
keys = [{
|
||||
longkeyid = "rsa4096/0xB7843F823355E9B9";
|
||||
fingerprint = "8F87 050B 0F9C B841 1515 7399 B784 3F82 3355 E9B9";
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1921,6 +1921,14 @@ in
|
|||
A new service is available: 'services.mpris-proxy'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2021-04-28T12:00:00+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.topgrade'.
|
||||
'';
|
||||
}
|
||||
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -127,6 +127,7 @@ let
|
|||
(loadModule ./programs/termite.nix { })
|
||||
(loadModule ./programs/texlive.nix { })
|
||||
(loadModule ./programs/tmux.nix { })
|
||||
(loadModule ./programs/topgrade.nix { })
|
||||
(loadModule ./programs/urxvt.nix { })
|
||||
(loadModule ./programs/vim.nix { })
|
||||
(loadModule ./programs/vscode.nix { })
|
||||
|
|
60
modules/programs/topgrade.nix
Normal file
60
modules/programs/topgrade.nix
Normal file
|
@ -0,0 +1,60 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.topgrade;
|
||||
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
|
||||
in {
|
||||
|
||||
meta.maintainers = [ hm.maintainers.msfjarvis ];
|
||||
|
||||
options.programs.topgrade = {
|
||||
enable = mkEnableOption "topgrade";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.topgrade;
|
||||
defaultText = literalExample "pkgs.topgrade";
|
||||
description = "The package to use for the topgrade binary.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = { };
|
||||
defaultText = literalExample "{ }";
|
||||
example = literalExample ''
|
||||
{
|
||||
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
|
||||
<filename>~/.config/topgrade.toml</filename>.
|
||||
</para><para>
|
||||
See <link xlink:href="https://github.com/r-darwish/topgrade/wiki/Step-list" /> for the full list
|
||||
of options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."topgrade.toml" = mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "topgrade-config" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -76,6 +76,7 @@ import nmt {
|
|||
./modules/programs/starship
|
||||
./modules/programs/texlive
|
||||
./modules/programs/tmux
|
||||
./modules/programs/topgrade
|
||||
./modules/programs/vscode
|
||||
./modules/programs/zplug
|
||||
./modules/programs/zsh
|
||||
|
|
1
tests/modules/programs/topgrade/default.nix
Normal file
1
tests/modules/programs/topgrade/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ topgrade-settings = ./settings.nix; }
|
8
tests/modules/programs/topgrade/settings-expected.toml
Normal file
8
tests/modules/programs/topgrade/settings-expected.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
cleanup = true
|
||||
disable = ["sdkman", "flutter", "node", "nix", "home_manager"]
|
||||
remote_topgrade_path = "bin/topgrade"
|
||||
remote_topgrades = ["backup", "ci"]
|
||||
set_title = false
|
||||
|
||||
[commands]
|
||||
"Purge unused APT packages" = "sudo apt autoremove"
|
38
tests/modules/programs/topgrade/settings.nix
Normal file
38
tests/modules/programs/topgrade/settings.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.topgrade = {
|
||||
enable = true;
|
||||
|
||||
settings = mkMerge [
|
||||
{
|
||||
disable = [ "sdkman" "flutter" "node" "nix" "home_manager" ];
|
||||
|
||||
remote_topgrades = [ "backup" "ci" ];
|
||||
|
||||
remote_topgrade_path = "bin/topgrade";
|
||||
}
|
||||
|
||||
{
|
||||
set_title = false;
|
||||
cleanup = true;
|
||||
|
||||
commands = { "Purge unused APT packages" = "sudo apt autoremove"; };
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: { topgrade = pkgs.writeScriptBin "dummy-topgrade" ""; })
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/topgrade.toml \
|
||||
${./settings-expected.toml}
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue