Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions nixos/home/cloudflare-quota-export.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# cloudflare-quota-export — the Cloudflare quota exporter
# (developing-today/code#1048), run every 15 minutes as a
# quota-gatherer tick (developing-today/code#1151).
#
# Home-manager module: imported by the amd host config
# (nixos/hosts/default.nix) with
# services.cloudflare-quota-export.enable = true.
#
# Folded into the flake 2026-11-01 (developing-today/code#3720):
# until now the units were plain files in ~/.config/systemd/user.
# Semantics are replicated exactly; only provenance changes. The
# script itself stays at ~/atlas/cloudflare-export/, next to the
# data it exports.
{
config,
lib,
...
}:
let
cfg = config.services.cloudflare-quota-export;
in
{
options.services.cloudflare-quota-export = {
enable = lib.mkEnableOption "the Cloudflare quota exporter (code#1048)";
};

config = lib.mkIf cfg.enable {
systemd.user.services.cloudflare-quota-export = {
Unit = {
Description = "Cloudflare quota exporter — code#1048";
After = [ "network-online.target" ];
};
Service = {
Type = "oneshot";
TimeoutStartSec = 120;
ExecStart = "%h/atlas/cloudflare-export/cloudflare-quota-export.sh --out-dir %h/atlas/cloudflare-export";
};
};

systemd.user.timers.cloudflare-quota-export = {
Unit.Description = "Run the Cloudflare quota exporter every 15 minutes — code#1048 (gatherer tick, #1151)";
Timer = {
OnCalendar = "*:0/15";
RandomizedDelaySec = 20;
Persistent = true;
Unit = "cloudflare-quota-export.service";
};
Install.WantedBy = [ "timers.target" ];
};
};
}
47 changes: 47 additions & 0 deletions nixos/home/dashboard-backup.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# dashboard-backup — the daily dashboard/orchestration data
# backup, laptop leg (developing-today/code#1459). Script:
# ~/tools/dashboard-backup.sh, maintained by its author there.
#
# Home-manager module: imported by the amd host config
# (nixos/hosts/default.nix) with services.dashboard-backup.enable = true.
#
# Folded into the flake 2026-11-01 (developing-today/code#3720):
# until now the units were plain files in ~/.config/systemd/user.
# Semantics are replicated exactly; only provenance changes.
#
# NOT the flake's pm-dashboard-backup (nixos/home/laptop-backups.nix,
# code#1516): that is a separate, newer job. This older job is folded
# in as-is; merging the two backups is a separate decision.
{
config,
lib,
...
}:
let
cfg = config.services.dashboard-backup;
in
{
options.services.dashboard-backup = {
enable = lib.mkEnableOption "the daily dashboard backup, laptop leg (code#1459)";
};

config = lib.mkIf cfg.enable {
systemd.user.services.dashboard-backup = {
Unit.Description = "Daily dashboard/orchestration data backup (laptop leg, code#1459)";
Service = {
Type = "oneshot";
ExecStart = "%h/tools/dashboard-backup.sh";
};
};

systemd.user.timers.dashboard-backup = {
Unit.Description = "Run dashboard backup daily ~04:30 local (code#1459)";
Timer = {
OnCalendar = "*-*-* 04:30:00";
Persistent = true;
Unit = "dashboard-backup.service";
};
Install.WantedBy = [ "timers.target" ];
};
};
}
81 changes: 81 additions & 0 deletions nixos/home/github-backup.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# github-backup — the GitHub estate mirror system's laptop timers
# (developing-today/code#3215): drain the Worker webhook queue every
# 5 minutes, fetch all mirrors daily, reconcile weekly.
#
# Home-manager module: imported by the amd host config
# (nixos/hosts/default.nix) with services.github-backup.enable = true.
#
# Folded into the flake 2026-11-01 (developing-today/code#3720):
# until now these units were plain files in ~/.config/systemd/user
# installed by infra/github-backup's installer. Semantics are
# replicated exactly; only provenance changes. The scripts stay in
# this repo and run from the primary checkout (~/git/code), per the
# fleet-feed-collector precedent. The drain wrapper
# (infra/github-backup/systemd/drain-wrapper.sh) sources the Worker
# URL + bearer from Bitwarden by name at runtime, so the units need
# no Environment of their own.
{
config,
lib,
...
}:
let
cfg = config.services.github-backup;
home = config.home.homeDirectory;
infra = "${home}/git/code/infra/github-backup";
netService = description: execStart: {
Unit = {
Description = description;
After = [ "network-online.target" ];
Wants = [ "network-online.target" ];
};
Service = {
Type = "oneshot";
ExecStart = execStart;
WorkingDirectory = "%h/backups/github";
};
};
in
{
options.services.github-backup = {
enable = lib.mkEnableOption "the github-backup mirror timers (drain, fetch, reconcile)";
};

config = lib.mkIf cfg.enable {
systemd.user.services = {
github-backup-drain = netService "github-backup: drain webhook queue from the Worker and fetch" "${infra}/systemd/drain-wrapper.sh";
github-backup-fetch = netService "github-backup: daily fetch of all mirrors" "/usr/bin/env python3 ${infra}/bin/fetch_mirrors.py";
github-backup-reconcile = netService "github-backup: weekly reconciliation sweep" "/usr/bin/env python3 ${infra}/bin/reconcile.py";
};

systemd.user.timers = {
github-backup-drain = {
Unit.Description = "github-backup queue drain (every 5 min)";
Timer = {
OnBootSec = "3min";
OnUnitActiveSec = "5min";
Persistent = true;
};
Install.WantedBy = [ "timers.target" ];
};
github-backup-fetch = {
Unit.Description = "github-backup fetch (daily)";
Timer = {
OnCalendar = "daily";
Persistent = true;
RandomizedDelaySec = "30m";
};
Install.WantedBy = [ "timers.target" ];
};
github-backup-reconcile = {
Unit.Description = "github-backup reconcile (weekly)";
Timer = {
OnCalendar = "weekly";
Persistent = true;
RandomizedDelaySec = "2h";
};
Install.WantedBy = [ "timers.target" ];
};
};
};
}
50 changes: 50 additions & 0 deletions nixos/home/meta-quota-export.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# meta-quota-export — the Meta (dev.meta.ai) quota exporter
# (developing-today/code#1301 Phase 1), run every 15 minutes.
#
# Home-manager module: imported by the amd host config
# (nixos/hosts/default.nix) with
# services.meta-quota-export.enable = true.
#
# Folded into the flake 2026-11-01 (developing-today/code#3720):
# until now the units were plain files in ~/.config/systemd/user.
# Semantics are replicated exactly; only provenance changes. The
# script itself stays at ~/atlas/meta-quota-export/, next to the
# data it exports, and runs under the system node.
{
config,
lib,
...
}:
let
cfg = config.services.meta-quota-export;
in
{
options.services.meta-quota-export = {
enable = lib.mkEnableOption "the Meta quota exporter (code#1301)";
};

config = lib.mkIf cfg.enable {
systemd.user.services.meta-quota-export = {
Unit = {
Description = "Meta (dev.meta.ai) quota exporter — code#1301 Phase 1";
After = [ "network-online.target" ];
};
Service = {
Type = "oneshot";
TimeoutStartSec = 120;
ExecStart = "/run/current-system/sw/bin/node %h/atlas/meta-quota-export/meta-quota-export.mjs --cdp-port 19222 --out-dir %h/atlas/meta-quota-export";
};
};

systemd.user.timers.meta-quota-export = {
Unit.Description = "Run the Meta quota exporter every 15 minutes — code#1301 Phase 1";
Timer = {
OnCalendar = "*:0/15";
RandomizedDelaySec = 20;
Persistent = true;
Unit = "meta-quota-export.service";
};
Install.WantedBy = [ "timers.target" ];
};
};
}
49 changes: 49 additions & 0 deletions nixos/home/oc-password-sync.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# oc-password-sync — sync the OpenChamber upstream password from
# the prod OpenCode service file (developing-today/openchamber#894).
# A .path unit watches the prod service file
# (~/.local/state/opencode/service-prod.json) and triggers the
# oneshot service on change; the .path unit is the one enabled into
# default.target. (The service file also carries its own
# [Install] WantedBy=default.target, dormant in practice; it is
# replicated as installed.) Script: ~/.local/bin/oc-password-sync.sh.
#
# Home-manager module: imported by the amd host config
# (nixos/hosts/default.nix) with services.oc-password-sync.enable = true.
#
# Folded into the flake 2026-11-01 (developing-today/code#3720):
# until now the units were plain files in ~/.config/systemd/user.
# Semantics are replicated exactly; only provenance changes.
{
config,
lib,
...
}:
let
cfg = config.services.oc-password-sync;
home = config.home.homeDirectory;
in
{
options.services.oc-password-sync = {
enable = lib.mkEnableOption "the OpenChamber upstream password sync (openchamber#894)";
};

config = lib.mkIf cfg.enable {
systemd.user.services.oc-password-sync = {
Unit.Description = "Sync OpenChamber upstream password from prod OpenCode service file (openchamber#894)";
Service = {
Type = "oneshot";
ExecStart = "${home}/.local/bin/oc-password-sync.sh";
};
Install.WantedBy = [ "default.target" ];
};

systemd.user.paths.oc-password-sync = {
Unit.Description = "Watch prod OpenCode service file for password rotation (openchamber#894)";
Path = {
PathChanged = "${home}/.local/state/opencode/service-prod.json";
Unit = "oc-password-sync.service";
};
Install.WantedBy = [ "default.target" ];
};
};
}
61 changes: 61 additions & 0 deletions nixos/home/worktree-reaper.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# worktree-reaper — hourly retirement of dead fleet worktrees on
# the laptop under Drew's 6-hour quiet rule
# (developing-today/code#3698).
#
# Home-manager module: imported by the amd host config
# (nixos/hosts/default.nix) with services.worktree-reaper.enable = true.
#
# Folded into the flake 2026-11-01 (developing-today/code#3720).
# Until now the unit was a plain file in ~/.config/systemd/user,
# installed by infra/worktree-reaper/systemd/install-units.sh from
# the pre-merge bootstrap worktree ~/git/code-wt-reaper, and its
# ExecStart pointed there. The fold's one intentional unit change:
# ExecStart now points at the canonical primary checkout
# (~/git/code/infra/worktree-reaper/...), retiring the bootstrap
# install per the worktree-reaper README. Every other field is
# replicated exactly. All reaper state (config overlay, run logs,
# the DISABLED kill switch) lives in ~/.local/state/worktree-reaper/
# and is unaffected by where the unit comes from; the script reads
# the config.json shipped beside it in infra/worktree-reaper and
# merges the state-dir overlay on top, as before.
{
config,
lib,
...
}:
let
cfg = config.services.worktree-reaper;
home = config.home.homeDirectory;
in
{
options.services.worktree-reaper = {
enable = lib.mkEnableOption "the worktree reaper (hourly dead-worktree retirement, code#3698)";
};

config = lib.mkIf cfg.enable {
systemd.user.services.worktree-reaper = {
Unit = {
Description = "worktree-reaper: retire dead fleet worktrees (6-hour quiet rule)";
After = [ "network-online.target" ];
Wants = [ "network-online.target" ];
};
Service = {
Type = "oneshot";
ExecStart = "/usr/bin/env python3 ${home}/git/code/infra/worktree-reaper/bin/worktree_reaper.py";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Merge the reaper implementation before switching its path

On a primary checkout of this commit, the newly enabled service invokes a script that does not exist: the target commit's recursive Git tree and repository-wide searches contain no infra/worktree-reaper implementation or generator supplying it. Consequently, each hourly run exits with Python's file-not-found error instead of retiring worktrees. The commit message acknowledges the dependency on #3698, but that prerequisite is not present in the reviewed tree; merge it before landing this change, or retain the bootstrap execution path until then.

Useful? React with 👍 / 👎.

WorkingDirectory = "%h";
TimeoutStartSec = "6h";
Nice = 10;
};
};

systemd.user.timers.worktree-reaper = {
Unit.Description = "worktree-reaper (hourly)";
Timer = {
OnCalendar = "hourly";
Persistent = true;
RandomizedDelaySec = "10m";
};
Install.WantedBy = [ "timers.target" ];
};
};
}
Loading