mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-19 16:40:32 +03:00

After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev 0128fbb0a5
result/bin/apply-formatting $NIXPKGS_PATH
138 lines
3.4 KiB
Nix
138 lines
3.4 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.hologram-server;
|
|
|
|
cfgFile = pkgs.writeText "hologram-server.json" (
|
|
builtins.toJSON {
|
|
ldap = {
|
|
host = cfg.ldapHost;
|
|
bind = {
|
|
dn = cfg.ldapBindDN;
|
|
password = cfg.ldapBindPassword;
|
|
};
|
|
insecureldap = cfg.ldapInsecure;
|
|
userattr = cfg.ldapUserAttr;
|
|
baseDN = cfg.ldapBaseDN;
|
|
enableldapRoles = cfg.enableLdapRoles;
|
|
roleAttr = cfg.roleAttr;
|
|
groupClassAttr = cfg.groupClassAttr;
|
|
};
|
|
aws = {
|
|
account = cfg.awsAccount;
|
|
defaultrole = cfg.awsDefaultRole;
|
|
};
|
|
stats = cfg.statsAddress;
|
|
listen = cfg.listenAddress;
|
|
cachetimeout = cfg.cacheTimeoutSeconds;
|
|
}
|
|
);
|
|
in
|
|
{
|
|
options = {
|
|
services.hologram-server = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Whether to enable the Hologram server for AWS instance credentials";
|
|
};
|
|
|
|
listenAddress = mkOption {
|
|
type = types.str;
|
|
default = "0.0.0.0:3100";
|
|
description = "Address and port to listen on";
|
|
};
|
|
|
|
ldapHost = mkOption {
|
|
type = types.str;
|
|
description = "Address of the LDAP server to use";
|
|
};
|
|
|
|
ldapInsecure = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Whether to connect to LDAP over SSL or not";
|
|
};
|
|
|
|
ldapUserAttr = mkOption {
|
|
type = types.str;
|
|
default = "cn";
|
|
description = "The LDAP attribute for usernames";
|
|
};
|
|
|
|
ldapBaseDN = mkOption {
|
|
type = types.str;
|
|
description = "The base DN for your Hologram users";
|
|
};
|
|
|
|
ldapBindDN = mkOption {
|
|
type = types.str;
|
|
description = "DN of account to use to query the LDAP server";
|
|
};
|
|
|
|
ldapBindPassword = mkOption {
|
|
type = types.str;
|
|
description = "Password of account to use to query the LDAP server";
|
|
};
|
|
|
|
enableLdapRoles = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Whether to assign user roles based on the user's LDAP group memberships";
|
|
};
|
|
|
|
groupClassAttr = mkOption {
|
|
type = types.str;
|
|
default = "groupOfNames";
|
|
description = "The objectclass attribute to search for groups when enableLdapRoles is true";
|
|
};
|
|
|
|
roleAttr = mkOption {
|
|
type = types.str;
|
|
default = "businessCategory";
|
|
description = "Which LDAP group attribute to search for authorized role ARNs";
|
|
};
|
|
|
|
awsAccount = mkOption {
|
|
type = types.str;
|
|
description = "AWS account number";
|
|
};
|
|
|
|
awsDefaultRole = mkOption {
|
|
type = types.str;
|
|
description = "AWS default role";
|
|
};
|
|
|
|
statsAddress = mkOption {
|
|
type = types.str;
|
|
default = "";
|
|
description = "Address of statsd server";
|
|
};
|
|
|
|
cacheTimeoutSeconds = mkOption {
|
|
type = types.int;
|
|
default = 3600;
|
|
description = "How often (in seconds) to refresh the LDAP cache";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.services.hologram-server = {
|
|
description = "Provide EC2 instance credentials to machines outside of EC2";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
ExecStart = "${pkgs.hologram}/bin/hologram-server --debug --conf ${cfgFile}";
|
|
};
|
|
};
|
|
};
|
|
}
|