mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-02 05:49:22 +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 78e9caf153
result/bin/apply-formatting $NIXPKGS_PATH
104 lines
2.7 KiB
Nix
104 lines
2.7 KiB
Nix
import ./make-test-python.nix (
|
|
{ lib, ... }:
|
|
{
|
|
name = "nomad";
|
|
nodes = {
|
|
default_server =
|
|
{ pkgs, lib, ... }:
|
|
{
|
|
networking = {
|
|
interfaces.eth1.ipv4.addresses = lib.mkOverride 0 [
|
|
{
|
|
address = "192.168.1.1";
|
|
prefixLength = 16;
|
|
}
|
|
];
|
|
};
|
|
|
|
environment.etc."nomad.custom.json".source = (pkgs.formats.json { }).generate "nomad.custom.json" {
|
|
region = "universe";
|
|
datacenter = "earth";
|
|
};
|
|
|
|
services.nomad = {
|
|
enable = true;
|
|
|
|
settings = {
|
|
server = {
|
|
enabled = true;
|
|
bootstrap_expect = 1;
|
|
};
|
|
};
|
|
|
|
extraSettingsPaths = [ "/etc/nomad.custom.json" ];
|
|
enableDocker = false;
|
|
};
|
|
};
|
|
|
|
custom_state_dir_server =
|
|
{ pkgs, lib, ... }:
|
|
{
|
|
networking = {
|
|
interfaces.eth1.ipv4.addresses = lib.mkOverride 0 [
|
|
{
|
|
address = "192.168.1.1";
|
|
prefixLength = 16;
|
|
}
|
|
];
|
|
};
|
|
|
|
environment.etc."nomad.custom.json".source = (pkgs.formats.json { }).generate "nomad.custom.json" {
|
|
region = "universe";
|
|
datacenter = "earth";
|
|
};
|
|
|
|
services.nomad = {
|
|
enable = true;
|
|
dropPrivileges = false;
|
|
|
|
settings = {
|
|
data_dir = "/nomad/data/dir";
|
|
server = {
|
|
enabled = true;
|
|
bootstrap_expect = 1;
|
|
};
|
|
};
|
|
|
|
extraSettingsPaths = [ "/etc/nomad.custom.json" ];
|
|
enableDocker = false;
|
|
};
|
|
|
|
systemd.services.nomad.serviceConfig.ExecStartPre = "${pkgs.writeShellScript "mk_data_dir" ''
|
|
set -euxo pipefail
|
|
|
|
${pkgs.coreutils}/bin/mkdir -p /nomad/data/dir
|
|
''}";
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
def test_nomad_server(server):
|
|
server.wait_for_unit("nomad.service")
|
|
|
|
# wait for healthy server
|
|
server.wait_until_succeeds(
|
|
"[ $(nomad operator raft list-peers | grep true | wc -l) == 1 ]"
|
|
)
|
|
|
|
# wait for server liveness
|
|
server.succeed("[ $(nomad server members | grep -o alive | wc -l) == 1 ]")
|
|
|
|
# check the region
|
|
server.succeed("nomad server members | grep -o universe")
|
|
|
|
# check the datacenter
|
|
server.succeed("[ $(nomad server members | grep -o earth | wc -l) == 1 ]")
|
|
|
|
|
|
servers = [default_server, custom_state_dir_server]
|
|
|
|
for server in servers:
|
|
test_nomad_server(server)
|
|
'';
|
|
}
|
|
)
|