Progress dump before ai agent
This commit is contained in:
@@ -9,9 +9,15 @@ with lib;
|
||||
path = mkOption { type = types.str; };
|
||||
envFile = mkOption { type = types.nullOr types.path; default = null; };
|
||||
ports = mkOption { type = types.listOf types.int; default = [ ]; };
|
||||
# New option to pass raw systemd serviceConfig
|
||||
serviceConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
description = "Extra systemd serviceConfig options for this stack.";
|
||||
};
|
||||
};
|
||||
});
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
|
||||
config = {
|
||||
@@ -23,28 +29,24 @@ with lib;
|
||||
systemd.services = mapAttrs' (name: value: nameValuePair "${name}_stack" {
|
||||
description = "Docker Compose stack: ${name}";
|
||||
|
||||
# Added 'docker.socket' to both after and wants to ensure the API is reachable
|
||||
after = [ "network.target" "docker.service" "docker.socket" "agenix.service" ];
|
||||
wants = [ "docker.socket" "agenix.service" ];
|
||||
requires = [ "docker.service" ];
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
path = with pkgs; [ git docker docker-compose bash ];
|
||||
|
||||
# We merge the base config with the custom 'serviceConfig' from the submodule
|
||||
serviceConfig = recursiveUpdate {
|
||||
Type = "oneshot";
|
||||
WorkingDirectory = value.path;
|
||||
User = "root";
|
||||
|
||||
# This line forces the service to wait until the docker socket is actually responsive
|
||||
ExecStartPre = "${pkgs.bash}/bin/bash -c 'while [ ! -S /var/run/docker.sock ]; do sleep 1; done'";
|
||||
|
||||
ExecStart = "${pkgs.docker-compose}/bin/docker-compose up -d --remove-orphans";
|
||||
ExecStop = "${pkgs.docker-compose}/bin/docker-compose down";
|
||||
RemainAfterExit = true;
|
||||
|
||||
# Ensure the environment file is passed correctly
|
||||
EnvironmentFile = mkIf (value.envFile != null) [ value.envFile ];
|
||||
};
|
||||
} value.serviceConfig;
|
||||
}) config.services.dockerStacks;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user