Files
platform/cluster/c1/default.nix
2025-09-06 08:01:54 +02:00

120 lines
3.1 KiB
Nix

{ pkgs ? import <nixpkgs> {} }:
let
# Pin the deployment package-set to a specific version of nixpkgs
# pkgs = import (builtins.fetchTarball {
# url = "https://github.com/NixOS/nixpkgs/archive/e6377ff35544226392b49fa2cf05590f9f0c4b43.tar.gz";
# sha256 = "1fra9wwy5gvj5ibayqkzqpwdf715bggc0qbmrfch4fghwvl5m70l";
# }) {};
# pkgs = import <nixpkgs> {};
nodes = import ./nodes.nix;
compute = {
deployment.tags = [ "compute" "c1" ];
systemd.automounts = [
{
where = "/frontend";
wantedBy = [ "default.target" ];
}
];
};
mkCompute = host:
let
hw = ./hw + "/${host.name}.nix";
in {
"${host.name}" = {
cluster = {
compute = true;
k8sNode = true;
mounts = {
rdma.enable = false;
gbe100.enable = true;
automount.enable = true;
home = true;
opt = true;
work = true;
data = false;
backup = false;
ceph = true;
};
};
features = {
host = {
name = host.name;
address = host.address;
};
os.externalInterface = "eno33np0";
hpc.compute = true;
# k8s = { inherit etcdCluster; };
};
deployment.targetHost = host.target;
# services.udev.extraRules = ''
# KERNEL=="ibp1s0", SUBSYSTEM=="net", ATTR{create_child}:="0x7666"
# '';
# boot.kernel.sysctl = {
# "net.ipv4.tcp_timestamps" = 0;
# "net.ipv4.tcp_sack" = 1;
# "net.core.netdev_max_backlog" = 250000;
# "net.core.rmem_max" = 4194304;
# "net.core.wmem_max" = 4194304;
# "net.core.rmem_default" = 4194304;
# "net.core.wmem_default" = 4194304;
# "net.core.optmem_max" = 4194304;
# "net.ipv4.tcp_rmem" = "4096 87380 4194304";
# "net.ipv4.tcp_wmem" = "4096 65536 4194304";
# "net.ipv4.tcp_low_latency" = 1;
# "net.ipv4.tcp_adv_win_scale" = 1;
# };
networking = {
hostName = host.name;
useDHCP = false;
interfaces.eno33np0 = {
useDHCP = false;
ipv4.addresses = [ {
address = host.address;
prefixLength = 24;
} ];
ipv4.routes = [ {
address = "10.255.242.0";
prefixLength = 24;
via = "10.255.241.100";
} ];
};
# interfaces.ibp65s0 = {
# useDHCP = false;
# ipv4.addresses = [ {
# address = host.ipoib;
# prefixLength = 24;
# } ];
# };
interfaces.enp65s0np0 = {
useDHCP = false;
ipv4.addresses = [ {
address = host.gbe100;
prefixLength = 24;
} ];
};
# firewall.extraCommands =
# if host.name == "c1-1" then ''
# iptables -t nat -A POSTROUTING -d 10.255.244.0/24 -j MASQUERADE
# ''
# else "";
};
imports = [
hw
../cluster.nix
../mounts.nix
];
}
// compute;
};
in builtins.foldl' (a: n: a // mkCompute n) {} nodes