move options back out to their config files, improve documentation

This commit is contained in:
greyweather committed 2026-09-02 00:05:28 +01:00
1 parent 70ac7954ad
commit 9c13923c2e
30 files changed
+344 -233

No files matched your search

+26 -10
View File
@@ -1,27 +1,43 @@
{ inputs, self, ... }: let
mkNhAttrs = flake: {
mkNhAttrs = config: {
enable = true;
inherit flake;
clean = {
enable = true;
dates = "Sun 05:00";
extraArgs = "--keep 5 --keep-since 3d";
};
flake = config.info.rootPath;
clean = config.features.applications.cli.nh.clean;
};
in {
imports = [ (inputs.helpers.mkMirroredModulesFlakeModule "globalOptions" ({ lib, ... }: {
options.features.applications.cli.nh = {
enable = lib.mkEnableOption "NH: Yet another Nix CLI helper";
clean = {
enable = lib.mkEnableOption "automatic cleaning of the system with `nh clean`";
dates = lib.mkOption {
type = lib.types.str;
description = "This option defines when the cleaning job should run, in the format of [`systemd.time` calendar events](https://www.man7.org/linux/man-pages/man7/systemd.time.7.html#CALENDAR_EVENTS).";
default = "daily";
example = "Sun 05:00";
};
extraArgs = lib.mkOption {
type = lib.types.str;
description = "This option sets any extra arguments that should be passed to the `nh clean` command when it is called by this automated service.";
default = "--keep 10 --keep-since 7d";
};
};
};
})) ];
flake.nixosModules.global = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.applications.cli.nh.enable) {
programs.nh = mkNhAttrs config.info.rootPath;
programs.nh = mkNhAttrs config;
home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) {
features.applications.cli.nh.enable = lib.mkDefault true;
features.applications.cli.nh = lib.mkDefault config.features.applications.cli.nh;
};
};
};
flake.homeModules.global = { pkgs, config, lib, ... }: {
config = lib.mkIf (config.features.applications.cli.nh.enable && config.info.isStandalone) {
programs.nh = mkNhAttrs config.info.rootPath;
programs.nh = mkNhAttrs config;
};
};
}