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