Compare commits
3 Commits
inventree-
...
253b25c9ca
| Author | SHA1 | Date | |
|---|---|---|---|
| 253b25c9ca | |||
| bfeea4156b | |||
| 3aa93c1333 |
@@ -3,7 +3,10 @@
|
|||||||
inventory = {
|
inventory = {
|
||||||
|
|
||||||
tags = {
|
tags = {
|
||||||
glom = [ "vega" ];
|
glom = [
|
||||||
|
"vega"
|
||||||
|
"ramus"
|
||||||
|
];
|
||||||
b4l = [ "rigel" ];
|
b4l = [ "rigel" ];
|
||||||
w = [ "sirius" ];
|
w = [ "sirius" ];
|
||||||
fax-bridge = [ ];
|
fax-bridge = [ ];
|
||||||
|
|||||||
6
machines/ramus/configuration.nix
Normal file
6
machines/ramus/configuration.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
system.stateVersion = "25.11";
|
||||||
|
clan.core.sops.defaultGroups = [ "admins" ];
|
||||||
|
clan.core.networking.targetHost = "root@[${config.clan.core.vars.generators.zerotier.files.zerotier-ip.value}]";
|
||||||
|
}
|
||||||
84
machines/ramus/disko.nix
Normal file
84
machines/ramus/disko.nix
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
{ ... }:
|
||||||
|
let
|
||||||
|
hashDisk = disk: "os-${builtins.substring 0 5 (builtins.hashString "sha256" disk)}";
|
||||||
|
os = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_107266387";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
boot.loader = {
|
||||||
|
systemd-boot = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
efi = {
|
||||||
|
canTouchEfiVariables = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
"os-${hashDisk os}" = {
|
||||||
|
type = "disk";
|
||||||
|
device = os;
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
ESP = {
|
||||||
|
size = "1G";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [ "nofail" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
system = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "zroot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zpool = {
|
||||||
|
zroot = {
|
||||||
|
type = "zpool";
|
||||||
|
rootFsOptions = {
|
||||||
|
mountpoint = "none";
|
||||||
|
compression = "lz4";
|
||||||
|
acltype = "posixacl";
|
||||||
|
xattr = "sa";
|
||||||
|
"com.sun:auto-snapshot" = "true";
|
||||||
|
};
|
||||||
|
options.ashift = "12";
|
||||||
|
datasets = {
|
||||||
|
"root" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options.mountpoint = "none";
|
||||||
|
};
|
||||||
|
"root/nixos" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options.mountpoint = "/";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
"root/home" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
options.mountpoint = "/home";
|
||||||
|
mountpoint = "/home";
|
||||||
|
};
|
||||||
|
"root/tmp" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/tmp";
|
||||||
|
options = {
|
||||||
|
mountpoint = "/tmp";
|
||||||
|
sync = "disabled";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ in
|
|||||||
"${inputs.liminix}/modules/vlan"
|
"${inputs.liminix}/modules/vlan"
|
||||||
"${inputs.liminix}/modules/ssh"
|
"${inputs.liminix}/modules/ssh"
|
||||||
"${inputs.liminix}/modules/bridge"
|
"${inputs.liminix}/modules/bridge"
|
||||||
|
"${inputs.liminix}/modules/health-check"
|
||||||
"${modulesPath}/profiles/gateway.nix"
|
"${modulesPath}/profiles/gateway.nix"
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -48,14 +49,46 @@ in
|
|||||||
name = "resolvconf";
|
name = "resolvconf";
|
||||||
up = ''
|
up = ''
|
||||||
( in_outputs ${name}
|
( in_outputs ${name}
|
||||||
echo "nameserver $(output ${config.services.wan} ns1)" > resolv.conf
|
echo "nameserver 208.67.222.222" >> resolv.conf
|
||||||
echo "nameserver $(output ${config.services.wan} ns2)" >> resolv.conf
|
echo "nameserver 208.67.220.220" >> resolv.conf
|
||||||
|
echo "nameserver 1.1.1.1" >> resolv.conf
|
||||||
|
echo "nameserver 1.0.0.1" >> resolv.conf
|
||||||
|
echo "nameserver 8.8.8.8" >> resolv.conf
|
||||||
chmod 0444 resolv.conf
|
chmod 0444 resolv.conf
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
services.reAddDefaultroute =
|
||||||
|
let
|
||||||
|
threshold = 3;
|
||||||
|
healthCheck = pkgs.writeAshScript "ping-check" { } "ping 1.1.1.1";
|
||||||
|
in
|
||||||
|
pkgs.liminix.services.longrun rec {
|
||||||
|
# dependencies = [ config.services.wan ];
|
||||||
|
name = "hack-default-route";
|
||||||
|
run = ''
|
||||||
|
fails=0
|
||||||
|
while sleep 10 ; do
|
||||||
|
${healthCheck}
|
||||||
|
if test $? -gt 0; then
|
||||||
|
fails=$(expr $fails + 1)
|
||||||
|
else
|
||||||
|
fails=0
|
||||||
|
fi
|
||||||
|
echo fails $fails/${toString threshold} for ${name}
|
||||||
|
if test "$fails" -gt "${toString threshold}" ; then
|
||||||
|
echo [+] adding default route
|
||||||
|
${config.services.defaultroute4}/${config.services.defaultroute4.name}/up
|
||||||
|
${config.services.defaultroute6}/${config.services.defaultroute6.name}/up
|
||||||
|
echo bounced
|
||||||
|
fails=0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
profile.gateway = {
|
profile.gateway = {
|
||||||
lan = {
|
lan = {
|
||||||
interfaces = with config.hardware.networkInterfaces; [
|
interfaces = with config.hardware.networkInterfaces; [
|
||||||
@@ -123,7 +156,7 @@ in
|
|||||||
defaultProfile.packages = with pkgs; [
|
defaultProfile.packages = with pkgs; [
|
||||||
busybox
|
busybox
|
||||||
iw
|
iw
|
||||||
iptables
|
nftables
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user