1
0
Fork 0

Nix: tweak retention options and defaults

This commit is contained in:
Aires 2024-12-07 12:46:48 -05:00
parent 9a15ed6ff1
commit 992a479496
6 changed files with 12 additions and 20 deletions

View file

@ -16,7 +16,7 @@
];
# Install the nos helper script
nixos-operations-script.enable = true;
nix.nixos-operations-script.enable = true;
};
programs = {

View file

@ -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 = {

View file

@ -10,23 +10,21 @@
}:
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.";
options.${namespace}.nix = {
retention = lib.mkOption {
description = "How long to retain NixOS generations. Defaults to two weeks.";
type = lib.types.str;
default = "monthly";
default = "14d";
};
nixos-operations-script.enable = lib.mkEnableOption "Installs the nos (nixos-operations-script) helper script.";
};
};
config = lib.mkMerge [
{
nix = {
@ -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";
};

View file

@ -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;

View file

@ -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;

View file

@ -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;