ruined every thing
This commit is contained in:
@@ -12,6 +12,16 @@
|
||||
cfg = config.hectic.hardware.lenovo-ideapad-15arh7;
|
||||
hasDisko = false;
|
||||
in {
|
||||
# FIXME: FUCK
|
||||
#imports = [
|
||||
# "${inputs.nixos-hardware}/common/cpu/amd"
|
||||
# "${inputs.nixos-hardware}/common/cpu/amd/pstate.nix"
|
||||
# "${inputs.nixos-hardware}/common/gpu/amd"
|
||||
# "${inputs.nixos-hardware}/common/gpu/nvidia/prime-sync.nix"
|
||||
# "${inputs.nixos-hardware}/common/pc/laptop"
|
||||
# "${inputs.nixos-hardware}/common/pc/laptop/ssd"
|
||||
#];
|
||||
|
||||
options.hectic.hardware.lenovo-ideapad-15arh7 = {
|
||||
enable = lib.mkEnableOption "Enable lenovo-legion hardware configurations";
|
||||
swapSize = lib.mkOption {
|
||||
@@ -35,16 +45,6 @@ in {
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
zlaupa = 12;
|
||||
imports = [
|
||||
"${inputs.nixos-hardware}/common/cpu/amd"
|
||||
"${inputs.nixos-hardware}/common/cpu/amd/pstate.nix"
|
||||
"${inputs.nixos-hardware}/common/gpu/amd"
|
||||
"${inputs.nixos-hardware}/common/gpu/nvidia/prime-sync.nix"
|
||||
"${inputs.nixos-hardware}/common/pc/laptop"
|
||||
"${inputs.nixos-hardware}/common/pc/laptop/ssd"
|
||||
];
|
||||
|
||||
/* common */
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ symlinkJoin, writeTextFile, socat, dash, hectic, curl, gawk }:
|
||||
{ symlinkJoin, writeTextFile, socat, dash, hectic, curl, gawk, jq }:
|
||||
let
|
||||
shell = "${dash}/bin/dash";
|
||||
bashOptions = [
|
||||
@@ -30,7 +30,7 @@ let
|
||||
sentinel = hectic.writeShellApplication {
|
||||
inherit shell bashOptions;
|
||||
name = "sentinel";
|
||||
runtimeInputs = [ hectic.shellplot curl ];
|
||||
runtimeInputs = [ hectic.shellplot curl jq ];
|
||||
|
||||
text = ''
|
||||
${builtins.readFile ./log.sh}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# router.sh — POSIX sh HTTP backend (for socat)
|
||||
# usage: socat -T5 -t5 TCP-LISTEN:${port},reuseaddr,fork EXEC:"dash ${currentfile}"
|
||||
# Routes:
|
||||
# GET / -> {"status":...,"disk":...}
|
||||
# GET /status -> check $URLS (0/0 if unset)
|
||||
# GET /disk -> check $VOLUMES (all if unset)
|
||||
# Env:
|
||||
@@ -14,6 +15,10 @@
|
||||
: "${TIMEOUT:=5}"
|
||||
: "${VOLUMES:=$(df -P | awk 'NR>1{print $6}')}"
|
||||
|
||||
route_summary() {
|
||||
printf '%s' '{"status":'"$(route_status)"',"disk":'"$(route_disk)"'}'
|
||||
}
|
||||
|
||||
route_status() {
|
||||
if [ -z "${URLS:-}" ]; then
|
||||
printf '{"checks":[],"summary":{"total":0,"ok":0}}'
|
||||
@@ -103,6 +108,7 @@ tmp=$(mktemp) || exit 1
|
||||
trap 'rm -f "$tmp"' EXIT INT HUP
|
||||
|
||||
case "$req" in
|
||||
"GET / "*) route_summary >"$tmp"; status='200 OK'; ctype='application/json' ;;
|
||||
"GET /status "*) route_status >"$tmp"; status='200 OK'; ctype='application/json' ;;
|
||||
"GET /disk "*) route_disk >"$tmp"; status='200 OK'; ctype='application/json' ;;
|
||||
*) printf 'Not found\n' >"$tmp"; status='404 Not Found'; ctype='text/plain' ;;
|
||||
|
||||
@@ -75,6 +75,10 @@ list_failures() {
|
||||
}
|
||||
|
||||
# --- main loop ---
|
||||
|
||||
# NOTE: remove temp response body on any exit
|
||||
trap 'rm -f "$tmpb" 2> /dev/null' EXIT INT HUP
|
||||
|
||||
while :; do
|
||||
log info "pooling ${WHITE}${POLLING_INTERVAL_SEC}${NC} sec"
|
||||
i=1
|
||||
@@ -83,7 +87,7 @@ while :; do
|
||||
[ -n "${srv:-}" ] || break
|
||||
tok=$(get_csv "$TOKENS" "$i") || tok="-"
|
||||
|
||||
url="${srv%/}/status"
|
||||
url="${srv%/}"
|
||||
auth_h=""
|
||||
[ "${tok}" != "-" ] && [ -n "${tok}" ] && auth_h="-H Authorization: Basic\ $tok"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user