pi/server more observable

This commit is contained in:
Polen 2025-06-14 08:53:35 -04:00
parent 79b6257577
commit c8305dd3d8
4 changed files with 77 additions and 33 deletions

View file

@ -3,7 +3,7 @@ build-pi-image:
# Doest work yet
rebuild-pi:
nixos-rebuild switch --flake .#pi --target-host polen@192.168.1.241 --use-remote-sudo
nixos-rebuild switch --flake .#pi --target-host pi --build-host server --use-remote-sudo
deploy-server:
nixos-rebuild switch --flake .#server --target-host server --build-host server --use-remote-sudo

View file

@ -1,6 +1,10 @@
{ inputs, config, pkgs, lib, ... }:
let
{
inputs,
config,
pkgs,
lib,
...
}: let
user = "polen";
hostname = "pi";
in {
@ -21,6 +25,13 @@ in {
};
};
swapDevices = [
{
device = "/var/lib/swapfile";
size = 10 * 1024;
}
];
#sops.defaultSopsFile = ../../secrets/secrets.yaml;
#sops.defaultSopsFormat = "yaml";
#sops.age.keyFile = "/home/polen/.config/sops/age/keys.txt";
@ -40,6 +51,11 @@ in {
'';
};
services.prometheus.exporters = {
node.enable = true;
node.openFirewall = true;
};
nix.settings.trusted-users = [user];
environment.systemPackages = with pkgs; [

View file

@ -15,6 +15,8 @@
};
#boot.kernelModules = ["msr"];
boot.binfmt.emulatedSystems = ["aarch64-linux"];
services.openssh.enable = true;
services = {
@ -29,6 +31,31 @@
rpc-whitelist = "127.0.0.1,192.168.*.*";
};
};
prometheus = {
enable = true;
exporters = {
node.enable = true;
};
scrapeConfigs = [
{
job_name = "node-exporters-lan";
static_configs = [
{
targets = ["192.168.1.241:9100"];
labels = {
instance = "pi";
};
}
{
targets = ["127.0.0.1:9100"];
labels = {
instance = "server";
};
}
];
}
];
};
};
networking = {
@ -36,6 +63,7 @@
firewall.allowedTCPPorts = [
8096 # jellyfin
9091 # transmission
9090 # prometheus
];
};

View file

@ -29,14 +29,14 @@
nix = {
settings.experimental-features = ["nix-command" "flakes"];
settings.trusted-users = ["polen"];
# settings.extra-platforms = config.boot.binfmt.emulatedSystems;
settings.extra-platforms = config.boot.binfmt.emulatedSystems;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 15d";
};
};
# boot.binfmt.emulatedSystems = ["aarch64-linux"];
boot.binfmt.emulatedSystems = ["aarch64-linux"];
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";