File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 1- { pkgs , lib , ... } :
1+ {
2+ pkgs ,
3+ lib ,
4+ config ,
5+ ...
6+ } :
27
38{
49 my . system . autoUpgrade = {
712 flake = "github:LorenzBischof/nixfiles" ;
813 } ;
914
10- systemd . services = {
15+ systemd . services = lib . mkIf config . my . system . autoUpgrade . enabled {
1116 nixos-upgrade = {
1217 onSuccess = [ "notify-upgrade-success.service" ] ;
1318 onFailure = [ "notify-upgrade-failure.service" ] ;
Original file line number Diff line number Diff line change 1919 `nixos-rebuild switch` once a day.
2020 '' ;
2121 } ;
22+ enabled = lib . mkOption {
23+ type = lib . types . bool ;
24+ readOnly = true ;
25+ default = cfg . enable && ( builtins . hasAttr "rev" inputs . self ) ;
26+ description = ''
27+ Whether autoupgrade is actually enabled. This is true only when
28+ both `enable` is true and the system is running from a clean git revision.
29+ '' ;
30+ } ;
2231 operation = lib . mkOption {
2332 type = lib . types . enum [
2433 "switch"
108117 '' ;
109118 } ;
110119 } ;
111- config = lib . mkIf ( cfg . enable && ( builtins . hasAttr "rev" inputs . self ) ) {
120+ config = lib . mkIf ( cfg . enabled ) {
112121 environment . etc . git-revision . text = inputs . self . rev ;
113122
114123 system . autoUpgrade = {
You can’t perform that action at this time.
0 commit comments