create auto upgrade module
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
}: let
|
||||
cfg = config.myConfig;
|
||||
in {
|
||||
imports = [./bootloader.nix ./locale.nix ./greetd.nix ./rebuild.nix ./sops.nix ./sway.nix ./wifi.nix ./music.nix ./cups.nix ./gpu/amd.nix ./touch.nix ./cache.nix ./nix.nix];
|
||||
imports = [./bootloader.nix ./locale.nix ./greetd.nix ./rebuild.nix ./sops.nix ./sway.nix ./wifi.nix ./music.nix ./cups.nix ./gpu/amd.nix ./touch.nix ./cache.nix ./nix.nix ./update.nix];
|
||||
|
||||
options.myConfig = {
|
||||
enable = lib.mkEnableOption "my custom config";
|
||||
@ -18,6 +18,7 @@ in {
|
||||
locale.enable = true;
|
||||
rebuild.enable = true;
|
||||
cache.enable = true;
|
||||
autoUpdate.enable = true;
|
||||
|
||||
greetd.enable = lib.mkIf cfg.desktop true;
|
||||
sway.enable = lib.mkIf cfg.desktop true;
|
||||
|
33
modules/nixos/update.nix
Normal file
33
modules/nixos/update.nix
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.myConfig.autoUpdate;
|
||||
in {
|
||||
options.myConfig.autoUpdate = {
|
||||
enable = lib.mkEnableOption "extra binary caches";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
system.autoUpgrade = {
|
||||
enable = true;
|
||||
flake = inputs.self.outPath;
|
||||
flags = [
|
||||
"--recreate-lock-file"
|
||||
"--commit-lock-file"
|
||||
"-L"
|
||||
];
|
||||
dates = "9:00";
|
||||
randomizedDelaySec = "45min";
|
||||
};
|
||||
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "10:00";
|
||||
randomizedDelaySec = "45min";
|
||||
options = "--delete-older-than 14d";
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user