fix: update fs-work for new raid-controller

This commit is contained in:
Administrator
2025-11-18 12:44:31 +01:00
parent da994766e1
commit 665707969b
2 changed files with 180 additions and 152 deletions

View File

@@ -1,4 +1,6 @@
{ pkgs ? import <nixpkgs> {} }:
{
pkgs ? import <nixpkgs> { },
}:
let
# Pin the deployment package-set to a specific version of nixpkgs
# pkgs = import (builtins.fetchTarball {
@@ -9,71 +11,79 @@ let
etcdCluster = import ../etcdCluster.nix;
name = "fs-work";
address = "172.16.239.210";
in {
fs-work = { config, pkgs, ... }: with pkgs; {
deployment.tags = [ "fs" "fs-work" "cluster" ];
deployment.targetHost = address;
system.autoUpgrade.enable = lib.mkForce false;
in
{
fs-work =
{ config, pkgs, ... }:
with pkgs;
{
deployment.tags = [
"fs"
"fs-work"
"cluster"
];
deployment.targetHost = address;
system.autoUpgrade.enable = lib.mkForce false;
systemd.targets = {
sleep.enable = false;
suspend.enable = false;
hibernate.enable = false;
hybrid-sleep.enable = false;
};
systemd.targets = {
sleep.enable = false;
suspend.enable = false;
hibernate.enable = false;
hybrid-sleep.enable = false;
};
# services.udev.extraRules = ''
# KERNEL=="ibp65s0", SUBSYSTEM=="net", ATTR{create_child}:="0x7666"
# '';
security.sudo.extraConfig = ''
%sif ALL=(ALL) NOPASSWD: /run/current-system/sw/bin/singularity
%admin ALL=(admin) NOPASSWD: ALL
'';
# services.udev.extraRules = ''
# KERNEL=="ibp65s0", SUBSYSTEM=="net", ATTR{create_child}:="0x7666"
# '';
security.sudo.extraConfig = ''
%sif ALL=(ALL) NOPASSWD: /run/current-system/sw/bin/singularity
%admin ALL=(admin) NOPASSWD: ALL
'';
environment.systemPackages = with pkgs; [
environment.systemPackages = with pkgs; [
rdma-core
hwloc
xfsprogs
];
];
cluster = {
k8sNode = true;
slurm = false;
mounts = {
rdma.enable = false;
automount.enable = true;
users = false;
opt = false;
work = false;
data = false;
ceph = false;
};
};
features = {
host = {
inherit address;
inherit name;
cluster = {
k8sNode = true;
slurm = false;
mounts = {
rdma.enable = false;
automount.enable = true;
users = false;
opt = false;
work = false;
data = false;
ceph = true;
};
};
os = {
networkmanager.enable = false;
externalInterface = "enp1s0np0";
nfs.enable = true;
nfs.exports = ''
/exports 172.16.239.0/24(insecure,rw,async,no_subtree_check,crossmnt,fsid=0,no_root_squash)
'';
};
features = {
host = {
inherit address;
inherit name;
};
k8s = {
os = {
networkmanager.enable = false;
externalInterface = "enp1s0np0";
nfs.enable = true;
nfs.exports = ''
/exports 172.16.239.0/24(insecure,rw,async,no_subtree_check,crossmnt,fsid=0,no_root_squash)
'';
};
k8s = {
enable = true;
node.enable = true;
master.enable = false;
inherit etcdCluster;
};
};
};
systemd.services.rc-local = {
systemd.services.rc-local = {
description = "rc.local script";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
@@ -82,102 +92,105 @@ in {
Type = "oneshot";
};
script = ''
# if [ -e /sys/block/md126 ]; then
# echo "deadline" > /sys/block/md126/queue/scheduler
# # echo "4096" > /sys/block/md126/queue/nr_requests
# echo "4096" > /sys/block/md126/queue/read_ahead_kb
# echo "always" > /sys/kernel/mm/transparent_hugepage/enabled
# echo "always" > /sys/kernel/mm/transparent_hugepage/defrag
# fi
grep -q rdma /proc/fs/nfsd/portlist || echo "rdma 20049" > /proc/fs/nfsd/portlist
grep -q tcp /proc/fs/nfsd/portlist || echo "tcp 2049" > /proc/fs/nfsd/portlist
# if [ -e /sys/block/md126 ]; then
# echo "deadline" > /sys/block/md126/queue/scheduler
# # echo "4096" > /sys/block/md126/queue/nr_requests
# echo "4096" > /sys/block/md126/queue/read_ahead_kb
# echo "always" > /sys/kernel/mm/transparent_hugepage/enabled
# echo "always" > /sys/kernel/mm/transparent_hugepage/defrag
# fi
grep -q rdma /proc/fs/nfsd/portlist || echo "rdma 20049" > /proc/fs/nfsd/portlist
grep -q tcp /proc/fs/nfsd/portlist || echo "tcp 2049" > /proc/fs/nfsd/portlist
'';
};
};
boot.kernel.sysctl = {
boot.kernel.sysctl = {
"vm.dirty_background_ratio" = 5;
"vm.dirty_ratio" = 10;
"vm.vfs_cache_pressure" = 50;
"vm.min_free_kbytes" = 262144;
};
networking = {
useNetworkd = true;
useDHCP = false;
hostName = name;
firewall = {
allowedTCPPorts = [];
allowedUDPPorts = [];
extraCommands = ''
# iptables -t nat -A POSTROUTING -s 172.16.239.0/24 -j MASQUERADE
'';
};
};
systemd.network = {
networks."40-enp1s0np0" = {
matchConfig.Name = "enp1s0np0";
DHCP = "no";
address = [ "${address}/24" ];
networkConfig = { DNSDefaultRoute = true; };
routes = [
{ Gateway = "172.16.239.1"; }
# {
# Destination = "10.255.241.0/24";
# Gateway = "172.16.239.221";
# }
];
};
};
services.rpcbind.enable = true;
fileSystems = {
"/exports/work" = {
device = "/work";
options = [ "bind" ];
};
};
programs.singularity.enable = true;
boot.kernelParams = [
"amd_iommu=on" "iommu=pt"
];
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_16;
services.tailscale = {
enable = false;
authKeyFile = "/var/lib/secrets/tailscale.key";
useRoutingFeatures = "both"; # for exit-node usage
extraUpFlags = [
"--login-server=https://headscale-router.adm.oceanbox.io"
"--accept-dns=true"
"--accept-routes=true"
"--snat-subnet-routes=false"
"--advertise-routes=172.16.238.0/24,172.16.239.0/24"
"--advertise-tags=tag:vtn-router"
];
};
services.networkd-dispatcher = {
enable = false;
rules = {
"tailscale-router" = {
onState = [ "routable" ];
script = ''
#!${pkgs.runtimeShell}
${pkgs.ethtool}/bin/ethtool -K enp65s0np0 rx-udp-gro-forwarding on rx-gro-list off
exit 0
networking = {
useNetworkd = true;
useDHCP = false;
hostName = name;
firewall = {
allowedTCPPorts = [ ];
allowedUDPPorts = [ ];
extraCommands = ''
# iptables -t nat -A POSTROUTING -s 172.16.239.0/24 -j MASQUERADE
'';
};
};
};
imports = [
systemd.network = {
networks."40-enp1s0np0" = {
matchConfig.Name = "enp1s0np0";
DHCP = "no";
address = [ "${address}/24" ];
networkConfig = {
# DNSDefaultRoute = true;
};
routes = [
{ Gateway = "172.16.239.1"; }
# {
# Destination = "10.255.241.0/24";
# Gateway = "172.16.239.221";
# }
];
};
};
services.rpcbind.enable = true;
fileSystems = {
"/exports/work" = {
device = "/work";
options = [ "bind" ];
};
};
programs.singularity.enable = true;
boot.kernelParams = [
"amd_iommu=on"
"iommu=pt"
];
# boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_16;
services.tailscale = {
enable = false;
authKeyFile = "/var/lib/secrets/tailscale.key";
useRoutingFeatures = "both"; # for exit-node usage
extraUpFlags = [
"--login-server=https://headscale-router.adm.oceanbox.io"
"--accept-dns=true"
"--accept-routes=true"
"--snat-subnet-routes=false"
"--advertise-routes=172.16.238.0/24,172.16.239.0/24"
"--advertise-tags=tag:vtn-router"
];
};
services.networkd-dispatcher = {
enable = false;
rules = {
"tailscale-router" = {
onState = [ "routable" ];
script = ''
#!${pkgs.runtimeShell}
${pkgs.ethtool}/bin/ethtool -K enp65s0np0 rx-udp-gro-forwarding on rx-gro-list off
exit 0
'';
};
};
};
imports = [
./hardware-configuration.nix
../default.nix
../mounts.nix
];
};
];
};
}

View File

@@ -1,34 +1,49 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "megaraid_sas" "ahci" "usbhid" "sd_mod" ];
boot.initrd.availableKernelModules = [
"xhci_pci"
"megaraid_sas"
"ahci"
"usbhid"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/45e5f9e7-7263-443c-9cb1-9143e7dee1d9";
fsType = "ext4";
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/45e5f9e7-7263-443c-9cb1-9143e7dee1d9";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5621-2F9E";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/5621-2F9E";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
fileSystems."/work" =
{ device = "/dev/disk/by-uuid/e9bd2849-bff3-4f22-b5b0-92ff4283dcd4";
fsType = "xfs";
options = [ "nofail" ];
};
fileSystems."/work" = {
device = "/dev/disk/by-uuid/90bdcfb4-cfb8-4da1-82cd-b77e5bb399da";
fsType = "xfs";
options = [ "nofail" ];
};
swapDevices = [ ];