create auto upgrade module

This commit is contained in:
Max Känner 2024-12-28 22:26:31 +01:00
parent 3a7334c3b9
commit c16865a048
3 changed files with 35 additions and 50 deletions

View File

@ -79,18 +79,7 @@
montserrat montserrat
]; ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
programs.ssh.startAgent = true; programs.ssh.startAgent = true;
programs.nix-ld.enable = true;
programs.nix-ld.libraries = [
];
programs.zsh.enable = true; programs.zsh.enable = true;
programs.steam.enable = true; programs.steam.enable = true;
@ -144,9 +133,6 @@
game-devices-udev-rules game-devices-udev-rules
android-udev-rules android-udev-rules
]; ];
extraRules = ''
ACTION=="add", KERNEL=="event[0-9]*", DEVPATH="/devices/platform/AMDI0010:02/i2c-2/i2c-ELAN2513:00/0018:04F3:2D9C.0001/input/input[0-9]*/event[0-9]*", SYMLINK+="touchscreen0"
'';
}; };
services.pipewire = { services.pipewire = {
@ -156,43 +142,8 @@
pulse.enable = true; pulse.enable = true;
}; };
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
system.autoUpgrade = {
enable = true;
flake = inputs.self.outPath;
flags = [
"--update-input"
"nixpkgs"
"--update-input"
"home-manager"
"--update-input"
"sops-nix"
"--update-input"
"musnix"
"--commit-lock-file"
"-L"
];
dates = "daily";
randomizedDelaySec = "45min";
};
boot.binfmt.emulatedSystems = ["aarch64-linux"]; boot.binfmt.emulatedSystems = ["aarch64-linux"];
nix.gc = {
automatic = true;
dates = "10:00";
randomizedDelaySec = "45min";
options = "--delete-older-than 14d";
};
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave # on your system were taken. Its perfectly fine and recommended to leave

View File

@ -5,7 +5,7 @@
}: let }: let
cfg = config.myConfig; cfg = config.myConfig;
in { 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 = { options.myConfig = {
enable = lib.mkEnableOption "my custom config"; enable = lib.mkEnableOption "my custom config";
@ -18,6 +18,7 @@ in {
locale.enable = true; locale.enable = true;
rebuild.enable = true; rebuild.enable = true;
cache.enable = true; cache.enable = true;
autoUpdate.enable = true;
greetd.enable = lib.mkIf cfg.desktop true; greetd.enable = lib.mkIf cfg.desktop true;
sway.enable = lib.mkIf cfg.desktop true; sway.enable = lib.mkIf cfg.desktop true;

33
modules/nixos/update.nix Normal file
View 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";
};
};
}