Added server options for nomad and consul
This commit is contained in:
49
modules/server/nomad.nix
Normal file
49
modules/server/nomad.nix
Normal file
@@ -0,0 +1,49 @@
|
||||
{ config, lib, pkgs, self, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.server.nomad;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.server.nomad = {
|
||||
enable = lib.mkEnableOption "nomad";
|
||||
|
||||
server = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Set to true if configured a server - otherwise a client is assumed";
|
||||
};
|
||||
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
# services.consul.enable = true;
|
||||
services.nomad = {
|
||||
enable = true;
|
||||
extraSettingsPaths = [ "/etc/nomad.d" ];
|
||||
};
|
||||
environment.etc = {
|
||||
# Common configuration
|
||||
nomad-common-cfg = {
|
||||
target = "nomad.d/common.json";
|
||||
source = ../../config/nomad.d/common.json;
|
||||
};
|
||||
# Consul token
|
||||
nomad-consul-token = {
|
||||
target = "nomad.d/consul-token.json";
|
||||
source = config.age.secrets."nomad.d/consul-token.json".path;
|
||||
};
|
||||
# Client configuration
|
||||
nomad-client-cfg = {
|
||||
target = "nomad.d/client.json";
|
||||
source = ../../config/nomad.d/client.json;
|
||||
};
|
||||
} // lib.optionalAttrs cfg.server {
|
||||
# Server configuration
|
||||
nomad-server-cfg = {
|
||||
target = "nomad.d/server.json";
|
||||
source = ../../config/nomad.d/server.json;
|
||||
};
|
||||
};
|
||||
|
||||
# networking.firewall.allowedTCPPorts = [ 22 ];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user