profiles/system: add auto-upgrade option

This commit is contained in:
Gabriel Arazas 2022-04-17 00:17:19 +08:00
parent 99050bc806
commit 9f6cef56f8
3 changed files with 21 additions and 4 deletions

View File

@ -98,6 +98,7 @@
specialArgs = {
inherit system inputs self;
lib = nixpkgs.lib.extend (final: prev: import ./lib { lib = prev; });
selfPath = ./.;
};
config = {
@ -164,9 +165,8 @@
in {
inherit system;
specialArgs = {
extraSpecialArgs = {
inherit system self;
lib = nixpkgs.lib.extend (final: prev: import ./lib { lib = prev; });
};
extraModules = [{

View File

@ -18,6 +18,7 @@
fonts.enable = true;
hardware.enable = true;
cleanup.enable = true;
autoUpgrade.enable = true;
wine.enable = true;
};
dev = {

View File

@ -1,7 +1,7 @@
# This is where extra desktop goodies can be found.
# As a note, this is not where you set the aesthetics of your graphical sessions.
# That can be found in the `themes` module.
{ inputs, config, options, lib, pkgs, ... }:
{ inputs, config, options, lib, pkgs, selfPath, ... }:
let cfg = config.profiles.system;
in {
@ -14,6 +14,7 @@ in {
hardware.enable =
lib.mkEnableOption "the common hardware-related configuration";
cleanup.enable = lib.mkEnableOption "activation of cleanup services";
autoUpgrade.enable = lib.mkEnableOption "auto-upgrade service with this system";
wine = {
enable = lib.mkEnableOption "Wine and Wine-related tools";
package = lib.mkOption {
@ -36,7 +37,7 @@ in {
};
# Enable font-related options for more smoother and consistent experience.
fonts.enableDefaultFonts = true;
fonts.fontconfig.enable = true;
# Run unpatched binaries with these!
environment.systemPackages = with pkgs; [
@ -147,6 +148,21 @@ in {
};
})
(lib.mkIf cfg.autoUpgrade.enable {
system.autoUpgrade = {
enable = true;
flake = builtins.toString selfPath;
allowReboot = true;
rebootWindow = {
lower = "22:00";
upper = "00:00";
};
dates = "weekly";
flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ];
randomizedDelaySec = "30min";
};
})
# I try to avoid using Wine on NixOS because most of them uses FHS or something and I just want it to work but here goes.
(lib.mkIf cfg.wine.enable {
environment.systemPackages = with pkgs; [