mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 14:26:33 +01:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
40 lines
1.1 KiB
Nix
40 lines
1.1 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.ecs-agent;
|
|
in {
|
|
options.services.ecs-agent = {
|
|
enable = mkEnableOption "Amazon ECS agent";
|
|
|
|
package = mkPackageOption pkgs "ecs-agent" { };
|
|
|
|
extra-environment = mkOption {
|
|
type = types.attrsOf types.str;
|
|
description = "The environment the ECS agent should run with. See the ECS agent documentation for keys that work here.";
|
|
default = {};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# This service doesn't run if docker isn't running, and unlike potentially remote services like e.g., postgresql, docker has
|
|
# to be running locally so `docker.enable` will always be set if the ECS agent is enabled.
|
|
virtualisation.docker.enable = true;
|
|
|
|
systemd.services.ecs-agent = {
|
|
inherit (cfg.package.meta) description;
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
environment = cfg.extra-environment;
|
|
|
|
script = ''
|
|
if [ ! -z "$ECS_DATADIR" ]; then
|
|
mkdir -p "$ECS_DATADIR"
|
|
fi
|
|
${cfg.package}/bin/agent
|
|
'';
|
|
};
|
|
};
|
|
}
|