Nix: tweak retention options and defaults
This commit is contained in:
parent
9a15ed6ff1
commit
992a479496
|
@ -16,7 +16,7 @@
|
|||
];
|
||||
|
||||
# Install the nos helper script
|
||||
nixos-operations-script.enable = true;
|
||||
nix.nixos-operations-script.enable = true;
|
||||
};
|
||||
|
||||
programs = {
|
||||
|
|
|
@ -59,7 +59,7 @@ in
|
|||
];
|
||||
|
||||
# Deploy update script
|
||||
${namespace}.nixos-operations-script.enable = true;
|
||||
${namespace}.nix.nixos-operations-script.enable = true;
|
||||
|
||||
# Pull and apply updates.
|
||||
systemd = {
|
||||
|
|
|
@ -10,22 +10,20 @@
|
|||
}:
|
||||
|
||||
let
|
||||
cfg = config.${namespace};
|
||||
cfg = config.${namespace}.nix;
|
||||
|
||||
nixos-operations-script = pkgs.writeShellScriptBin "nixos-operations-script" (
|
||||
builtins.readFile (lib.snowfall.fs.get-file "bin/nixos-operations-script.sh")
|
||||
);
|
||||
in
|
||||
{
|
||||
options = {
|
||||
${namespace} = {
|
||||
retentionPeriod = lib.mkOption {
|
||||
description = "How long to retain NixOS generations. Defaults to one month.";
|
||||
type = lib.types.str;
|
||||
default = "monthly";
|
||||
};
|
||||
nixos-operations-script.enable = lib.mkEnableOption "Installs the nos (nixos-operations-script) helper script.";
|
||||
options.${namespace}.nix = {
|
||||
retention = lib.mkOption {
|
||||
description = "How long to retain NixOS generations. Defaults to two weeks.";
|
||||
type = lib.types.str;
|
||||
default = "14d";
|
||||
};
|
||||
nixos-operations-script.enable = lib.mkEnableOption "Installs the nos (nixos-operations-script) helper script.";
|
||||
};
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
|
@ -82,7 +80,7 @@ in
|
|||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than ${cfg.retentionPeriod}";
|
||||
options = "--delete-older-than ${cfg.retention}";
|
||||
persistent = true;
|
||||
randomizedDelaySec = "1hour";
|
||||
};
|
||||
|
|
|
@ -114,9 +114,6 @@ in
|
|||
mailAddr = config.secrets.users.aires.email;
|
||||
};
|
||||
|
||||
# Change how long old generations are kept for.
|
||||
retentionPeriod = "30d";
|
||||
|
||||
services = {
|
||||
acme = {
|
||||
enable = true;
|
||||
|
|
|
@ -41,9 +41,6 @@ in
|
|||
# Enable support for primary RAID array (just in case)
|
||||
raid.storage.enable = true;
|
||||
|
||||
# Change how long old generations are kept for.
|
||||
retentionPeriod = "14d";
|
||||
|
||||
services = {
|
||||
autoUpgrade = {
|
||||
enable = true;
|
||||
|
|
|
@ -55,8 +55,8 @@ in
|
|||
# Enable support for primary RAID array (just in case)
|
||||
raid.storage.enable = true;
|
||||
|
||||
# Keep old generations for two weeks.
|
||||
retentionPeriod = "14d";
|
||||
# Keep one week of generations.
|
||||
nix.retention = "7d";
|
||||
|
||||
powerManagement.enable = true;
|
||||
|
||||
|
|
Loading…
Reference in a new issue