Skip to content

fix: improve docker ci cache reuse - #1597

Closed
shunkakinoki wants to merge 4 commits into
mainfrom
fix/docker-cache-reuse
Closed

fix: improve docker ci cache reuse#1597
shunkakinoki wants to merge 4 commits into
mainfrom
fix/docker-cache-reuse

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • move GitHub token handling into install.sh via transient NIX_CONFIG instead of Docker build args/layers
  • add scripts/nix-cache-warmup.sh and wire it through make nix-cache-warmup before install build/switch
  • add a stable Docker pre-warm layer keyed by flake.nix, flake.lock, lib, Makefile, and the warmup script
  • keep PR Docker builds cacheable without pushing image tags/digests, while main pushes still publish manifests
  • shrink Docker build context with .dockerignore

Validation

  • git diff --check
  • sh -n install.sh
  • sh -n scripts/nix-cache-warmup.sh
  • shellcheck install.sh scripts/nix-cache-warmup.sh
  • make nix-cache-warmup
  • IN_DOCKER=true make -C nix-cache-warmup
  • nix run nixpkgs#actionlint -- .github/workflows/docker.yml
  • docker buildx build --progress=plain --check --secret id=github_token,env=GITHUB_TOKEN --build-arg COMMIT_SHA=$(git rev-parse HEAD) --build-arg GITHUB_PR= -f Dockerfile .

@mesa-dot-dev

mesa-dot-dev Bot commented Apr 27, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6c314936-7b36-4644-8f64-e40f7d1ad3f6

📥 Commits

Reviewing files that changed from the base of the PR and between 4dbfd64 and e01539b.

📒 Files selected for processing (2)
  • config/noctalia/default.nix
  • spec/coverage_spec.sh
✅ Files skipped from review due to trivial changes (2)
  • config/noctalia/default.nix
  • spec/coverage_spec.sh

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features

    • Added dark mode toggle widget to shell interface.
  • Improvements

    • Enhanced security of GitHub token handling during build processes.
    • Optimized Nix build performance through cache warming mechanism.
    • Improved robustness of git metadata resolution with fallback handling.
    • Faster installation times through pre-build cache initialization.

Walkthrough

Migrates Nix GitHub token handling from embedding credentials in the Docker image to BuildKit secrets, adds a pre-install Nix flake cache warmup, stages flake/install files into the image for local execution, hardens Makefile git metadata handling, and adds tests and coverage entries for the new warmup script. Also adds a DarkModeToggle widget.

Changes

Nix Token & Cache Warmup

Layer / File(s) Summary
Build args / Dockerfile layout
Dockerfile
Removes embedded access-tokens and ARG GITHUB_TOKEN; changes ARG COMMIT_SHA/ARG GITHUB_PR; copies flake/install into /tmp/dotfiles-cache/.
Pre-install cache warmup (Docker build step)
Dockerfile
Starts nix-daemon, runs make -C /tmp/dotfiles-cache nix-cache-warmup with GITHUB_TOKEN_FILE (BuildKit secret) available, then runs copied install.sh with COMMIT_SHA, GITHUB_PR, and GITHUB_TOKEN_FILE.
Cache warmup script
scripts/nix-cache-warmup.sh
New script: reads token from GITHUB_TOKEN or GITHUB_TOKEN_FILE, appends access-tokens = github.com=$token to NIX_CONFIG if present, exits 0 when nix missing, runs nix flake metadata "$repo_dir" "$@" --no-write-lock-file.
Makefile integration
Makefile
Adds nix-cache-warmup target (runs ./scripts/nix-cache-warmup.sh after nix-connect/nix-trust); makes install, nix-build, and nix-switch depend on it; hardens git metadata lookups with stderr suppression and fallback commit sha.
Installer token wiring
install.sh
Reads GitHub token from GITHUB_TOKEN or readable GITHUB_TOKEN_FILE, constructs/appends NIX_CONFIG="access-tokens = github.com=$NIX_GITHUB_TOKEN", exports NIX_CONFIG, confirms, then unsets token variable.
Tests & coverage
spec/nix_cache_warmup_spec.sh, spec/coverage_spec.sh
Adds spec verifying script header, strict mode, token handling, nix availability behavior, nix flake metadata invocation with --no-write-lock-file; adds new script to covered_scripts.

Noctalia Bar Widget

Layer / File(s) Summary
UI config change
config/noctalia/default.nix
Inserts { id = "DarkModeToggle"; } into programs.noctalia-shell.settings.bar.widgets.right after Battery.

Sequence Diagram

sequenceDiagram
    actor Builder as Docker Builder
    participant Docker as Image Build
    participant Secret as BuildKit Secret
    participant Daemon as Nix Daemon
    participant Make as Make (nix-cache-warmup)
    participant Warmup as nix-cache-warmup.sh
    participant Install as install.sh
    participant Nix as nix CLI

    Builder->>Docker: COPY flake + scripts -> /tmp/dotfiles-cache/
    Builder->>Secret: Mount github_token as secret -> GITHUB_TOKEN_FILE
    Docker->>Daemon: Start nix-daemon
    Docker->>Make: make -C /tmp/dotfiles-cache nix-cache-warmup (GITHUB_TOKEN_FILE)
    Make->>Warmup: invoke scripts/nix-cache-warmup.sh . $(NIX_FLAGS)
    Warmup->>Secret: read token from GITHUB_TOKEN_FILE (if present)
    Warmup->>Warmup: set NIX_CONFIG access-tokens entry
    Warmup->>Nix: run `nix flake metadata` --no-write-lock-file
    Nix-->>Warmup: returns metadata (cache warmed)
    Docker->>Install: sh /tmp/dotfiles-cache/install.sh (COMMIT_SHA, GITHUB_PR, GITHUB_TOKEN_FILE)
    Install->>Secret: read token from GITHUB_TOKEN_FILE (if present)
    Install->>Install: export NIX_CONFIG with access-tokens
    Install->>Nix: perform Nix operations for install
    Nix-->>Install: installation complete
    Install-->>Docker: dotfiles installed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

bug

"I'm a rabbit in the build flow bright,
I hide no tokens in the image night.
I warm the flake cache with a happy hop,
then stage the install and tip my top.
Secrets kept safe, the build takes flight!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'fix: improve docker ci cache reuse' directly relates to the main changes: moving token handling, adding cache-warmup script, and creating a stable Docker pre-warm layer for better cache reuse.
Description check ✅ Passed The PR description provides comprehensive context for all major changes including GitHub token handling refactor, new nix-cache-warmup.sh script, Docker layer improvements, and validation steps performed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/docker-cache-reuse

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mesa-dot-dev

mesa-dot-dev Bot commented Apr 27, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Improved Docker CI cache reuse and build performance by centralizing GitHub token handling, adding a Nix cache warming script, and optimizing the Docker build context.

What changed?

  • Makefile: Introduced a nix-cache-warmup target as a prerequisite for nix-build and nix-switch to enhance build performance, and refined git variable assignments.
  • Dockerfile: Updated to syntax 1.7, now directly copies local dotfiles, utilizes a mounted secret for github_token for Nix cache pre-population, removed curl for install.sh, and simplified nix.conf.
  • install.sh: Modified to automatically configure a GitHub access token for Nix during installation using GITHUB_TOKEN environment variable or GITHUB_TOKEN_FILE.
  • scripts/nix-cache-warmup.sh: Added a new script to prepare the Nix environment by configuring a GitHub token and using nix flake metadata to fetch and cache Nix dependencies without altering the lock file.
  • spec/nix_cache_warmup_spec.sh: Introduced a new shell test suite to thoroughly validate the scripts/nix-cache-warmup.sh script, covering token handling and Nix flake metadata processing.
  • config/noctalia/default.nix: A Dark Mode Toggle was added to the quick settings options.

Description generated by Mesa. Update settings

@shunkakinoki
shunkakinoki force-pushed the fix/docker-cache-reuse branch from f434539 to f2b39cd Compare April 27, 2026 14:08

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 5 files

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request improves the security and efficiency of the build process by utilizing Docker secrets for GitHub tokens instead of build arguments and adding a Nix cache warmup step to the Makefile. Additionally, the install.sh script now dynamically configures Nix access tokens from environment variables or secret files. A review comment suggests using a space instead of a newline when appending to the NIX_CONFIG environment variable to ensure better compatibility and readability.

Comment thread install.sh Outdated
Comment on lines +50 to +51
NIX_CONFIG="${NIX_CONFIG}
access-tokens = github.com=$NIX_GITHUB_TOKEN"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

When appending to NIX_CONFIG, it is safer to ensure there is a space or newline between existing configuration and the new access-tokens entry. While the literal newline works in most POSIX-compliant shells, using a space as a separator is more conventional for environment variable based configuration if it's intended to be a single line, or ensuring the newline is robustly handled.

Suggested change
NIX_CONFIG="${NIX_CONFIG}
access-tokens = github.com=$NIX_GITHUB_TOKEN"
NIX_CONFIG="${NIX_CONFIG} access-tokens = github.com=$NIX_GITHUB_TOKEN"

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
spec/nix_cache_warmup_spec.sh (1)

19-69: These checks only prove the strings exist, not that the script still behaves correctly.

Most of this spec is grep-based, so it will still pass if scripts/nix-cache-warmup.sh stops exporting NIX_CONFIG, mishandles GITHUB_TOKEN_FILE, or exits non-zero when nix is unavailable, as long as the same literals remain in the file. Since this script is now in the Docker build path, I'd add at least one execution-style spec with a stub nix command and controlled env.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@spec/nix_cache_warmup_spec.sh` around lines 19 - 69, Add an execution-style
test to replace the grep-only checks: run the script ($SCRIPT) in a temporary
PATH where a stub "nix" binary is provided (or absent) and with controlled env
vars (GITHUB_TOKEN and/or GITHUB_TOKEN_FILE) to assert real behavior — e.g.,
that NIX_CONFIG is exported/contains "access-tokens", that "unset
nix_github_token" occurs, that the script exits 0 when nix is missing and prints
"skipping cache warmup", and that "nix flake metadata" is invoked with
"--no-write-lock-file"; implement this in spec/nix_cache_warmup_spec.sh by
adding a new example which sets PATH to a temp dir with a stub `nix` script (or
leaves it out) and then executes "$SCRIPT" checking stdout/stderr and exit
status instead of only grepping literals like 'GITHUB_TOKEN', 'NIX_CONFIG', 'nix
flake metadata', '--no-write-lock-file', and 'repo_dir=${1:-.}'.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Dockerfile`:
- Around line 63-73: The Dockerfile currently defaults ARG COMMIT_SHA=main and
uses curl to fetch install.sh from GitHub, causing local builds to warm cache
from the checkout but then install a different revision; replace the remote curl
step with executing the checked-out install.sh from the build context (or ensure
the local copy is copied into the image) so branch-local changes are exercised.
Specifically, stop relying on COMMIT_SHA fallback to main in the RUN --mount=...
line and instead COPY the repository's install.sh into the image during build
and run that local file as the unprivileged user (referencing the existing ARG
COMMIT_SHA and the RUN --mount=type=secret,id=github_token,mode=0444 block and
the install invocation) so the image executes the exact checked-out script
rather than fetching main from GitHub.

In `@Makefile`:
- Around line 435-443: The nix-cache-warmup target lists prerequisites
(nix-connect, nix-trust) that are executed before the recipe, which bypasses the
in-recipe `command -v nix` guard on systems without Nix; to fix this, remove
nix-connect and nix-trust from the target prerequisites and instead invoke them
inside the recipe only after the `command -v nix` check (use $(MAKE) to run
nix-connect and nix-trust from within the if-branch), then proceed to run
./scripts/nix-cache-warmup.sh and echo success; keep the fallback echo in the
else branch unchanged so the skip message is shown when Nix is absent.
- Line 154: The install target currently lists "nix-cache-warmup" as a sibling
prerequisite so GNU Make may run it in parallel; change the dependency graph so
nix-cache-warmup runs before the expensive steps by making "nix-build" and
"nix-switch" depend on "nix-cache-warmup" (e.g., add a rule "nix-build:
nix-cache-warmup" and "nix-switch: nix-cache-warmup" or otherwise make them list
nix-cache-warmup as a prerequisite) instead of only listing all targets on the
"install" line.

---

Nitpick comments:
In `@spec/nix_cache_warmup_spec.sh`:
- Around line 19-69: Add an execution-style test to replace the grep-only
checks: run the script ($SCRIPT) in a temporary PATH where a stub "nix" binary
is provided (or absent) and with controlled env vars (GITHUB_TOKEN and/or
GITHUB_TOKEN_FILE) to assert real behavior — e.g., that NIX_CONFIG is
exported/contains "access-tokens", that "unset nix_github_token" occurs, that
the script exits 0 when nix is missing and prints "skipping cache warmup", and
that "nix flake metadata" is invoked with "--no-write-lock-file"; implement this
in spec/nix_cache_warmup_spec.sh by adding a new example which sets PATH to a
temp dir with a stub `nix` script (or leaves it out) and then executes "$SCRIPT"
checking stdout/stderr and exit status instead of only grepping literals like
'GITHUB_TOKEN', 'NIX_CONFIG', 'nix flake metadata', '--no-write-lock-file', and
'repo_dir=${1:-.}'.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 86834b37-98d3-41c4-bf1e-4209e2a98e92

📥 Commits

Reviewing files that changed from the base of the PR and between f434539 and 8e3a288.

📒 Files selected for processing (8)
  • .dockerignore
  • .github/workflows/docker.yml
  • Dockerfile
  • Makefile
  • install.sh
  • scripts/nix-cache-warmup.sh
  • spec/coverage_spec.sh
  • spec/nix_cache_warmup_spec.sh
✅ Files skipped from review due to trivial changes (1)
  • scripts/nix-cache-warmup.sh
🚧 Files skipped from review as they are similar to previous changes (2)
  • .dockerignore
  • install.sh

Comment thread Dockerfile Outdated
Comment thread Makefile Outdated
Comment thread Makefile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

8 issues found across 52 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Makefile">

<violation number="1" location="Makefile:302">
P2: `make update` no longer runs `nix-update`, so it no longer updates Nix despite the target description saying it does.</violation>
</file>

<file name="install.sh">

<violation number="1" location="install.sh:50">
P1: Preserve the newline separator here; a space can make the existing NIX_CONFIG entry and `access-tokens` collapse into one invalid line.</violation>
</file>

<file name="config/hermes/hydrate.sh">

<violation number="1" location="config/hermes/hydrate.sh:73">
P2: Escape secret values before using them in `sed` replacements; unescaped `&`, `|`, or `\` can break hydration and generate invalid config.</violation>
</file>

<file name=".github/workflows/docker.yml">

<violation number="1">
P1: `push: true` on pull requests causes PR builds to publish images/tags instead of staying build-only. Restore event/branch gating for push.</violation>
</file>

<file name="config/hermes/config.tpl.yaml">

<violation number="1" location="config/hermes/config.tpl.yaml:265">
P1: Secret redaction is turned off by default, which can expose credentials in logs and tool output.</violation>
</file>

<file name="home-manager/services/hermes/default.nix">

<violation number="1" location="home-manager/services/hermes/default.nix:37">
P2: Avoid writing Hermes gateway logs to `/tmp`; use the private `${homeDir}/.hermes` directory to prevent log exposure/tampering in a shared temp path.</violation>
</file>

<file name="config/noctalia/ac-idle-inhibit.sh">

<violation number="1" location="config/noctalia/ac-idle-inhibit.sh:6">
P2: Resolve the AC status path dynamically instead of hard-coding `ACAD`; otherwise this service silently stops inhibiting idle on machines whose adapter is named differently.</violation>
</file>

<file name="Dockerfile">

<violation number="1" location="Dockerfile:54">
P2: Move `install.sh` below the warmup RUN so installer edits don't invalidate the nix-cache-warmup layer.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Comment thread install.sh

if [ -n "$NIX_GITHUB_TOKEN" ]; then
if [ -n "${NIX_CONFIG:-}" ]; then
NIX_CONFIG="${NIX_CONFIG} access-tokens = github.com=$NIX_GITHUB_TOKEN"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: Preserve the newline separator here; a space can make the existing NIX_CONFIG entry and access-tokens collapse into one invalid line.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At install.sh, line 50:

<comment>Preserve the newline separator here; a space can make the existing NIX_CONFIG entry and `access-tokens` collapse into one invalid line.</comment>

<file context>
@@ -47,8 +47,7 @@ fi
   if [ -n "${NIX_CONFIG:-}" ]; then
-    NIX_CONFIG="${NIX_CONFIG}
-access-tokens = github.com=$NIX_GITHUB_TOKEN"
+    NIX_CONFIG="${NIX_CONFIG} access-tokens = github.com=$NIX_GITHUB_TOKEN"
   else
     NIX_CONFIG="access-tokens = github.com=$NIX_GITHUB_TOKEN"
</file context>
Suggested change
NIX_CONFIG="${NIX_CONFIG} access-tokens = github.com=$NIX_GITHUB_TOKEN"
NIX_CONFIG="${NIX_CONFIG}
access-tokens = github.com=$NIX_GITHUB_TOKEN"

Tip: Review your code locally with the cubic CLI to iterate faster.

personalities: {}
security:
allow_private_urls: false
redact_secrets: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: Secret redaction is turned off by default, which can expose credentials in logs and tool output.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At config/hermes/config.tpl.yaml, line 265:

<comment>Secret redaction is turned off by default, which can expose credentials in logs and tool output.</comment>

<file context>
@@ -0,0 +1,305 @@
+personalities: {}
+security:
+  allow_private_urls: false
+  redact_secrets: false
+  tirith_enabled: true
+  tirith_path: tirith
</file context>

Comment thread Makefile

.PHONY: update
update: nix-update neovim-update gitalias-update llm-update overlays-update ## Update Nix flake, overlays, Neovim plugins, LLM configs, gitalias, and bun deps
update: neovim-update gitalias-update llm-update overlays-update ## Update Nix flake, overlays, Neovim plugins, LLM configs, gitalias, and bun deps

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: make update no longer runs nix-update, so it no longer updates Nix despite the target description saying it does.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Makefile, line 302:

<comment>`make update` no longer runs `nix-update`, so it no longer updates Nix despite the target description saying it does.</comment>

<file context>
@@ -299,7 +299,7 @@ rtk-rewrite-sync: ## Sync rtk-rewrite.sh from upstream rtk repo.
 
 .PHONY: update
-update: nix-update neovim-update gitalias-update llm-update overlays-update  ## Update Nix flake, overlays, Neovim plugins, LLM configs, gitalias, and bun deps
+update: neovim-update gitalias-update llm-update overlays-update  ## Update Nix flake, overlays, Neovim plugins, LLM configs, gitalias, and bun deps
 
 .PHONY: update-lock
</file context>
Suggested change
update: neovim-update gitalias-update llm-update overlays-update ## Update Nix flake, overlays, Neovim plugins, LLM configs, gitalias, and bun deps
update: nix-update neovim-update gitalias-update llm-update overlays-update ## Update Nix flake, overlays, Neovim plugins, LLM configs, gitalias, and bun deps

Comment thread config/hermes/hydrate.sh

# Hydrate config.yaml
@sed@ \
-e "s|__CLIPROXY_API_KEY__|${CLIPROXY_API_KEY}|g" \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Escape secret values before using them in sed replacements; unescaped &, |, or \ can break hydration and generate invalid config.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At config/hermes/hydrate.sh, line 73:

<comment>Escape secret values before using them in `sed` replacements; unescaped `&`, `|`, or `\` can break hydration and generate invalid config.</comment>

<file context>
@@ -0,0 +1,86 @@
+
+# Hydrate config.yaml
+@sed@ \
+  -e "s|__CLIPROXY_API_KEY__|${CLIPROXY_API_KEY}|g" \
+  "$CONFIG_TEMPLATE" >"${STATE_DIR}/config.yaml"
+chmod 600 "${STATE_DIR}/config.yaml"
</file context>

"PATH=${homeDir}/.local/bin:${homeDir}/.nix-profile/bin:/usr/local/bin:/usr/bin:/bin"
];
WorkingDirectory = "${homeDir}/.hermes";
StandardOutput = "append:/tmp/hermes/hermes-gateway.log";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Avoid writing Hermes gateway logs to /tmp; use the private ${homeDir}/.hermes directory to prevent log exposure/tampering in a shared temp path.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/services/hermes/default.nix, line 37:

<comment>Avoid writing Hermes gateway logs to `/tmp`; use the private `${homeDir}/.hermes` directory to prevent log exposure/tampering in a shared temp path.</comment>

<file context>
@@ -0,0 +1,44 @@
+        "PATH=${homeDir}/.local/bin:${homeDir}/.nix-profile/bin:/usr/local/bin:/usr/bin:/bin"
+      ];
+      WorkingDirectory = "${homeDir}/.hermes";
+      StandardOutput = "append:/tmp/hermes/hermes-gateway.log";
+      StandardError = "append:/tmp/hermes/hermes-gateway.log";
+    };
</file context>

# Polls every 2s so AC state changes take effect well within the 5-min idle window.
set -euo pipefail

AC=/sys/class/power_supply/ACAD/online

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Resolve the AC status path dynamically instead of hard-coding ACAD; otherwise this service silently stops inhibiting idle on machines whose adapter is named differently.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At config/noctalia/ac-idle-inhibit.sh, line 6:

<comment>Resolve the AC status path dynamically instead of hard-coding `ACAD`; otherwise this service silently stops inhibiting idle on machines whose adapter is named differently.</comment>

<file context>
@@ -0,0 +1,14 @@
+# Polls every 2s so AC state changes take effect well within the 5-min idle window.
+set -euo pipefail
+
+AC=/sys/class/power_supply/ACAD/online
+
+while true; do
</file context>

Comment thread Dockerfile
- use local install.sh in Docker build and keep token handling stable
- enforce cache warmup ordering in Makefile
- add nix cache warmup script plus execution-style ShellSpec coverage

Co-authored-by: Codex <noreply@openai.com>
@shunkakinoki
shunkakinoki force-pushed the fix/docker-cache-reuse branch from 9e1bbfa to 4dbfd64 Compare May 5, 2026 02:35

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
Makefile (1)

154-154: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Enforce deterministic install ordering under parallel make.

Line 154 defines nix-build, nix-switch, and shell-install as sibling prerequisites. Under make -j, they run concurrently; shell-install can execute before nix-switch, and since shell-install checks if command -v fish without depending on nix-switch completing, fish setup is silently skipped if fish hasn't been installed yet.

💡 Suggested fix
-.PHONY: install
-install: setup git-submodule-sync nix-build nix-switch shell-install ## Set up full environment (setup, cache warmup, build, switch, shell-install).
+.PHONY: install
+install: setup git-submodule-sync ## Set up full environment (setup, cache warmup, build, switch, shell-install).
+	@$(MAKE) nix-build
+	@$(MAKE) nix-switch
+	@$(MAKE) shell-install

This pattern is already established in the check target (lines 162–165).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` at line 154, The install target allows nix-build, nix-switch, and
shell-install to run in parallel under make -j, causing shell-install to run
before nix-switch completes; make shell-install explicitly depend on nix-switch
(i.e., add a rule such that shell-install has nix-switch as a prerequisite) so
that nix-switch finishes before shell-install runs, mirroring the serialized
ordering approach used for the check target and preventing fish/setup steps from
being skipped.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@Makefile`:
- Line 154: The install target allows nix-build, nix-switch, and shell-install
to run in parallel under make -j, causing shell-install to run before nix-switch
completes; make shell-install explicitly depend on nix-switch (i.e., add a rule
such that shell-install has nix-switch as a prerequisite) so that nix-switch
finishes before shell-install runs, mirroring the serialized ordering approach
used for the check target and preventing fish/setup steps from being skipped.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f75ba334-79b0-49c8-ab5b-2aa5c80237cc

📥 Commits

Reviewing files that changed from the base of the PR and between 8e3a288 and 4dbfd64.

📒 Files selected for processing (5)
  • Dockerfile
  • Makefile
  • install.sh
  • scripts/nix-cache-warmup.sh
  • spec/nix_cache_warmup_spec.sh
✅ Files skipped from review due to trivial changes (1)
  • scripts/nix-cache-warmup.sh
🚧 Files skipped from review as they are similar to previous changes (2)
  • spec/nix_cache_warmup_spec.sh
  • install.sh

@shunkakinoki
shunkakinoki deleted the fix/docker-cache-reuse branch May 13, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant