Fetch based system update
This commit is contained in:
parent
e1e679a4ab
commit
e21663c8e3
|
@ -58,6 +58,7 @@ let
|
||||||
++ [
|
++ [
|
||||||
(makeAutostart "kassandra2")
|
(makeAutostart "kassandra2")
|
||||||
(makeAutostart "unlock-ssh")
|
(makeAutostart "unlock-ssh")
|
||||||
|
./roles/refresh-config.nix
|
||||||
./roles/firefox.nix
|
./roles/firefox.nix
|
||||||
./roles/kassandra.nix
|
./roles/kassandra.nix
|
||||||
./roles/mode-switching.nix
|
./roles/mode-switching.nix
|
||||||
|
@ -138,7 +139,6 @@ in {
|
||||||
./roles/untrusted-env.nix
|
./roles/untrusted-env.nix
|
||||||
];
|
];
|
||||||
zeus = daily-driver "zeus" [
|
zeus = daily-driver "zeus" [
|
||||||
./roles/hourly-maintenance.nix
|
|
||||||
(import ./roles/state.nix "orga")
|
(import ./roles/state.nix "orga")
|
||||||
./roles/trusted-env.nix
|
./roles/trusted-env.nix
|
||||||
./roles/monitor-config
|
./roles/monitor-config
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
in {
|
in {
|
||||||
systemd.user = {
|
systemd.user = {
|
||||||
services.update-config = {
|
services.update-config = {
|
||||||
Unit.Description = "Routine maintenance";
|
Unit.Description = "Fetch config repo";
|
||||||
Service = {
|
Service = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = "${configGit} pull --ff-only";
|
ExecStart = "${configGit} fetch origin main";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
timers.update-config = {
|
timers.update-config = {
|
|
@ -7,6 +7,7 @@ import Control.Exception (catch, onException)
|
||||||
import Control.Exception qualified as Exception
|
import Control.Exception qualified as Exception
|
||||||
import Data.ByteString.Char8 qualified as ByteString
|
import Data.ByteString.Char8 qualified as ByteString
|
||||||
import Data.ByteString.Lazy qualified as LBS
|
import Data.ByteString.Lazy qualified as LBS
|
||||||
|
import Data.ByteString.Lazy.Char8 qualified as LBSC
|
||||||
import Data.String.Interpolate (i)
|
import Data.String.Interpolate (i)
|
||||||
import Data.Text qualified as Text
|
import Data.Text qualified as Text
|
||||||
import Data.Time qualified as Time
|
import Data.Time qualified as Time
|
||||||
|
@ -214,7 +215,14 @@ main = do
|
||||||
, simpleModule (5 * oneSecond) $ do
|
, simpleModule (5 * oneSecond) $ do
|
||||||
current_kernel <- readlink "/run/current-system/kernel" |> captureTrim
|
current_kernel <- readlink "/run/current-system/kernel" |> captureTrim
|
||||||
booted_kernel <- readlink "/run/booted-system/kernel" |> captureTrim
|
booted_kernel <- readlink "/run/booted-system/kernel" |> captureTrim
|
||||||
when' (current_kernel /= booted_kernel) $ withColor "ffff00" "Booted kernel stale"
|
when' (current_kernel /= booted_kernel) $ withColor yellow "Booted kernel stale"
|
||||||
|
, simpleModule (5 * oneSecond) $ do
|
||||||
|
mode <- read_mode
|
||||||
|
behind <-
|
||||||
|
if mode /= Klausur
|
||||||
|
then tryCmd (git "--no-optional-locks" "-C" git_dir "log" "--oneline" "origin/main" "^main")
|
||||||
|
else pure ""
|
||||||
|
when' (not $ LBS.null behind) $ withColor yellow [i|Config #{show (length (LBSC.lines behind))} commits behind.|]
|
||||||
, \var -> do
|
, \var -> do
|
||||||
commit_var <- newTVarIO ""
|
commit_var <- newTVarIO ""
|
||||||
system_var <- newTVarIO ""
|
system_var <- newTVarIO ""
|
||||||
|
|
Loading…
Reference in a new issue