1 { config, lib, pkgs, ... }:
3 let cfg = config.system.autoUpgradeWithPinch;
6 system.autoUpgradeWithPinch = {
12 Whether to periodically upgrade NixOS to the latest version.
13 Presumes that /etc/nixos is a git repo with a remote and
14 contains a pinch file called "channels".
22 Specification (in the format described by
23 <citerefentry><refentrytitle>systemd.time</refentrytitle>
24 <manvolnum>7</manvolnum></citerefentry>) of the time at
25 which the update will occur.
32 GPG key that signs updates. Updates are only merged if the commit
33 at the tip of the remote branch is signed with this key.
39 config = lib.mkIf cfg.enable {
41 (import ../overlays/keyedgit.nix)
42 (import ../overlays/pinch.nix)
44 systemd.services.nixos-upgrade = {
45 description = "NixOS Upgrade";
46 restartIfChanged = false;
47 unitConfig.X-StopOnRemoval = false;
48 serviceConfig.Type = "oneshot";
49 environment = config.nix.envVars // {
50 inherit (config.environment.sessionVariables) NIX_PATH;
52 } // config.networking.proxy.envVars;
55 config.nix.package.out
68 # Chill for awhile before applying updates. If applying an update
69 # badly breaks things, we want a window in which an operator can
70 # intervene either to fix the problem or disable automatic updates.
75 ${pkgs.keyedgit cfg.key}/bin/git pull --ff-only --verify-signatures
79 ${config.system.build.nixos-rebuild}/bin/nixos-rebuild switch --no-build-output