Skip to content

Commit

Permalink
feat(autoupdate): implement autoupdate option
Browse files Browse the repository at this point in the history
Implements `microvm.autoupdate` boolean option.
When enable it automatically commits changes to the vm.

Fixes astro#94
  • Loading branch information
megheaiulian committed Apr 21, 2023
1 parent 4b51ac1 commit 5e6235f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nixos-modules/host.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ in
Restart MicroVM services on `nixos-rebuild switch` of the host?
'';
};

autoupdate = mkOption {
type = types.bool;
default = false;
description = ''
Deploy updates to microvms that already exist.
'';
};
};

config = lib.mkIf config.microvm.host.enable {
Expand Down Expand Up @@ -114,7 +122,7 @@ in
partOf = [ "microvm@${name}.service" ];
wantedBy = [ "microvms.target" ];
# only run if /var/lib/microvms/$name does not exist yet
unitConfig.ConditionPathExists = "!${stateDir}/${name}";
unitConfig.ConditionPathExists = lib.mkIf (!config.microvm.autoupdate) "!${stateDir}/${name}";
serviceConfig.Type = "oneshot";
script =
let
Expand Down

0 comments on commit 5e6235f

Please sign in to comment.