Skip to content

Instantly share code, notes, and snippets.

@blueforesticarus
Created July 21, 2022 02:14
Show Gist options
  • Save blueforesticarus/b2168a9f224653afda192d20600e9e40 to your computer and use it in GitHub Desktop.
Save blueforesticarus/b2168a9f224653afda192d20600e9e40 to your computer and use it in GitHub Desktop.
{ 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";
};
};
};
}
@blueforesticarus
Copy link
Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment