commit d6af0cf084d34042b7d7c49fb05bde39e486ce04
parent e76f08b20896c8aa8008f6fe102aaf08cce04fa5
Author: Vincent Demeester <vincent@sbr.pm>
Date: Fri, 18 Dec 2020 14:48:31 +0100
systems: do not start docker/buildkitd/containerd…
… at boot. Only start on demand.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
4 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/systems/hosts/naruhodo.nix b/systems/hosts/naruhodo.nix
@@ -140,6 +140,10 @@ in
endpointPublicKey = endpointPublicKey;
};
};
+ systemd.services.buildkitd.wantedBy = lib.mkForce [ ];
+ systemd.services.containerd.wantedBy = lib.mkForce [ ];
+ systemd.services.docker.wantedBy = lib.mkForce [ ];
+ systemd.services.docker.requires = [ "containerd.socket" ];
virtualisation.podman.enable = true;
virtualisation.containers = {
diff --git a/systems/modules/buildkit.nix b/systems/modules/buildkit.nix
@@ -14,6 +14,14 @@ in
'';
};
+ autostart = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Start buildkitd automatically.
+ '';
+ };
+
package = mkOption {
default = pkgs.buildkit;
type = types.package;
@@ -48,7 +56,7 @@ in
systemd.services.buildkitd = {
wants = [ "containerd.service" ];
after = [ "containerd.service" ];
- wantedBy = [ "multi-user.target" ];
+ wantedBy = lib.optional cfg.autostart [ "multi-user.target" ];
serviceConfig = {
ExecStart = [
""
diff --git a/systems/modules/containerd.nix b/systems/modules/containerd.nix
@@ -14,6 +14,14 @@ in
'';
};
+ autostart = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Start containerd automatically.
+ '';
+ };
+
package = mkOption {
default = pkgs.containerd;
type = types.package;
@@ -45,7 +53,7 @@ in
systemd.packages = [ cfg.package ];
systemd.services.containerd = {
- wantedBy = [ "multi-user.target" ];
+ wantedBy = lib.optional cfg.autostart [ "multi-user.target" ];
serviceConfig = {
ExecStart = [
""
diff --git a/systems/modules/profiles/docker.nix b/systems/modules/profiles/docker.nix
@@ -22,9 +22,13 @@ in
};
config = mkIf cfg.enable {
virtualisation = {
- containerd.enable = true;
+ containerd = {
+ enable = true;
+ autostart = false;
+ };
buildkitd = {
enable = true;
+ autostart = false;
extraOptions = "--oci-worker=false --containerd-worker=true";
};
docker = {