Skip to content

chore: update - #1760

Merged
shunkakinoki merged 7 commits into
mainfrom
fix/wayland-idle-inhibit-on-ac
May 13, 2026
Merged

chore: update#1760
shunkakinoki merged 7 commits into
mainfrom
fix/wayland-idle-inhibit-on-ac

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented May 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix idle behavior on AC power: screen now locks but stays on (no screen-off or suspend). On battery, screen-off at 5 min and suspend at 10 min via swayidle.
  • Add global package manager security defaults (~/.npmrc, ~/.config/pnpm/rc, ~/.bunfig.toml): 7-day minimum release age, ignore install scripts, exact versions, omit optional deps, strict engines.

Test plan

  • make build and make switch succeed
  • ac-idle-inhibit service running on AC (no swayidle spawned)
  • ~/.npmrc, ~/.config/pnpm/rc, ~/.bunfig.toml deployed with correct content

🤖 Generated with Claude Code


Summary by cubic

Fixes Wayland idle behavior so the screen stays on when plugged in, while still locking. Adds hardened defaults for npm, pnpm, and bun to reduce supply-chain risk.

  • Bug Fixes

    • Battery: swayidle handles screen-off (5m) and suspend (10m). AC: stop swayidle so only lock runs and screen stays on.
    • Service: pass WAYLAND_DISPLAY, set PATH for swayidle, hyprctl, and core utils; restart on failure.
    • Noctalia idle: screenOffTimeout=0, suspendTimeout=0, lockTimeout=5m.
    • Nix: replace empty pattern with _; format Nix files.
  • New Features

    • Ship security defaults for npm (~/.npmrc), pnpm (~/.config/pnpm/rc), bun (~/.bunfig.toml).
    • Defaults: 7‑day min release age, ignore scripts, exact versions, omit optional, strict engines.

Written for commit f0d2e62. Summary will update on new commits.

…on AC

systemd-inhibit --what=idle only blocks logind idle tracking, but
noctalia detects idle via the Wayland ext-idle-notify-v1 protocol
directly from Hyprland. Replace with wlinhibit which holds a Wayland
idle-inhibit surface that the compositor respects.
wlinhibit needs the Wayland socket to create an idle inhibitor surface.
Wayland idle-inhibit is all-or-nothing - wlinhibit blocked lock too.

New approach: noctalia only handles lock (screenOffTimeout/suspendTimeout
disabled). A swayidle instance manages screen-off and suspend on battery
only. On AC, swayidle is stopped so only noctalia's lock fires.
Deploy ~/.npmrc, ~/.config/pnpm/rc, and ~/.bunfig.toml with hardened
defaults: 7-day minimum release age, ignore install scripts, save exact
versions, omit optional deps, enforce engine constraints.
@indent-zero

indent-zero Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor
PR Summary

Reworks the noctalia AC idle-inhibit logic and adds hardened global config defaults for npm, pnpm, and bun. The noctalia change replaces the ineffective systemd-inhibit --what=idle (which noctalia ignores because it watches Wayland ext-idle-notify-v1 directly) with an externally managed swayidle instance: noctalia now only handles lock, while swayidle drives screen-off and suspend on battery and is killed when on AC.

  • Disable noctalia's screenOffTimeout/suspendTimeout (0 = disabled) and keep lockTimeout=300 so lock fires on AC and battery.
  • Rewrite config/noctalia/ac-idle-inhibit.sh to start/stop swayidle based on AC state, with dpms off/on via hyprctl and systemctl suspend at 600 s.
  • Extend the ac-idle-inhibit user unit with PassEnvironment=WAYLAND_DISPLAY and a curated PATH (swayidle, hyprland, coreutils, systemd).
  • Add config/bun/bunfig.toml (minimumReleaseAge=604800, exact, ignoreScripts, optional=false) deployed to ~/.bunfig.toml.
  • Add config/npm/npmrc deployed to ~/.npmrc with minimum-release-age, ignore-scripts, save-exact, omit=optional, engine-strict.
  • Add config/pnpm/rc deployed to ~/.config/pnpm/rc with the same npm-style settings.
  • Wire the three new modules into config/default.nix.

Issues

6 potential issues found:

  • The unit only forwards WAYLAND_DISPLAY; hyprctl also relies on HYPRLAND_INSTANCE_SIGNATURE to pick the correct compositor socket. Auto-detect works for a single instance, but multi-instance (or multi-seat) setups will get the wrong socket or couldn't connect, leaving DPMS toggles broken. → Autofix
  • optional = false (bun) and omit=optional (npm/pnpm) skip every optionalDependencies entry, including the per-arch native binaries shipped by rollup, esbuild, swc, lightningcss, sharp, etc. Installs will succeed but apps will crash at runtime with "Cannot find module @rollup/rollup-linux-x64-gnu" and similar. → Autofix
  • /sys/class/power_supply/ACAD/online is hardcoded to one laptop model; on hosts that expose the AC adapter as AC, AC0, ADP1, etc., cat fails, ON_AC ends up empty, and the script always takes the battery branch — the opposite of the PR's "on AC, only lock fires" intent. → Autofix
  • npm config key/unit are wrong, so the 7-day cooldown advertised in the commit message is silently a no-op: npm uses min-release-age (not minimum-release-age) and the unit is days, not minutes — 10080 would mean ~27 years. Use min-release-age=7. → Autofix
  • pnpm v11 only reads auth/registry settings from the global rc file, so minimum-release-age here is silently ignored on v11 (and v11 already defaults to 1440 min, overriding the user's intent). Move it to pnpm-workspace.yaml or ~/.config/pnpm/config.yaml as minimumReleaseAge: 10080. → Autofix
  • xdg.configFile."pnpm/rc" writes to ~/.config/pnpm/rc, but on macOS pnpm reads ~/Library/Preferences/pnpm/rc unless XDG_CONFIG_HOME is exported; config/default.nix imports ./pnpm unconditionally, so Darwin hosts may never see this file. → Autofix

CI Checks

nix-lint (statix) is rejecting the three new module files for using an empty { ... }: pattern instead of _:. nix-check is the aggregate gate and only fails because nix-lint fails — all other Nix jobs (nix-darwin, nix-flake, nix-format, nix-linux, nix-nixos, nix-test) pass.

Failing nix-lint→ Autofix
  • statix flags Found empty pattern in function argument in config/bun/default.nix:1, config/npm/default.nix:1, and config/pnpm/default.nix:1. All three files start with { ... }: but take no inputs; statix wants _: instead. Replacing { ... }: with _: in those three files will clear the lint.
Failing nix-check
  • Aggregate gate; fails only because nix-lint fails. Will pass automatically once nix-lint is green.

⚡ Autofix All

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5a28bc91-72da-4072-9b85-ed5ffe40a4a9

📥 Commits

Reviewing files that changed from the base of the PR and between cc183e7 and f0d2e62.

📒 Files selected for processing (3)
  • config/bun/default.nix
  • config/npm/default.nix
  • config/pnpm/default.nix

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • Chores

    • Added user config for Bun, npm, and pnpm to enforce minimum release ages, exact dependency versions, ignore install scripts, omit optional deps, and enable strict engine checks.
    • Ensure those config files are installed/overwritten on activation.
    • Included Bun/npm/pnpm modules in the system configuration list.
  • Bug Fixes / Behavior

    • Updated power/idle handling: on AC keep the screen active; on battery automatically turn off the screen and suspend with adjusted desktop idle timeouts.

Walkthrough

Adds Bun, NPM, and PNPM config files plus Nix modules enforcing install policies, registers those modules in config/default.nix, and refactors noctalia idle handling from systemd-inhibit to an AC-aware swayidle-driven script with service environment and idle-timeout updates.

Changes

Package Manager Setup and Noctalia Idle Behavior

Layer / File(s) Summary
Bun, NPM, and PNPM package manager configurations
config/bun/bunfig.toml, config/bun/default.nix, config/npm/npmrc, config/npm/default.nix, config/pnpm/rc, config/pnpm/default.nix
Adds installation policy configurations for Bun, NPM, and PNPM enforcing minimum-release-age, exact version pinning, disabling lifecycle scripts, and omitting optional dependencies; each includes a Nix module to deploy its config file to the user home/XDG config (force = true).
Module registration
config/default.nix
Registers ./bun, ./npm, and ./pnpm modules in the top-level config module list.
Noctalia AC-aware idle and suspend refactoring
config/noctalia/ac-idle-inhibit.sh, config/noctalia/default.nix
Replaces AC-power idle blocking via systemd-inhibit with AC-status polling that starts/stops swayidle conditionally: on AC, stops swayidle and enables DPMS; on battery, starts swayidle with DPMS-off and suspend timeouts. Updates systemd user service env (WAYLAND_DISPLAY and PATH) and sets desktop idle timeouts to 0 so swayidle manages them.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • shunkakinoki/dotfiles#1760: Mirrors changes to bun/npm/pnpm configs and noctalia ac-idle-inhibit script/service in this PR.
  • shunkakinoki/dotfiles#1651: Earlier changes to config/noctalia/ac-idle-inhibit.sh and config/noctalia/default.nix that this PR further modifies.

Poem

🐰 Bun, Npm, Pnpm line the trail,
Exact and strict, they never fail.
Swayidle hums when battery sings,
DPMS wakes when AC brings—
A rabbit cheers for tidy rails.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Title check ❓ Inconclusive The title 'chore: update' is vague and generic, failing to convey meaningful information about the substantial changes including idle behavior fixes and security defaults. Use a more descriptive title such as 'chore: fix AC idle behavior and add package manager security defaults' to clearly summarize the main changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly relates to the changeset, detailing both the AC idle behavior fix and the addition of package manager security defaults with specific test outcomes.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wayland-idle-inhibit-on-ac

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@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 introduces configuration files for Bun, npm, and pnpm, implementing security-oriented defaults such as ignoring scripts and enforcing minimum release ages. It also refactors the ac-idle-inhibit.sh script and its Nix service to manage swayidle dynamically based on AC power status. A review comment identifies a potential failure point in the shell script where set -e could cause the service to crash if the AC status file is missing, suggesting a more robust check for the file's existence.

while true; do
if [ "$(cat "$AC" 2>/dev/null)" = "1" ]; then
systemd-inhibit --what=idle --why="On AC power" --mode=block sleep 2
ON_AC="$(cat "$AC" 2>/dev/null)"

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

The script uses set -e, which causes it to exit immediately if cat "$AC" fails (e.g., if the sysfs path does not exist on a desktop or different hardware). This will lead to the systemd service failing and potentially entering a restart loop. It's better to check for the file's existence and default to a safe value (like assuming AC power) if it's missing.

Suggested change
ON_AC="$(cat "$AC" 2>/dev/null)"
if [ -f "$AC" ]; then
ON_AC="$(cat "$AC")"
else
ON_AC="1"
fi
References
  1. Avoid using set -e in execution scripts that must handle failures gracefully to avoid blocking or service failure loops.

@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: 1

🧹 Nitpick comments (2)
config/noctalia/ac-idle-inhibit.sh (2)

22-28: ⚖️ Poor tradeoff

Optional: switch from a 2 s polling loop to udev/upower events.

The current design works, but it wakes the CPU every 2 seconds forever and reacts to AC changes with up to a 2 s lag. upower --monitor-detail or a udev rule on power_supply events would be event-driven, zero-poll, and instant. Not a blocker — flagging as a nice-to-have for battery life on laptops.

🤖 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 `@config/noctalia/ac-idle-inhibit.sh` around lines 22 - 28, The current script
starts swayidle and relies on a 2s polling loop to detect AC changes; replace
the poll with an event-driven watcher that reacts to power_supply/UPower events
(so you stop waking the CPU every 2s). Implement a small background handler that
listens for UPower DBus signals (e.g. via upower --monitor-detail or a DBus
subscription) or a udev monitor on power_supply events and in its handler
start/stop or restart the swayidle process (manage the SWAYIDLE_PID variable and
invoke swayidle -w as currently done) instead of polling; ensure the watcher
runs in background (systemd user service or nohup) and properly exports/updates
SWAYIDLE_PID when starting/stopping swayidle.

6-6: ⚡ Quick win

Hardcoded AC sysfs path reduces portability.

/sys/class/power_supply/ACAD/online is device-specific (the name varies per machine: AC, ACAD, ADP1, AC0, etc.). If this config is reused on different hardware, cat will fail silently, ON_AC will be empty, and the script will permanently behave as if on battery (spawning swayidle even when plugged in).

Consider discovering the AC adapter dynamically:

♻️ Suggested refactor
-AC=/sys/class/power_supply/ACAD/online
+# Pick the first Mains-type supply (AC adapter) available on this machine.
+AC="$(grep -l '^Mains$' /sys/class/power_supply/*/type 2>/dev/null | head -n1)"
+AC="${AC%/type}/online"
🤖 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 `@config/noctalia/ac-idle-inhibit.sh` at line 6, The script currently hardcodes
AC=/sys/class/power_supply/ACAD/online which breaks portability; change the
detection logic so the script dynamically finds the AC adapter under
/sys/class/power_supply by scanning entries and selecting the one whose "type"
file equals "Mains" (or whose name matches common AC prefixes) and then use its
"online" file to set ON_AC instead of AC; update references to AC (and the ON_AC
check that decides whether to spawn swayidle) to use this discovered path so the
script works across machines with names like AC, ACAD, ADP1, AC0, etc.
🤖 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.

Inline comments:
In `@config/noctalia/ac-idle-inhibit.sh`:
- Around line 16-20: The race between the liveness check (kill -0 on
SWAYIDLE_PID) and the subsequent kill can cause the standalone kill to fail and,
under set -e, abort the script; update the block handling SWAYIDLE_PID to
tolerate a failing kill by appending a no-op on failure (e.g. change the
dangerous call to kill "$SWAYIDLE_PID" 2>/dev/null || true) so the script won't
exit if the process disappeared after the check, ensure SWAYIDLE_PID is still
cleared (SWAYIDLE_PID="") and likewise make the hyprctl dispatch dpms on call
resilient by adding || true so transient compositor errors don't terminate the
poller.

---

Nitpick comments:
In `@config/noctalia/ac-idle-inhibit.sh`:
- Around line 22-28: The current script starts swayidle and relies on a 2s
polling loop to detect AC changes; replace the poll with an event-driven watcher
that reacts to power_supply/UPower events (so you stop waking the CPU every 2s).
Implement a small background handler that listens for UPower DBus signals (e.g.
via upower --monitor-detail or a DBus subscription) or a udev monitor on
power_supply events and in its handler start/stop or restart the swayidle
process (manage the SWAYIDLE_PID variable and invoke swayidle -w as currently
done) instead of polling; ensure the watcher runs in background (systemd user
service or nohup) and properly exports/updates SWAYIDLE_PID when
starting/stopping swayidle.
- Line 6: The script currently hardcodes AC=/sys/class/power_supply/ACAD/online
which breaks portability; change the detection logic so the script dynamically
finds the AC adapter under /sys/class/power_supply by scanning entries and
selecting the one whose "type" file equals "Mains" (or whose name matches common
AC prefixes) and then use its "online" file to set ON_AC instead of AC; update
references to AC (and the ON_AC check that decides whether to spawn swayidle) to
use this discovered path so the script works across machines with names like AC,
ACAD, ADP1, AC0, etc.
🪄 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: 3eea1399-a9ba-4a83-8848-772aef4ab2c2

📥 Commits

Reviewing files that changed from the base of the PR and between 133783f and ac126c2.

📒 Files selected for processing (9)
  • config/bun/bunfig.toml
  • config/bun/default.nix
  • config/default.nix
  • config/noctalia/ac-idle-inhibit.sh
  • config/noctalia/default.nix
  • config/npm/default.nix
  • config/npm/npmrc
  • config/pnpm/default.nix
  • config/pnpm/rc

Comment on lines +16 to +20
if [ -n "$SWAYIDLE_PID" ] && kill -0 "$SWAYIDLE_PID" 2>/dev/null; then
kill "$SWAYIDLE_PID" 2>/dev/null
SWAYIDLE_PID=""
hyprctl dispatch dpms on
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

kill under set -e can terminate the script on a tiny race.

Between the kill -0 liveness check on Line 16 and the kill on Line 17, swayidle may exit on its own (or be reaped elsewhere). With set -e, a non-zero exit from kill will abort the whole AC monitor service. The same applies in the cleanup function on Line 9, except there it is shielded by the && short-circuit — the standalone kill here is not.

🛡️ Suggested guard
-    if [ -n "$SWAYIDLE_PID" ] && kill -0 "$SWAYIDLE_PID" 2>/dev/null; then
-      kill "$SWAYIDLE_PID" 2>/dev/null
-      SWAYIDLE_PID=""
-      hyprctl dispatch dpms on
-    fi
+    if [ -n "$SWAYIDLE_PID" ] && kill -0 "$SWAYIDLE_PID" 2>/dev/null; then
+      kill "$SWAYIDLE_PID" 2>/dev/null || true
+      SWAYIDLE_PID=""
+      hyprctl dispatch dpms on || true
+    fi

I also added || true to the hyprctl call since a transient compositor hiccup shouldn't crash the long-running poller.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [ -n "$SWAYIDLE_PID" ] && kill -0 "$SWAYIDLE_PID" 2>/dev/null; then
kill "$SWAYIDLE_PID" 2>/dev/null
SWAYIDLE_PID=""
hyprctl dispatch dpms on
fi
if [ -n "$SWAYIDLE_PID" ] && kill -0 "$SWAYIDLE_PID" 2>/dev/null; then
kill "$SWAYIDLE_PID" 2>/dev/null || true
SWAYIDLE_PID=""
hyprctl dispatch dpms on || true
fi
🤖 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 `@config/noctalia/ac-idle-inhibit.sh` around lines 16 - 20, The race between
the liveness check (kill -0 on SWAYIDLE_PID) and the subsequent kill can cause
the standalone kill to fail and, under set -e, abort the script; update the
block handling SWAYIDLE_PID to tolerate a failing kill by appending a no-op on
failure (e.g. change the dangerous call to kill "$SWAYIDLE_PID" 2>/dev/null ||
true) so the script won't exit if the process disappeared after the check,
ensure SWAYIDLE_PID is still cleared (SWAYIDLE_PID="") and likewise make the
hyprctl dispatch dpms on call resilient by adding || true so transient
compositor errors don't terminate the poller.

Comment thread config/npm/npmrc
@@ -0,0 +1,5 @@
minimum-release-age=10080

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.

npm ignores this setting — npm's canonical key is min-release-age (not minimum-release-age), and the unit is days, not minutes (npm v11 docs; npm/cli #8965). Even after a rename, 10080 would mean ~27 years and break every install. The 7-day cooldown the commit message describes does not currently apply to npm install.

Suggested change
minimum-release-age=10080
min-release-age=7

Comment thread config/pnpm/rc
@@ -0,0 +1,5 @@
minimum-release-age=10080

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.

Latent on pnpm v11+: pnpm v11 restricted the global rc file to auth/registry settings — non-auth settings like minimumReleaseAge must live in pnpm-workspace.yaml (project) or ~/.config/pnpm/config.yaml (global) as minimumReleaseAge: 10080 (camelCase, minutes). Works on pnpm ≤ v10, but on v11 this file is ignored for these settings and pnpm's own default of 1440 min wins. (Refs: https://pnpm.io/11.x/configuring, https://pnpm.io/11.x/cli/config)

# On battery: run swayidle for screen-off (5 min) and suspend (10 min).
# On AC: stop swayidle so only noctalia's lock fires.
set -euo pipefail

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.

Hardware-specific path: /sys/class/power_supply/ACAD/online only exists on certain laptops; common alternates are AC, AC0, ADP1, ACPI. Combined with cat ... 2>/dev/null inside $(...), a missing node yields ON_AC="", which falls into the else branch — so on any other machine the script will treat AC as battery and keep swayidle running with screen-off + suspend even when plugged in (the opposite of the PR's intent). Detect the Mains entry under /sys/class/power_supply/*/type instead.

Description = "Screen-off and suspend on battery via swayidle";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

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.

hyprctl needs more than WAYLAND_DISPLAY: without HYPRLAND_INSTANCE_SIGNATURE (and XDG_RUNTIME_DIR), hyprctl falls back to scanning $XDG_RUNTIME_DIR/hypr/ and silently picks an arbitrary socket if multiple Hyprland instances exist. Consider PassEnvironment = [ "WAYLAND_DISPLAY" "HYPRLAND_INSTANCE_SIGNATURE" "XDG_RUNTIME_DIR" ]; so the user manager forwards them when present.

Suggested change
};
PassEnvironment = [ "WAYLAND_DISPLAY" "HYPRLAND_INSTANCE_SIGNATURE" "XDG_RUNTIME_DIR" ];

Comment thread config/pnpm/default.nix
@@ -0,0 +1,7 @@
{ ... }:
{
xdg.configFile."pnpm/rc" = {

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.

Wrong path on macOS: pnpm reads its global rc from ~/Library/Preferences/pnpm/rc on Darwin (unless XDG_CONFIG_HOME is exported), but xdg.configFile always lands at ~/.config/pnpm/rc. Since config/default.nix imports ./pnpm unconditionally, this module silently does nothing on macOS hosts. Branch on pkgs.stdenv.isDarwin or gate the import to Linux.

Comment thread config/bun/bunfig.toml
minimumReleaseAge = 604800
exact = true
ignoreScripts = true
optional = 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.

optional = false skips required native binaries: rollup, esbuild, swc, lightningcss, sharp, and many other modern toolchain packages ship per-arch binaries via optionalDependencies. Disabling optionals globally lets bun install succeed but breaks the apps at runtime with Cannot find module @rollup/rollup-linux-x64-gnu (or equivalent). Same applies to the corresponding omit=optional lines in config/npm/npmrc and config/pnpm/rc.

@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.

4 issues found across 9 files

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="config/noctalia/ac-idle-inhibit.sh">

<violation number="1" location="config/noctalia/ac-idle-inhibit.sh:13">
P1: The AC-state read can terminate the whole script under `set -e` when the sysfs file read fails. Add a fallback so transient read errors don’t stop idle management.</violation>
</file>

<file name="config/pnpm/rc">

<violation number="1" location="config/pnpm/rc:1">
P1: In pnpm v11+, non-registry/auth settings in the global `rc` file are silently ignored. To ensure these security defaults are actually enforced upon upgrade, use `~/.config/pnpm/config.yaml` instead, formatted as YAML (e.g., `minimumReleaseAge: 10080`, `ignoreScripts: true`).</violation>
</file>

<file name="config/npm/npmrc">

<violation number="1" location="config/npm/npmrc:1">
P1: Wrong configuration key and unit. npm's setting is `min-release-age` (not `minimum-release-age`) and its unit is **days**, not minutes. The current value `10080` would be silently ignored since `minimum-release-age` isn't a recognized npm config key. For a 7-day cooldown, use `min-release-age=7`.</violation>
</file>

<file name="config/bun/bunfig.toml">

<violation number="1" location="config/bun/bunfig.toml:5">
P1: `optional = false` will break packages that ship platform-specific native binaries via `optionalDependencies`. Many critical toolchain packages (rollup, esbuild, swc, lightningcss, sharp) use this pattern — e.g. `@rollup/rollup-linux-x64-gnu` is an optional dep. Install will succeed but the packages will fail at runtime with missing module errors. The same concern applies to `omit=optional` in the npmrc and pnpm rc files.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

while true; do
if [ "$(cat "$AC" 2>/dev/null)" = "1" ]; then
systemd-inhibit --what=idle --why="On AC power" --mode=block sleep 2
ON_AC="$(cat "$AC" 2>/dev/null)"

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: The AC-state read can terminate the whole script under set -e when the sysfs file read fails. Add a fallback so transient read errors don’t stop idle management.

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 13:

<comment>The AC-state read can terminate the whole script under `set -e` when the sysfs file read fails. Add a fallback so transient read errors don’t stop idle management.</comment>

<file context>
@@ -1,14 +1,31 @@
 while true; do
-  if [ "$(cat "$AC" 2>/dev/null)" = "1" ]; then
-    systemd-inhibit --what=idle --why="On AC power" --mode=block sleep 2
+  ON_AC="$(cat "$AC" 2>/dev/null)"
+
+  if [ "$ON_AC" = "1" ]; then
</file context>
Suggested change
ON_AC="$(cat "$AC" 2>/dev/null)"
ON_AC="$(cat "$AC" 2>/dev/null || echo 0)"

Comment thread config/pnpm/rc
@@ -0,0 +1,5 @@
minimum-release-age=10080

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: In pnpm v11+, non-registry/auth settings in the global rc file are silently ignored. To ensure these security defaults are actually enforced upon upgrade, use ~/.config/pnpm/config.yaml instead, formatted as YAML (e.g., minimumReleaseAge: 10080, ignoreScripts: true).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At config/pnpm/rc, line 1:

<comment>In pnpm v11+, non-registry/auth settings in the global `rc` file are silently ignored. To ensure these security defaults are actually enforced upon upgrade, use `~/.config/pnpm/config.yaml` instead, formatted as YAML (e.g., `minimumReleaseAge: 10080`, `ignoreScripts: true`).</comment>

<file context>
@@ -0,0 +1,5 @@
+minimum-release-age=10080
+ignore-scripts=true
+save-exact=true
</file context>

Comment thread config/npm/npmrc
@@ -0,0 +1,5 @@
minimum-release-age=10080

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: Wrong configuration key and unit. npm's setting is min-release-age (not minimum-release-age) and its unit is days, not minutes. The current value 10080 would be silently ignored since minimum-release-age isn't a recognized npm config key. For a 7-day cooldown, use min-release-age=7.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At config/npm/npmrc, line 1:

<comment>Wrong configuration key and unit. npm's setting is `min-release-age` (not `minimum-release-age`) and its unit is **days**, not minutes. The current value `10080` would be silently ignored since `minimum-release-age` isn't a recognized npm config key. For a 7-day cooldown, use `min-release-age=7`.</comment>

<file context>
@@ -0,0 +1,5 @@
+minimum-release-age=10080
+ignore-scripts=true
+save-exact=true
</file context>
Suggested change
minimum-release-age=10080
min-release-age=7

Comment thread config/bun/bunfig.toml
minimumReleaseAge = 604800
exact = true
ignoreScripts = true
optional = 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: optional = false will break packages that ship platform-specific native binaries via optionalDependencies. Many critical toolchain packages (rollup, esbuild, swc, lightningcss, sharp) use this pattern — e.g. @rollup/rollup-linux-x64-gnu is an optional dep. Install will succeed but the packages will fail at runtime with missing module errors. The same concern applies to omit=optional in the npmrc and pnpm rc files.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At config/bun/bunfig.toml, line 5:

<comment>`optional = false` will break packages that ship platform-specific native binaries via `optionalDependencies`. Many critical toolchain packages (rollup, esbuild, swc, lightningcss, sharp) use this pattern — e.g. `@rollup/rollup-linux-x64-gnu` is an optional dep. Install will succeed but the packages will fail at runtime with missing module errors. The same concern applies to `omit=optional` in the npmrc and pnpm rc files.</comment>

<file context>
@@ -0,0 +1,5 @@
+minimumReleaseAge = 604800
+exact = true
+ignoreScripts = true
+optional = false
</file context>
Suggested change
optional = false
# optional = false # WARNING: breaks packages using optionalDependencies for native binaries (rollup, esbuild, swc, etc.)

@shunkakinoki
shunkakinoki merged commit 2abe4d0 into main May 13, 2026
8 checks passed
@shunkakinoki
shunkakinoki deleted the fix/wayland-idle-inhibit-on-ac branch May 13, 2026 12:47
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