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