diff --git a/flake.nix b/flake.nix index 0a48da4b..6e352e1a 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = [{ diff --git a/hosts/ni/default.nix b/hosts/ni/default.nix index 85a20f8b..021bd90d 100644 --- a/hosts/ni/default.nix +++ b/hosts/ni/default.nix @@ -18,6 +18,7 @@ fonts.enable = true; hardware.enable = true; cleanup.enable = true; + autoUpgrade.enable = true; wine.enable = true; }; dev = { diff --git a/modules/nixos/profiles/system.nix b/modules/nixos/profiles/system.nix index 43aee334..c52d7ecf 100644 --- a/modules/nixos/profiles/system.nix +++ b/modules/nixos/profiles/system.nix @@ -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; [