···
1
+
{pkgs, config, lib, ...}:
6
+
cfg = config.services.hologram-server;
8
+
cfgFile = pkgs.writeText "hologram-server.json" (builtins.toJSON {
10
+
host = cfg.ldapHost;
12
+
dn = cfg.ldapBindDN;
13
+
password = cfg.ldapBindPassword;
15
+
insecureldap = cfg.ldapInsecure;
16
+
userattr = cfg.ldapUserAttr;
17
+
baseDN = cfg.ldapBaseDN;
20
+
account = cfg.awsAccount;
21
+
defaultrole = cfg.awsDefaultRole;
23
+
stats = cfg.statsAddress;
24
+
listen = cfg.listenAddress;
28
+
services.hologram-server = {
32
+
description = "Whether to enable the Hologram server for AWS instance credentials";
35
+
listenAddress = mkOption {
37
+
default = "0.0.0.0:3100";
38
+
description = "Address and port to listen on";
41
+
ldapHost = mkOption {
43
+
description = "Address of the LDAP server to use";
46
+
ldapInsecure = mkOption {
49
+
description = "Whether to connect to LDAP over SSL or not";
52
+
ldapUserAttr = mkOption {
55
+
description = "The LDAP attribute for usernames";
58
+
ldapBaseDN = mkOption {
60
+
description = "The base DN for your Hologram users";
63
+
ldapBindDN = mkOption {
65
+
description = "DN of account to use to query the LDAP server";
68
+
ldapBindPassword = mkOption {
70
+
description = "Password of account to use to query the LDAP server";
73
+
awsAccount = mkOption {
75
+
description = "AWS account number";
78
+
awsDefaultRole = mkOption {
80
+
description = "AWS default role";
83
+
statsAddress = mkOption {
86
+
description = "Address of statsd server";
91
+
config = mkIf cfg.enable {
92
+
systemd.services.hologram-server = {
93
+
description = "Provide EC2 instance credentials to machines outside of EC2";
94
+
after = [ "network.target" ];
95
+
wantedBy = [ "multi-user.target" ];
98
+
ExecStart = "${pkgs.goPackages.hologram}/bin/hologram-server --debug --conf ${cfgFile}";