Move autoUpgrade back to flake.nix but use flake output instead of URL

Set autoUpgrade flake to current flake outpath but keeping nixpkgs
update, means things won't automatically be rolled back if there's no
internet connection. Keep using remote URL for server though to keep
unattended updates.
This commit is contained in:
Evie Litherland-Smith 2024-02-26 08:12:26 +00:00
parent b7a21f3377
commit 78f7af88a8
3 changed files with 37 additions and 26 deletions

View file

@ -14,6 +14,7 @@
};
outputs = {
self,
nixpkgs,
home-manager,
stylix,
@ -42,7 +43,11 @@
./hosts/${hostName}/configuration.nix
./hosts/${hostName}/hardware-configuration.nix
./system/default.nix
({pkgs, ...}: {
({
lib,
pkgs,
...
}: {
nix = {
enable = true;
settings = {
@ -66,9 +71,22 @@
'';
};
nixpkgs.config.allowUnfree = true;
system = {inherit stateVersion;};
networking = {inherit hostName;};
programs.${shell}.enable = true;
system = {
inherit stateVersion;
autoUpgrade = {
enable = true;
flake = lib.mkDefault self.outPath;
flags = [
"--update-input"
"nixpkgs"
"--no-write-lock-file"
"-L" # print build logs
];
dates = "02:00";
};
};
users = {
defaultUserShell = pkgs.${shell};
users = let
@ -139,7 +157,6 @@
systemConfig {
inherit hostName user system;
systemModules = [
./system/autoupgrade.nix
./services/caddy.nix
./services/gitea.nix
./services/grafana.nix
@ -147,7 +164,9 @@
./services/sshd.nix
./services/syncthing.nix
];
homeModules = [./home/default.nix];
homeModules = [
./home/default.nix
];
};
## Personal
@ -164,7 +183,9 @@
./system/hyprland.nix
./system/games.nix
];
homeModules = [./home/hyprland/default.nix];
homeModules = [
./home/hyprland/default.nix
];
};
Vanguard = let
@ -175,11 +196,12 @@
systemConfig {
inherit hostName user system;
systemModules = [
./system/autoupgrade.nix
./system/hyprland.nix
./system/games.nix
];
homeModules = [./home/hyprland/default.nix];
homeModules = [
./home/hyprland/default.nix
];
};
## Work
@ -195,7 +217,9 @@
./system/laptop.nix
./system/hyprland.nix
];
homeModules = [./home/hyprland/default.nix];
homeModules = [
./home/hyprland/default.nix
];
};
Scorch = let
@ -206,10 +230,11 @@
systemConfig {
inherit hostName user system;
systemModules = [
./system/autoupgrade.nix
./system/hyprland.nix
];
homeModules = [./home/hyprland/default.nix];
homeModules = [
./home/hyprland/default.nix
];
};
};
};

View file

@ -1,6 +1,7 @@
{...}: {
{config, ...}: {
users.mutableUsers = false;
system.autoUpgrade = {
flake = "git+${config.nix.registry.nixos.to.url}";
randomizedDelaySec = "15min";
allowReboot = true;
rebootWindow = {

View file

@ -1,15 +0,0 @@
{config, ...}: let
flakeURL = config.nix.registry.nixos.to.url;
in {
system.autoUpgrade = {
enable = true;
flake = "git+${flakeURL}";
flags = [
"--update-input"
"nixpkgs"
"--no-write-lock-file"
"-L" # print build logs
];
dates = "02:00";
};
}