← Back to Pull requests

Add a NixOS module #236

Closed
unknown closed this pull request without merging on Oct 26, 2026 04:00 UTC
View on GitHub
unknown unknown commented on Oct 25, 2026 17:12 UTC
Author

Adds a NixOS module to the flake, so radar can be run as a service from Nix in addition to the package the flake already exports. Modeled on the module in parkr/ping.

inputs.radar.url = "github:parkr/radar";

# in a NixOS configuration:
imports = [ inputs.radar.nixosModules.default ];
services.radar = {
  enable = true;
  repo = "owner/name";
  allowedSenders = [ "me@example.com" ];
  mention = "@me";
  mailgunDomain = "example.com";
  environmentFile = "/run/secrets/radar.env";   # GITHUB_ACCESS_TOKEN, MG_API_KEY, MG_PUBLIC_API_KEY
  hour = "08";
  timeZone = "UTC";
  feed = {                                      # optional Atom feed at /feed.atom
    title = "owner/name";
    url = "https://radar.example.com/feed.atom";
    apiKeyFile = "/run/secrets/radar-feed-key";
  };
};

Features

  • Typed options that reject bad input when the configuration is evaluated, not at runtime. For example, repo must be owner/name: radar splits RADAR_REPO on / without checking, so anything else would crash it.

  • Schedule. hour and timeZone set when the day's issue is generated. radar compares -hour to the process's local hour, so the module sets TZ explicitly (default UTC, matching the Docker image) and supplies the zone database instead of assuming the host has one. radar checks on a timer that fires every hour from process start, and generates at the first check inside the configured hour; SIGUSR2 generates one immediately regardless.

  • Secrets stay out of the Nix store. They come from environmentFile; the feed's API key is passed as a systemd credential and merged into the feed config at start.

  • Optional Atom feed, off unless feed is set.

  • Hardened service. A DynamicUser with no capabilities (a port below 1024 gets CAP_NET_BIND_SERVICE), a read-only filesystem, restricted address families, and no state of its own. Listens on loopback by default; openFirewall is opt-in.
  • Tests

    checks.<linux>.nixos-module evaluates the module in minimal systems and asserts on the result, including that invalid values for repo, hour, timeZone, the senders, the domain and the port are rejected. checks.<linux>.nixos-module-runtime starts the real binary with the arguments and environment the module generates and checks the schedule log line, /health, and that /feed.atom is gated. The existing Nix workflow runs nix flake check on PRs.

    🤖 Generated with Claude Code

    Diff: 311 lines (+233 / -78) across 3 files Reviewer: parkr Review duration: 648m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 311 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.344
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #236"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.3% (MEDIUM) · Higher = larger blast radius
    40.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.9% · Safe to merge
    15.9%
    Repository