Compare commits

...
2 Commits
Author SHA1 Message Date
soraefir 725ad92c81 Updates and fixes 2026-08-19 20:18:38 +02:00
soraefir fd14b7f64d fix eww 2026-08-19 19:47:06 +02:00
9 changed files with 202 additions and 70 deletions
Generated
+52 -55
View File
@@ -23,11 +23,11 @@
]
},
"locked": {
"lastModified": 1779036909,
"narHash": "sha256-zXcwYQGCT6pzinK+1dBB2ekTVtfxGZAapb3Evdcu4fY=",
"lastModified": 1786845137,
"narHash": "sha256-oQFip+v0luP8NIxJzmiW4Wu8bILsbFWom5l0zonl8hQ=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "56c666e108467d87d13508936aade6d567f2a501",
"rev": "4cff07de74b50e64bdd68cd4e722ab5b6b35ee48",
"type": "github"
},
"original": {
@@ -74,21 +74,21 @@
"type": "github"
}
},
"flake-utils": {
"flake-parts_2": {
"inputs": {
"systems": "systems"
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"lastModified": 1772408722,
"narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
@@ -97,11 +97,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1780065812,
"narHash": "sha256-SCSLUKBmwlSLGQ8Xbr8PjRFtiHNk0l9ktqkcmqdBkfE=",
"lastModified": 1787144466,
"narHash": "sha256-HHfv2/HkNSKbbSyU9iD/g8lbP6r4tl33sSw1W4rXCk0=",
"owner": "nixos",
"repo": "nixos-hardware",
"rev": "b76b5639c0593e0aeb0b5879ad62d4b30596c144",
"rev": "0471accf8d0a8210b31d947497d179ecc99e0021",
"type": "github"
},
"original": {
@@ -117,11 +117,11 @@
]
},
"locked": {
"lastModified": 1779726825,
"narHash": "sha256-RUkMrREjKDQrA+dA9+xZviGAxM5W1aVdyOr/bSYpHrE=",
"lastModified": 1787146702,
"narHash": "sha256-YbRcLdU/yK4gWsQg7V8WTKZHfXL33g8+wSFUX3wyevs=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "b179bde238977f7d4454fc770b1a727eaf55111c",
"rev": "173b7e8d40fdc8c296a9c99854314f17a3a1704c",
"type": "github"
},
"original": {
@@ -152,11 +152,11 @@
},
"nixUnstable": {
"locked": {
"lastModified": 1780030872,
"narHash": "sha256-u6WU/yd/o8iYQrHX3RAwO1hYa3LkoSL+WNQD0rJfJZQ=",
"lastModified": 1787111413,
"narHash": "sha256-sFosWtq21eHGJRnTc/hvf4M1obRgLEUMNm/IzllkHMA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e9a7635a57597d9754eccebdfc7045e6c8600e6b",
"rev": "afe3d8ac4395617bdcdac9f188ac8717a062e014",
"type": "github"
},
"original": {
@@ -174,11 +174,11 @@
]
},
"locked": {
"lastModified": 1780169171,
"narHash": "sha256-3HBYDfBgZ+ph52HS6Ks/bMMwuh2uONIT72sZ1CtLE/s=",
"lastModified": 1784642409,
"narHash": "sha256-hcbDqFuySAJawljt5r0sKBCJKYnbtGD0T/ZIozH1Dq0=",
"owner": "nix-community",
"repo": "nixos-wsl",
"rev": "998b2821c30b2938637230916904ceb8757c79e8",
"rev": "eaeb18da90024448a60eb1ec7132eafa4003404e",
"type": "github"
},
"original": {
@@ -215,13 +215,28 @@
"type": "github"
}
},
"nixpkgs-lib_2": {
"locked": {
"lastModified": 1772328832,
"narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "c185c7a5e5dd8f9add5b2f8ebeff00888b070742",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1780203844,
"narHash": "sha256-K5sT4jTpGs15ADhviMKNBH38REpPf5Q6mM1+N6cArVE=",
"lastModified": 1787101114,
"narHash": "sha256-gwrPcFf/rDjHPaVflbDZ040ZDmBTRj/7+s8ZmE2SaIM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b51242d7d43689db2f3be91bd05d5b24fbb469c4",
"rev": "b18a4b905f8d028dc4476412e6d6891728695379",
"type": "github"
},
"original": {
@@ -239,11 +254,11 @@
]
},
"locked": {
"lastModified": 1780265777,
"narHash": "sha256-t/KORFHEv8Jn2vFmVfv4Zffekv+MUogI2KgtxuCcEmQ=",
"lastModified": 1787161289,
"narHash": "sha256-CVTJnlo3KGv9XDT7594byKZAT2cZAMQUVvY4/1plK8M=",
"owner": "nix-community",
"repo": "nur",
"rev": "39917b7f68263188707925ffe26c9df6ef4e7d64",
"rev": "512f014a5717fd8181e971f7a0d12901e35521d3",
"type": "github"
},
"original": {
@@ -273,11 +288,11 @@
]
},
"locked": {
"lastModified": 1777944972,
"narHash": "sha256-VfGRo1qTBKOe3s2gOv8LSoA6Fk19PvBlwQ1ECN0Evn8=",
"lastModified": 1786629091,
"narHash": "sha256-gkig4nPi1CWc4Z50GBsjE4ygSE7hMpl/TwID2an2Cck=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "c591bf665727040c6cc5cb409079acb22dcce33c",
"rev": "a8627b21b9107c5711c96b84f32a9a4b3d45295f",
"type": "github"
},
"original": {
@@ -286,34 +301,16 @@
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"vscode-server": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
"flake-parts": "flake-parts_2"
},
"locked": {
"lastModified": 1770124655,
"narHash": "sha256-yHmd2B13EtBUPLJ+x0EaBwNkQr9LTne1arLVxT6hSnY=",
"lastModified": 1784312229,
"narHash": "sha256-2uHCSUw341o3my1R0U0YCfbnMEazylxb58evWsjGL50=",
"owner": "nix-community",
"repo": "nixos-vscode-server",
"rev": "92ce71c3ba5a94f854e02d57b14af4997ab54ef0",
"rev": "2f984dfbe7e5271b5c413d3e734374cc1306c921",
"type": "github"
},
"original": {
+1 -1
View File
@@ -32,7 +32,7 @@
vscode-server = {
url = "github:nix-community/nixos-vscode-server";
inputs.nixpkgs.follows = "nixpkgs";
# inputs.nixpkgs.follows = "nixpkgs";
};
};
+33
View File
@@ -1,6 +1,7 @@
{ lib, config, pkgs, ... }:
let
configuredMpv = config.programs.mpv.finalPackage;
shimWatchdog = pkgs.custom.jellyfin-mpv-shim-watchdog;
in{
config = lib.mkIf (config.syscfg.make.gui) {
@@ -81,5 +82,37 @@ in{
};
programs.yt-dlp.enable = true;
# The upstream jellyfin-mpv-shim service has no Restart and no network
# ordering: it happily starts while offline (silently dead) and never
# recovers a connection dropped by a network blip. Gate its start on the
# network being up, and let a watchdog notice the "up but not connected"
# state that systemd can't see. See pkgs.custom.jellyfin-mpv-shim-watchdog.
systemd.user.services.jellyfin-mpv-shim.Service = {
ExecStartPre = "${shimWatchdog}/bin/jellyfin-mpv-shim-watchdog wait-online";
TimeoutStartSec = "infinity"; # stay in start-pre until the network is back
Restart = "on-failure";
RestartSec = 5;
};
systemd.user.services.jellyfin-mpv-shim-watchdog = {
Unit = {
Description = "Restart jellyfin-mpv-shim when it is up but not connected";
After = [ "jellyfin-mpv-shim.service" ];
};
Service = {
Type = "oneshot";
ExecStart = "${shimWatchdog}/bin/jellyfin-mpv-shim-watchdog check";
};
};
systemd.user.timers.jellyfin-mpv-shim-watchdog = {
Unit.Description = "Periodic health check for jellyfin-mpv-shim";
Timer = {
OnActiveSec = "60s";
OnUnitActiveSec = "60s";
};
Install.WantedBy = [ "timers.target" ];
};
};
}
+1 -1
View File
@@ -5,7 +5,7 @@
home.packages = with pkgs;
[
# custom.simc
unstable.instawow
instawow
];
# templates buggy currently
+12 -2
View File
@@ -2,6 +2,16 @@
let
ensureDaemon = pkgs.custom.eww-ensure-daemon;
ewwCleanStart = pkgs.writeShellScript "eww-clean-start" ''
uid="$(${pkgs.coreutils}/bin/id -u)"
runtime_dir="''${XDG_RUNTIME_DIR:-/run/user/$uid}"
${pkgs.procps}/bin/pkill -TERM -x -u "$uid" eww >/dev/null 2>&1 || true
${pkgs.coreutils}/bin/sleep 0.2
${pkgs.procps}/bin/pkill -KILL -x -u "$uid" eww >/dev/null 2>&1 || true
${pkgs.coreutils}/bin/rm -f "$runtime_dir"/eww-server_*
'';
openOnCurrentScreen = pkgs.writeShellScriptBin "eww-open-on-current-screen" ''
window="$1"
shift
@@ -75,9 +85,9 @@ in {
};
Service = {
Type = "simple";
ExecStartPre = "${pkgs.bash}/bin/bash -c 'rm -f \"\${XDG_RUNTIME_DIR:-/run/user/$(id -u)}\"/eww-server_*'";
ExecStartPre = "${ewwCleanStart}";
ExecStart = "${lib.getExe pkgs.eww} daemon --no-daemonize";
Restart = "on-failure";
Restart = "always";
RestartSec = 1;
};
Install.WantedBy = [ "graphical-session.target" ];
+2
View File
@@ -7,4 +7,6 @@
vosk = pkgs.callPackage ./vosk { };
eww-ensure-daemon = pkgs.callPackage ./eww-ensure-daemon { };
jellyfin-mpv-shim-watchdog = pkgs.callPackage ./jellyfin-mpv-shim-watchdog { };
}
+48 -9
View File
@@ -1,19 +1,58 @@
{ lib, writeShellScriptBin, eww, systemd }:
{ lib
, writeShellScriptBin
, coreutils
, eww
, procps
, systemd
, util-linux
}:
# `eww open` silently becomes a NEW daemon when it can't reach the socket,
# rebinding the same socket path and orphaning the previous daemon. The old
# daemon keeps rendering its layer-shell surfaces but no longer answers any
# `eww close` — that is the "zombie panel I can't close" / "bar opened twice".
# Every open path must go through here first, so the socket is always live
# before a client touches it and no client ever self-daemonizes.
# Every open path must go through here first, so the socket is always live and
# owned by the managed user service before a client touches it.
writeShellScriptBin "eww-ensure-daemon" ''
${lib.getExe eww} ping >/dev/null 2>&1 && exit 0
eww=${lib.getExe eww}
uid="$(${coreutils}/bin/id -u)"
runtime_dir="''${XDG_RUNTIME_DIR:-/run/user/$uid}"
lock_file="$runtime_dir/eww-ensure-daemon.lock"
${systemd}/bin/systemctl --user start eww.service >/dev/null 2>&1 || true
service_active() {
${systemd}/bin/systemctl --user is-active --quiet eww.service
}
for _ in $(seq 1 100); do
${lib.getExe eww} ping >/dev/null 2>&1 && exit 0
sleep 0.1
daemon_healthy() {
"$eww" ping >/dev/null 2>&1 && service_active
}
wait_for_ping() {
i=0
while [ "$i" -lt 100 ]; do
daemon_healthy && return 0
${coreutils}/bin/sleep 0.1
i=$((i + 1))
done
exit 1
return 1
}
daemon_healthy && exit 0
${coreutils}/bin/mkdir -p "$runtime_dir"
(
${util-linux}/bin/flock -x 9
daemon_healthy && exit 0
${systemd}/bin/systemctl --user stop eww.service >/dev/null 2>&1 || true
${procps}/bin/pkill -TERM -x -u "$uid" eww >/dev/null 2>&1 || true
${coreutils}/bin/sleep 0.2
${procps}/bin/pkill -KILL -x -u "$uid" eww >/dev/null 2>&1 || true
${coreutils}/bin/rm -f "$runtime_dir"/eww-server_*
${systemd}/bin/systemctl --user reset-failed eww.service >/dev/null 2>&1 || true
${systemd}/bin/systemctl --user start eww.service >/dev/null 2>&1 || true
wait_for_ping
) 9>"$lock_file"
''
@@ -0,0 +1,51 @@
{ writeShellScriptBin
, coreutils
, findutils
, gnugrep
, iproute2
, systemd
}:
# jellyfin-mpv-shim keeps a persistent socket to the Jellyfin server. When the
# machine drops off the network that socket dies, but the process stays alive
# and the unit stays "active" — running yet deaf to cast requests, the "up but
# not working, restart it by hand" case. systemd can't see this: nothing
# crashes and the shim speaks no health protocol, so we probe the real thing —
# is its MainPID still holding a live (established, non-loopback) connection?
#
# check (default) one tick, run by a 60s timer: restart if online but
# not connected, rate-limited to one restart per 5 min
# wait-online block until a real address exists; used as ExecStartPre so the
# unit only starts once online
writeShellScriptBin "jellyfin-mpv-shim-watchdog" ''
set -u
service="jellyfin-mpv-shim.service"
stamp="''${XDG_RUNTIME_DIR:-/run/user/$(${coreutils}/bin/id -u)}/jellyfin-mpv-shim-watchdog.stamp"
# A global-scope address on a non-loopback interface true for a LAN IP too,
# so this needs no server URL and works whether Jellyfin is local or remote.
network_up() { ${iproute2}/bin/ip -o addr show scope global up 2>/dev/null | ${gnugrep}/bin/grep -q .; }
if [ "''${1:-check}" = wait-online ]; then
while ! network_up; do ${coreutils}/bin/sleep 5; done
exit 0
fi
# Healthy: MainPID owns an established socket to something other than loopback.
pid="$(${systemd}/bin/systemctl --user show -p MainPID --value "$service" 2>/dev/null)"
if [ "''${pid:-0}" != 0 ] && ${iproute2}/bin/ss -tnpH state established 2>/dev/null \
| ${gnugrep}/bin/grep "pid=$pid," \
| ${gnugrep}/bin/grep -qv -e '127\.0\.0\.1' -e '\[::1\]'; then
exit 0
fi
# Not connected: only worth restarting once the network is actually back...
network_up || exit 0
# ...and not if we already restarted within the last 5 minutes.
[ -e "$stamp" ] && [ -n "$(${findutils}/bin/find "$stamp" -mmin -5 2>/dev/null)" ] && exit 0
: > "$stamp"
echo "jellyfin-mpv-shim-watchdog: online but no live connection -> restarting $service"
${systemd}/bin/systemctl --user restart "$service"
''
+1 -1
View File
@@ -38,7 +38,7 @@ pkgs.mkShell {
#CUSTOM (custom...)
]) ++ (with pkgs.llvmPackages; [
libcxxClang
]) ++ (with pkgs.python313Packages; [
]) ++ (with pkgs.python3Packages; [
pip pandas numpy matplotlib typer pillow reportlab python-barcode pypdf markdown requests
])
;