Created
July 21, 2022 02:14
-
-
Save blueforesticarus/b2168a9f224653afda192d20600e9e40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, ... }: | |
{ | |
systemd = { | |
services.nixos-update-prebuild = { | |
serviceConfig.Type = "oneshot"; | |
environment.PATH = lib.mkForce "/run/current-system/sw/bin"; | |
script = '' | |
source /etc/profile | |
mkdir -p /var/lib/nixos-update-prebuild | |
cd /var/lib/nixos-update-prebuild | |
nixos-rebuild --upgrade dry-activate | |
''; | |
/* todo: send notification when update would change something */ | |
}; | |
timers.nixos-update-prebuild = { | |
wantedBy = [ "timers.target" ]; | |
partOf = [ "nixos-update-prebuild.service" ]; | |
timerConfig = { | |
OnCalendar = "hourly"; | |
Unit = "nixos-update-prebuild.service"; | |
}; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wrote this so that I wouldn't have to wait eons waiting for things to download and build when running update-switch.
Would be cool to add something that sends a notification when rebuild would actually do something, and what it would do. Maybe with a little button to execute the switch (if you can even do that in the notification system).