ssm-agent NixOS module: init
This commit is contained in:
parent
4450327c06
commit
e928cb1c63
@ -294,6 +294,7 @@
|
|||||||
./services/misc/siproxd.nix
|
./services/misc/siproxd.nix
|
||||||
./services/misc/sonarr.nix
|
./services/misc/sonarr.nix
|
||||||
./services/misc/spice-vdagentd.nix
|
./services/misc/spice-vdagentd.nix
|
||||||
|
./services/misc/ssm-agent.nix
|
||||||
./services/misc/sssd.nix
|
./services/misc/sssd.nix
|
||||||
./services/misc/subsonic.nix
|
./services/misc/subsonic.nix
|
||||||
./services/misc/sundtek.nix
|
./services/misc/sundtek.nix
|
||||||
|
45
nixos/modules/services/misc/ssm-agent.nix
Normal file
45
nixos/modules/services/misc/ssm-agent.nix
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.services.ssm-agent;
|
||||||
|
|
||||||
|
# The SSM agent doesn't pay attention to our /etc/os-release yet, and the lsb-release tool
|
||||||
|
# in nixpkgs doesn't seem to work properly on NixOS, so let's just fake the two fields SSM
|
||||||
|
# looks for. See https://github.com/aws/amazon-ssm-agent/issues/38 for upstream fix.
|
||||||
|
fake-lsb-release = pkgs.writeScriptBin "lsb_release" ''
|
||||||
|
#!${pkgs.stdenv.shell}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
-i) echo "nixos";;
|
||||||
|
-r) echo "${config.system.nixosVersion}";;
|
||||||
|
esac
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
options.services.ssm-agent = {
|
||||||
|
enable = mkEnableOption "AWS SSM agent";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
description = "The SSM agent package to use";
|
||||||
|
default = pkgs.ssm-agent;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.services.ssm-agent = {
|
||||||
|
inherit (cfg.package.meta) description;
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
path = [ fake-lsb-release ];
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${cfg.package.bin}/bin/agent";
|
||||||
|
KillMode = "process";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = "15min";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user