Skip to content

refactor: transition to Nix-based configuration management#3

Open
posaune0423 wants to merge 2 commits intomainfrom
feat/use-nix
Open

refactor: transition to Nix-based configuration management#3
posaune0423 wants to merge 2 commits intomainfrom
feat/use-nix

Conversation

@posaune0423
Copy link
Owner

@posaune0423 posaune0423 commented Jan 8, 2026

  • Updated .zprofile and .zshenv to reflect the shift from mise to Nix for managing language runtimes and CLI tools.
  • Enhanced .zshenv to include Nix paths for improved completion and tool accessibility.
  • Refined install.sh for a Nix-first installation approach, including clearer usage instructions and improved error handling.
  • Updated README.md and CLAUDE.md to document the new Nix-based structure and installation process.
  • Cleaned up .config/zsh files to remove legacy configurations and streamline tool initialization.

Summary by CodeRabbit

  • New Features

    • Added Fish shell configuration with completions and utilities (z directory jumping, fisher plugin manager).
    • Added GitHub Actions CI workflow for automated builds and formatting checks.
    • Added Home Manager configuration for dotfiles management.
  • Bug Fixes

    • Removed conflicting colon/semicolon keybindings in Neovim.
  • Chores

    • Migrated from Homebrew/mise to Nix-based package and tool management.
    • Updated shell initialization to use Nix paths and tooling.
    • Modernized installer script for streamlined deployment.
    • Updated documentation to reflect new configuration approach.
    • Added editor and formatting configurations (Stylua, VS Code Lua support).
    • Added .gitignore for build artifacts and temporary files.

✏️ Tip: You can customize this high-level summary in your review settings.

- Updated .zprofile and .zshenv to reflect the shift from mise to Nix for managing language runtimes and CLI tools.
- Enhanced .zshenv to include Nix paths for improved completion and tool accessibility.
- Refined install.sh for a Nix-first installation approach, including clearer usage instructions and improved error handling.
- Updated README.md and CLAUDE.md to document the new Nix-based structure and installation process.
- Cleaned up .config/zsh files to remove legacy configurations and streamline tool initialization.
@posaune0423 posaune0423 self-assigned this Jan 8, 2026
@posaune0423 posaune0423 added the enhancement New feature or request label Jan 8, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 8, 2026

📝 Walkthrough

Walkthrough

This pull request migrates the dotfiles configuration from a traditional Homebrew/mise-based setup to a declarative Nix-first architecture using nix-darwin and home-manager. It adds comprehensive Nix infrastructure, reorganizes shell configurations (adding Fish shell support), updates CI/CD with GitHub Actions, and substantially revises documentation to reflect the new paradigm.

Changes

Cohort / File(s) Summary
Nix Infrastructure & System Configuration
flake.nix, nix/darwin/default.nix, nix/home/default.nix
Introduces declarative macOS configuration via Nix flakes. flake.nix wires nix-darwin and home-manager with aarch64-darwin target and multiple app actions. nix/darwin/default.nix configures system packages (replacing Homebrew/mise), macOS defaults, activation scripts, and 367 lines of comprehensive system state. nix/home/default.nix defines user home symlinks and XDG configuration mappings.
CI/CD & Repository Configuration
.github/workflows/ci.yml, .gitignore
Adds GitHub Actions workflows for build (macOS, nix flake check) and format (Ubuntu, nix fmt check). Adds .gitignore with Nix build artifacts, .direnv, and editor temp files.
Installation & Core Documentation
install.sh, README.md, CLAUDE.md
Reworks installer from symlink-based to nix-darwin switch workflow, removing backup logic and interactive prompts. README refactored from plugin/mise-centric to Nix-first with one-liner setup. CLAUDE.md updated with new architecture, commands, and Nix structure details.
Zsh Shell Configuration
.zshenv, .zprofile, .config/zsh/*
Removes Homebrew paths and mise shims from PATH initialization; adds Nix-darwin paths. Replaces z.sh with zoxide initialization. Replaces Homebrew completions with Nix-darwin completion paths. Updates .config/zsh/README.md to reflect modular Nix-first structure.
Neovim Configuration
.config/nvim/init.lua, .config/nvim/lua/config/keymaps.lua, .config/nvim/lua/config/lazy.lua
Minor indentation change in init.lua. Removes colon/semicolon swap keymaps. Expands lazy.nvim setup with explicit LazyVim entry, additional extras (linting.eslint, formatting.prettier, lang specs), new install/checker/performance/debug tables, and compatibility guard for vim.uv vs vim.loop.
Fish Shell Configuration (New)
fish/config.fish, fish/conf.d/*, fish/functions/*, fish/fish_plugins, fish/fish_variables
Comprehensive new Fish shell setup including starship integration, aliases (eza, git, pnpm, etc.), and plugin system. Adds 12+ new files including complete fisher plugin manager (240 lines), z directory-jumping implementation (__z, __z_add, __z_clean with 174+63+11 lines), and kiro-cli pre/post initialization hooks.
Editor & Code Formatting
.vscode/settings.json, stylua.toml
Adds stylua Lua formatter configuration (2-space indent, 120 column width) and VSCode Lua formatter setting.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90+ minutes

Possibly related PRs

  • Feat/use mise #1: Directly conflicts with this PR—adds/centralizes mise integration while this PR removes it in favor of Nix-first provisioning; both modify shared shell configuration and installer files with opposing approaches.

Poem

🐇 From Homebrew hops to Nix flakes we leap,

Where declarative configs run so deep,

Fish shells now frolic, with zoxide's might,

Nix-darwin shines through—reproducible delight! 🌲✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary objective of the pull request: transitioning from a Homebrew/mise-based dotfiles setup to a Nix-first, declarative configuration management approach using nix-darwin and home-manager.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

- Updated CLAUDE.md and README.md to replace instances of "ghosty" with "ghostty" for consistency.
- Added a new configuration file for ghostty with specified settings in .config/ghostty/config.
- Adjusted default.nix to reflect the correct path for ghostty configuration.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 14

🤖 Fix all issues with AI agents
In @.config/zsh/README.md:
- Around line 7-18: The fenced code block in README.md lacks a language
identifier; update the opening fence to include one (e.g., change ``` to ```text
or ```bash) so the block around the list (the lines starting with ~/.zshenv,
~/.zprofile, ~/.zshrc and the tree under ~/.config/zsh/) is annotated for proper
syntax highlighting and linting; ensure only the opening fence is modified and
keep the existing content and closing ``` unchanged.

In @.github/workflows/ci.yml:
- Around line 16-17: The workflow step currently uses the Nix installer action
with an unstable reference "uses: DeterminateSystems/nix-installer-action@main";
change both occurrences (the Install Nix step in the build job and the
corresponding Install Nix step in the format job) to pin to a specific released
tag or commit SHA (e.g., replace "@main" with a stable tag like "@v1.2.3" or a
commit SHA) so the CI is deterministic and resistant to upstream changes.
- Around line 19-20: Replace the unpinned action usage
"DeterminateSystems/magic-nix-cache-action@main" with a fixed version or commit
reference in both places where it appears (the Enable Magic Nix Cache step and
the format job step) so the workflow uses a stable, known release/sha; locate
the two uses of DeterminateSystems/magic-nix-cache-action and update them to a
specific tag like @vX.Y.Z or a commit SHA.

In @fish/conf.d/z.fish:
- Around line 49-63: The __z_uninstall function currently unsets Z_CMD, ZO_CMD,
Z_DATA, and Z_EXCLUDE but misses removing the universal Z_DATA_DIR; update the
uninstall cleanup in function __z_uninstall to also unset Z_DATA_DIR (i.e., add
a set -e Z_DATA_DIR alongside the existing set -e Z_CMD, ZO_CMD, Z_DATA, and
Z_EXCLUDE) so no orphaned universal variable remains after uninstall.

In @fish/config.fish:
- Around line 25-26: The aliases use Zsh commands; update alias reload to source
the Fish config (replace "source ~/.zshrc" with "source
~/.config/fish/config.fish" or equivalent Fish config path) and change alias
restart to re-exec Fish (e.g., use "exec fish" or "exec fish -l") so both alias
reload and alias restart are Fish-compatible.

In @fish/fish_variables:
- Around line 1-13: The committed fish universal variables file (fish_variables)
contains user-specific SETUVAR entries (e.g., Z_DATA, Z_DATA_DIR, Z_EXCLUDE) and
must be removed from version control: add the fish_variables file to .gitignore,
run git rm --cached fish/fish_variables to stop tracking it, and commit that
change; also update the README to document that Fish generates
~/.config/fish/fish_variables (and the z plugin will populate it per-user) so no
one should commit or rely on this file in the repo.

In @fish/functions/__z_add.fish:
- Around line 38-40: The id invocation and chown call must quote expansions to
avoid word-splitting: update the id -ng $Z_OWNER usage to pass Z_OWNER quoted
(use id -ng with Z_OWNER quoted) and ensure the chown operands that include
Z_OWNER, the id subshell, and $tmpfile are properly quoted so multi-word or
special-character usernames/groupnames and file paths are handled safely (refer
to the Z_OWNER variable, the id -ng invocation, the chown command, and
$tmpfile).

In @fish/functions/__z.fish:
- Around line 160-165: In the Windows_NT branch (the else if test "$OS" =
Windows_NT block) the echo "Cannot open file explorer" and the subsequent return
1 are unreachable because of the unconditional return 0 immediately after
launching explorer; fix by removing or moving the premature return 0 and instead
check the result of the explorer invocation (e.g., run type -q explorer; and
explorer "$target" and if that fails then echo "Cannot open file explorer" and
return 1; otherwise return 0) so the error message and non-zero return occur
only on failure.
- Around line 40-42: The sed -i usage in the delete branch (when _flag_delete is
set) is not portable to BSD/macOS; change the implementation to avoid in-place
sed -i: either call sed with a POSIX-compatible pattern and write output to a
temporary file then move it back (similar to __z_clean), or detect BSD sed and
pass an empty backup extension (''), ensuring you operate on the same Z_DATA
variable and preserve permissions; update the branch that references
_flag_delete and Z_DATA to use the temp-file replace approach for cross-platform
compatibility.

In @install.sh:
- Around line 146-152: The script's dependency check only verifies git but not
curl, which is used later; update the need_cmd usage to also call need_cmd for
"curl" (i.e., add a dependency check for curl alongside the existing need_cmd
git) so the installer fails early with a clear "Required command not found:
curl" message if curl is missing; locate the checks in the need_cmd block and
the invocation area where need_cmd git is called and add need_cmd curl there.
- Around line 170-189: After running the Determinate Nix installer (when DRY_RUN
== 0) ensure the script verifies the installation by re-checking command -v nix
and/or attempting nix --version; if the command is not found log an error via
failure helper (e.g., use existing success/info functions or call
success/info/fail) and exit non‑zero. In the block that sources
'/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' and after the
installer completes, add a validation step that retries sourcing if necessary,
runs command -v nix || nix --version to confirm availability, and on failure
emit a clear error message and exit to prevent later silent failures.
- Around line 209-227: The install script's HOST parameter (variable HOST and
the --flake ".#$HOST" usage in install.sh) can mismatch flake.nix which
hard-codes host = "mac" and only defines darwinConfigurations.mac, causing
nix-darwin switch to fail for other hostnames; fix by either removing the HOST
parameter and always using ".#mac" in the --flake invocation (and delete or
default HOST usage) or update flake.nix to accept a host input and expose
darwinConfigurations.<host> dynamically (so the flake honors the passed HOST),
ensuring the symbols to change are the HOST variable and the --flake ".#$HOST"
string in install.sh or the host = "mac" / darwinConfigurations.mac entries in
flake.nix.
🧹 Nitpick comments (9)
stylua.toml (1)

1-3: LGTM!

Sensible StyLua defaults that align with the Lua formatter configured in .vscode/settings.json. The 2-space indent is standard in the Neovim/Lua ecosystem.

You may optionally consider adding quote_style for consistent string formatting:

quote_style = "AutoPreferDouble"
.vscode/settings.json (1)

54-57: Consider making paths portable (pre-existing issue).

These hardcoded user-specific paths (/Users/yamadaasuma, /Users/a.yamada) will break on other machines. Since this PR is modernizing the dotfiles setup, you might consider addressing this in a follow-up by using environment variables or removing these settings in favor of Nix-managed Python paths.

fish/conf.d/uv.env.fish (1)

2-2: Simplify the redundant path and add error handling.

The path contains an unnecessary .. component: $HOME/.local/share/../bin/env.fish simplifies to $HOME/.local/bin/env.fish. Additionally, the source command will produce an error if the file doesn't exist.

♻️ Proposed fix
-source "$HOME/.local/share/../bin/env.fish"
+test -f "$HOME/.local/bin/env.fish"; and source "$HOME/.local/bin/env.fish"
fish/functions/__z_clean.fish (1)

1-11: Consider adding error handling for edge cases.

A few potential issues:

  1. If mktemp fails, $tmpfile could be empty or an error message, and test -f may not catch this properly.
  2. If $Z_DATA doesn't exist or is unreadable, the function proceeds silently.
  3. The temp file isn't cleaned up if an error occurs between creation and the mv.
♻️ Suggested improvement with error handling
 function __z_clean -d "Clean up .z file to remove paths no longer valid"
+    if not test -f "$Z_DATA"
+        echo "z: $Z_DATA does not exist" >&2
+        return 1
+    end
+
     set -l tmpfile (mktemp $Z_DATA.XXXXXX)
+    or return 1
 
-    if test -f $tmpfile
+    if test -f "$tmpfile"
         while read line
             set -l path (string split '|' $line)[1]
             test -d $path; and echo $line
-        end <$Z_DATA >$tmpfile
-        command mv -f $tmpfile $Z_DATA
+        end <"$Z_DATA" >"$tmpfile"
+        command mv -f "$tmpfile" "$Z_DATA"
+    else
+        return 1
     end
 end
fish/functions/__z.fish (1)

143-147: Status capture pattern could be more idiomatic.

The current pattern works but can be simplified using Fish's or operator for cleaner flow control.

♻️ Optional: Idiomatic Fish pattern
-    set target (command awk -v t=(date +%s) -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA")
-
-    if test "$status" -gt 0
-        return
-    end
+    set target (command awk -v t=(date +%s) -v typ="$typ" -v q="$q" -F "|" $z_script "$Z_DATA")
+    or return
nix/darwin/default.nix (1)

341-366: Potential duplication between declarative settings and activation script.

Lines 349-350 set NSNavPanelExpandedStateForSaveMode via defaults write, but lines 55-56 already declare these same settings declaratively in system.defaults.NSGlobalDomain. The declarative approach should take precedence, and the activation script commands may be redundant or could conflict.

♻️ Consider removing redundant defaults commands
     # Create Screenshots directory
     mkdir -p "$HOME/Pictures/Screenshots"
 
     # Show ~/Library folder
     chflags nohidden ~/Library
 
-    # Expand save panel by default
-    defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
-
     # Disable "Are you sure you want to open this application?" dialog
     defaults write com.apple.LaunchServices LSQuarantine -bool false

The NSNavPanelExpandedStateForSaveMode setting is already declared at lines 55-56 and will be applied by nix-darwin automatically.

fish/functions/fisher.fish (1)

99-106: Add timeout to curl command.

Line 101 uses curl without a timeout, which could cause the fetch operation to hang indefinitely if a repository is unresponsive.

⏱️ Proposed fix to add timeout
-                        if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null
+                        if command curl -q --silent --max-time 30 -L \$url | command tar -xzC \$temp -f - 2>/dev/null
                             command cp -Rf \$temp/*/* $source

A 30-second timeout provides reasonable protection against hanging while allowing time for slower connections.

CLAUDE.md (1)

28-32: Consider adding a language specifier to the fenced code block.

For improved syntax highlighting and rendering, consider adding a language identifier:

📝 Proposed improvement
-```
+```text
 flake.nix                 # Entry point: inputs + outputs
 ├── nix/darwin/default.nix    # nix-darwin: system packages, macOS settings
 └── nix/home/default.nix      # home-manager: dotfile symlinks
</details>

</blockquote></details>
<details>
<summary>README.md (1)</summary><blockquote>

`78-106`: **Consider adding a language specifier to the fenced code block.**

Similar to CLAUDE.md, adding a language identifier would improve rendering:



<details>
<summary>📝 Proposed improvement</summary>

```diff
-```
+```text
 dotfiles/
 ├── flake.nix                   # Nix flake entry point
 ...
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4071bf and 8c8d82e.

📒 Files selected for processing (32)
  • .config/ghostty/config
  • .config/nvim/init.lua
  • .config/nvim/lua/config/keymaps.lua
  • .config/nvim/lua/config/lazy.lua
  • .config/zsh/README.md
  • .config/zsh/completion.zsh
  • .config/zsh/tools.zsh
  • .github/workflows/ci.yml
  • .gitignore
  • .vscode/settings.json
  • .zprofile
  • .zshenv
  • CLAUDE.md
  • README.md
  • fish/completions/fisher.fish
  • fish/conf.d/00_fig_pre.fish
  • fish/conf.d/99_fig_post.fish
  • fish/conf.d/uv.env.fish
  • fish/conf.d/z.fish
  • fish/config.fish
  • fish/fish_plugins
  • fish/fish_variables
  • fish/functions/__z.fish
  • fish/functions/__z_add.fish
  • fish/functions/__z_clean.fish
  • fish/functions/__z_complete.fish
  • fish/functions/fisher.fish
  • flake.nix
  • install.sh
  • nix/darwin/default.nix
  • nix/home/default.nix
  • stylua.toml
💤 Files with no reviewable changes (1)
  • .config/nvim/lua/config/keymaps.lua
🧰 Additional context used
📓 Path-based instructions (3)
.config/zsh/**/*.zsh

📄 CodeRabbit inference engine (CLAUDE.md)

Create new Zsh modules as .zsh files in .config/zsh/ directory and add them to the _zsh_configs array in .zshrc

Files:

  • .config/zsh/tools.zsh
  • .config/zsh/completion.zsh
.zprofile

📄 CodeRabbit inference engine (CLAUDE.md)

.zprofile: Use .zprofile for login shell configuration only and handle GUI app environment via launchctl setenv
For new GUI environment variables on macOS, add them to .zprofile with launchctl setenv to ensure availability to GUI applications

Files:

  • .zprofile
.zshenv

📄 CodeRabbit inference engine (CLAUDE.md)

.zshenv: Use path_prepend or path_append helpers to avoid PATH duplicates in .zshenv
Source .zshenv for all Zsh invocations and include PATH helper functions, XDG Base Directory exports, editor/locale defaults, and mise shims PATH setup
Set HOMEBREW_FORBIDDEN_FORMULAE to prevent accidentally installing version-managed tools via Homebrew instead of mise

Files:

  • .zshenv
🧠 Learnings (8)
📚 Learning: 2026-01-08T04:34:37.082Z
Learnt from: CR
Repo: posaune0423/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-08T04:34:37.082Z
Learning: Applies to .zshenv : Source `.zshenv` for all Zsh invocations and include PATH helper functions, XDG Base Directory exports, editor/locale defaults, and mise shims PATH setup

Applied to files:

  • fish/conf.d/uv.env.fish
  • .config/zsh/tools.zsh
  • fish/functions/__z_add.fish
  • .zprofile
  • .zshenv
  • .config/zsh/README.md
  • .config/zsh/completion.zsh
  • fish/conf.d/z.fish
📚 Learning: 2026-01-08T04:34:37.082Z
Learnt from: CR
Repo: posaune0423/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-08T04:34:37.082Z
Learning: Applies to .zshenv : Use `path_prepend` or `path_append` helpers to avoid PATH duplicates in `.zshenv`

Applied to files:

  • fish/conf.d/uv.env.fish
  • fish/functions/__z_add.fish
  • .zprofile
  • .zshenv
  • .config/zsh/README.md
  • .config/zsh/completion.zsh
  • fish/conf.d/z.fish
📚 Learning: 2026-01-08T04:34:37.082Z
Learnt from: CR
Repo: posaune0423/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-08T04:34:37.082Z
Learning: Applies to .zshrc : Load Zsh modules from `~/.config/zsh/` in the correct order: core.zsh, completion.zsh (or plugins/autocomplete.zsh), aliases.zsh, functions.zsh, tools.zsh, prompt.zsh (last), then sheldon plugins

Applied to files:

  • .config/zsh/tools.zsh
  • .config/zsh/README.md
  • CLAUDE.md
  • .config/zsh/completion.zsh
  • fish/conf.d/z.fish
📚 Learning: 2026-01-08T04:34:37.082Z
Learnt from: CR
Repo: posaune0423/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-08T04:34:37.082Z
Learning: Applies to .config/zsh/**/*.zsh : Create new Zsh modules as `.zsh` files in `.config/zsh/` directory and add them to the `_zsh_configs` array in `.zshrc`

Applied to files:

  • .config/zsh/tools.zsh
  • fish/functions/__z_add.fish
  • fish/functions/__z.fish
  • .config/zsh/README.md
  • CLAUDE.md
  • .config/zsh/completion.zsh
  • fish/conf.d/z.fish
📚 Learning: 2026-01-08T04:34:37.082Z
Learnt from: CR
Repo: posaune0423/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-08T04:34:37.082Z
Learning: Applies to .zshenv : Set `HOMEBREW_FORBIDDEN_FORMULAE` to prevent accidentally installing version-managed tools via Homebrew instead of mise

Applied to files:

  • .config/zsh/tools.zsh
  • .zprofile
  • .zshenv
📚 Learning: 2026-01-08T04:34:37.082Z
Learnt from: CR
Repo: posaune0423/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-08T04:34:37.082Z
Learning: Applies to .config/mise/config.toml : Configure language runtimes and CLI tools via `.config/mise/config.toml` instead of Homebrew for version-managed software

Applied to files:

  • .zprofile
  • .zshenv
  • CLAUDE.md
📚 Learning: 2026-01-08T04:34:37.082Z
Learnt from: CR
Repo: posaune0423/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-08T04:34:37.082Z
Learning: Applies to .zprofile : Use `.zprofile` for login shell configuration only and handle GUI app environment via `launchctl setenv`

Applied to files:

  • .zprofile
  • .config/zsh/README.md
📚 Learning: 2026-01-08T04:34:37.083Z
Learnt from: CR
Repo: posaune0423/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-08T04:34:37.083Z
Learning: Create symlinks from `~/.dotfiles/` to individual app directories under `~/.config/` rather than symlinking the entire `.config` folder

Applied to files:

  • install.sh
🪛 LanguageTool
CLAUDE.md

[uncategorized] ~90-~90: The official name of this software platform is spelled with a capital “H”.
Context: ...idate flake ``` ## CI GitHub Actions (.github/workflows/ci.yml) runs on every push: ...

(GITHUB)

🪛 markdownlint-cli2 (0.18.1)
README.md

78-78: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

.config/zsh/README.md

7-7: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

CLAUDE.md

28-28: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (38)
.gitignore (1)

1-12: Well-structured gitignore for Nix-based setup.

The file appropriately captures the standard patterns needed for a Nix-based dotfiles repository. The organization by category (Nix, macOS, Editor) is clear, and all patterns are relevant to the transition described in the PR objectives.

.config/nvim/init.lua (1)

1-10: LGTM!

Formatting-only changes with no functional impact. The indentation adjustments align with the new stylua.toml configuration being introduced in this PR.

.config/nvim/lua/config/lazy.lua (3)

2-13: LGTM! Good compatibility and error handling improvements.

The (vim.uv or vim.loop) pattern ensures compatibility with both Neovim 0.9 (vim.loop) and 0.10+ (vim.uv). The added error handling for clone failures with user feedback before exit is a welcome improvement over silent failures.


17-49: LGTM!

The spec configuration follows LazyVim's recommended structure. The colorscheme choice (ayu-mirage) is consistent with the VS Code theme (Ayu Mirage Bordered) configured in .vscode/settings.json, maintaining visual consistency across editors.


50-84: LGTM!

Well-structured configuration following LazyVim best practices:

  • version = false to use latest commits as recommended
  • checker.notify = false prevents notification spam
  • Performance optimizations disable unused built-in plugins while keeping useful ones like matchparen
.vscode/settings.json (1)

183-186: LGTM!

The Lua formatter configuration correctly references the StyLua extension, which works in tandem with the new stylua.toml configuration file. The theme change to "Ayu Mirage Bordered" maintains consistency with the Neovim colorscheme (ayu-mirage).

fish/conf.d/00_fig_pre.fish (1)

1-1: Same verification and naming considerations as 99_fig_post.fish.

This file mirrors the pattern in fish/conf.d/99_fig_post.fish with the same filename-vs-tool-name mismatch. The pre/post initialization lifecycle looks correct, but apply the same verification and naming considerations mentioned in the review of 99_fig_post.fish.

.config/zsh/tools.zsh (2)

1-8: LGTM! Clean transition from z.sh to zoxide.

The replacement of z.sh with zoxide initialization is well-implemented with proper availability checks. This aligns with the Nix-first approach of the PR.


10-18: No issues found. The atuin --disable-up-arrow flag is valid per official Atuin documentation, all three tools (zoxide, atuin, mcfly) are properly declared in the Nix configuration, and tools.zsh is correctly registered in the _zsh_configs array in .zshrc.

.zprofile (2)

13-16: LGTM! Documentation accurately reflects Nix-first approach.

The updated comments correctly document that runtimes are now managed by Nix, removing legacy mise references. The use of path_append helper is appropriate and aligns with the coding guidelines.


38-46: LGTM! GUI environment handling follows best practices.

The use of launchctl setenv to make environment variables available to GUI applications on macOS is correct and follows the coding guidelines for .zprofile.

fish/fish_plugins (1)

1-2: LGTM!

The plugin declarations are clean and follow standard Fisher plugin format.

fish/completions/fisher.fish (1)

1-7: LGTM!

The completion definitions are well-structured with appropriate conditions and follow Fish completion best practices.

.config/zsh/completion.zsh (1)

17-23: LGTM!

The Nix completion paths are correctly added to fpath with proper existence checks. The ordering (system-level nix-darwin first, then user-level home-manager) ensures correct precedence for completion functions.

fish/functions/__z_complete.fish (1)

1-13: LGTM!

The completion function correctly registers dynamic directory completions from __z -l output for both commands and provides comprehensive option completions for the primary command.

flake.nix (2)

16-17: Hardcoded username reduces portability.

The username asumayamada is hardcoded, which limits this configuration's portability. For a personal dotfiles repo this is typically fine, but if you intend to share this configuration or use it across multiple machines with different usernames, consider parameterizing it (e.g., via an environment variable or a separate config file).


77-77: No changes needed — pkgs.nixfmt is correct.

The code is using the correct package. nixfmt-rfc-style was a temporary attribute during the RFC-166 formatter rollout; it has been deprecated in favor of the stable pkgs.nixfmt (which implements the RFC-166 standard). The current code requires no changes.

Likely an incorrect or invalid review comment.

.zshenv (1)

25-33: LGTM! The Nix path setup correctly uses path_prepend helpers as per coding guidelines.

Note: The HOMEBREW_FORBIDDEN_FORMULAE export was removed per the Nix transition. As per coding guidelines, consider whether you still want to prevent Homebrew from accidentally installing tools now managed by Nix (e.g., node, python, etc.) by keeping this variable with updated values.

nix/home/default.nix (1)

1-31: LGTM! Well-structured Home Manager configuration.

The module signature, home directory setup, and dotfile/XDG config mappings are correctly implemented. The use of ${self} for repository-relative paths ensures portability, and the explicit compatibility note for Ghostty (lines 28-30) demonstrates attention to detail.

fish/functions/__z_add.fish (1)

41-48: Good documentation of the race condition.

The comments appropriately acknowledge the inherent race condition in concurrent modifications. While the atomic mv operation (line 46) mitigates some risk, the acknowledged TOCTOU issue is acceptable for z-like directory tracking where occasional data inconsistency is tolerable.

.config/zsh/README.md (1)

3-29: Well-documented modular structure.

The documentation clearly explains the Nix-first approach and provides straightforward customization guidance for adding tools, aliases, and functions.

nix/darwin/default.nix (3)

109-294: Comprehensive package list covers the migration from mise and Homebrew.

The categorized package list is well-organized and clearly documents the transition from mise-based runtime management to Nix packages. The comments noting where additional tools should be installed via npm/uv/pipx (lines 271-276) are helpful.


296-327: Excellent documentation of GUI application installation.

The comprehensive list of GUI applications with installation sources (Mac App Store, direct download URLs) provides clear guidance for users. This addresses the gap left by not using Homebrew casks in a Nix-first approach.


259-267: All package names verified and available in nixpkgs.

The packages listed in lines 259-267 are all valid and present in current nixpkgs:

  • nodejs_22, python313, temurin-bin-21, bun, and deno all have valid attribute names in nixpkgs. No changes needed.
fish/functions/fisher.fish (2)

227-240: Migration logic is appropriately guarded.

The upgrade-to-4.4 migration check (line 227) runs on every invocation but uses a universal variable to ensure the migration only executes once per system. This is an acceptable trade-off for ensuring smooth upgrades without requiring manual intervention.


1-224: Solid plugin manager implementation.

The fisher function provides comprehensive plugin management with:

  • Parallel fetching for performance (lines 79-115)
  • Conflict detection to prevent overwriting user files (lines 164-172)
  • Atomic operations via universal variables (lines 181-183)
  • Proper cleanup and event emission (lines 188-193)

The implementation is well-structured and handles edge cases appropriately.

CLAUDE.md (4)

11-22: Clear installation instructions.

The installation flow is well-documented and consistent with the installer script. The dry-run option is a helpful addition for users who want to preview changes.


24-71: Excellent architecture documentation.

The architecture section clearly explains the Nix structure, Zsh loading order, and dotfile symlink management. The details about home-manager's automatic symlinking and the specific loading order are particularly helpful.


72-87: Clear conventions and command reference.

The conventions section provides actionable guidance for common tasks, and the command reference is concise and practical.


88-92: CI documentation is clear and accurate.

The CI section appropriately describes the automated checks that run on every push.

README.md (4)

1-59: Comprehensive Quick Start documentation.

The Quick Start section provides both automated and manual installation paths, making it accessible for different user preferences. The distinction between first-time setup and subsequent runs is clear.


108-133: Comprehensive tooling overview.

The "What Gets Installed" section provides a clear inventory of CLI tools, language runtimes, and macOS settings managed by Nix.


134-205: Excellent customization and troubleshooting guidance.

The customization examples are practical and actionable. The troubleshooting section appropriately focuses on Nix-specific concerns like PATH ordering and rebuild commands.


60-74: Well-documented daily usage commands.

All referenced apps (switch, update, build, check) are properly defined in flake.nix (lines 55–75), confirming the documentation is accurate and ready for use.

install.sh (4)

1-34: Solid shell script foundation.

The script uses proper error handling (set -eu), best-effort pipefail, and appropriate terminal detection for colors. Good portability considerations.


79-136: Well-structured configuration and argument parsing.

The script properly handles all options with clear defaults and helpful error messages. The addition of the --host option aligns with nix-darwin's host-specific configurations.


191-207: Robust repository setup logic.

The script properly handles both initial cloning and updates to existing repositories. The shallow clone (--depth 1) is efficient, and the update logic with --ff-only prevents unexpected merges.


229-242: Clear installation summary and next steps.

The completion message provides actionable next steps for users, including both the nix run .#switch command for future changes and the shell restart option.

Comment on lines 7 to 18
```
~/.zshenv # 環境変数・PATH設定(統合
~/.zprofile # ログインシェル専用設定・GUI アプリ用環境変数
~/.zshrc # メイン設定ファイル(他ファイルを読み込み)
~/.config/zsh/ # モジュール化された設定ファイル群
├── autocomplete.zsh # zsh-autocomplete 設定(最初に読み込み)
├── zsh-config.zsh # zsh基本設定(履歴・オプション・補完
├── ui.zsh # UI・プラグイン・プロンプト(最後に読み込み)
├── aliases.zsh # コマンドエイリアス・ショートカット
├── functions.zsh # カスタムシェル関数
└── tools.zsh # 開発ツール読み込み
~/.zshenv # PATH設定(Nix優先
~/.zprofile # ログインシェル・GUI環境変数
~/.zshrc # モジュール読み込み
~/.config/zsh/
├── core.zsh # 履歴・オプション
├── completion.zsh # 補完(Nix site-functions
├── aliases.zsh # エイリアス
├── functions.zsh # カスタム関数
├── tools.zsh # zoxide, atuin, mcfly 初期化
└── prompt.zsh # Starship
```
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add language identifier to the fenced code block.

The code block should specify a language for proper syntax highlighting and linting compliance.

📝 Proposed fix

+text
~/.zshenv # PATH設定(Nix優先)
~/.zprofile # ログインシェル・GUI環境変数

</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **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.

```suggestion

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

7-7: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In @.config/zsh/README.md around lines 7 - 18, The fenced code block in
README.md lacks a language identifier; update the opening fence to include one
(e.g., change ``` to ```text or ```bash) so the block around the list (the lines
starting with ~/.zshenv, ~/.zprofile, ~/.zshrc and the tree under
~/.config/zsh/) is annotated for proper syntax highlighting and linting; ensure
only the opening fence is modified and keep the existing content and closing ```
unchanged.

Comment on lines +16 to +17
- name: Install Nix (Determinate Systems)
uses: DeterminateSystems/nix-installer-action@main
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Pin the Nix installer action to a specific version.

Using @main makes the CI workflow vulnerable to unexpected breakage if the upstream action changes. This affects build reproducibility and reliability.

🔒 Recommended fix

Pin to a specific version or commit SHA:

-      - name: Install Nix (Determinate Systems)
-        uses: DeterminateSystems/nix-installer-action@main
+      - name: Install Nix (Determinate Systems)
+        uses: DeterminateSystems/nix-installer-action@v12

Apply the same fix to line 35 in the format job.

📝 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
- name: Install Nix (Determinate Systems)
uses: DeterminateSystems/nix-installer-action@main
- name: Install Nix (Determinate Systems)
uses: DeterminateSystems/nix-installer-action@v12
🤖 Prompt for AI Agents
In @.github/workflows/ci.yml around lines 16 - 17, The workflow step currently
uses the Nix installer action with an unstable reference "uses:
DeterminateSystems/nix-installer-action@main"; change both occurrences (the
Install Nix step in the build job and the corresponding Install Nix step in the
format job) to pin to a specific released tag or commit SHA (e.g., replace
"@main" with a stable tag like "@v1.2.3" or a commit SHA) so the CI is
deterministic and resistant to upstream changes.

Comment on lines +19 to +20
- name: Enable Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Pin the Magic Nix Cache action to a specific version.

Using @main makes the CI workflow vulnerable to unexpected breakage if the upstream action changes.

🔒 Recommended fix

Pin to a specific version or commit SHA:

-      - name: Enable Magic Nix Cache
-        uses: DeterminateSystems/magic-nix-cache-action@main
+      - name: Enable Magic Nix Cache
+        uses: DeterminateSystems/magic-nix-cache-action@v7

Apply the same fix to line 38 in the format job.

📝 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
- name: Enable Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Enable Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v7
🤖 Prompt for AI Agents
In @.github/workflows/ci.yml around lines 19 - 20, Replace the unpinned action
usage "DeterminateSystems/magic-nix-cache-action@main" with a fixed version or
commit reference in both places where it appears (the Enable Magic Nix Cache
step and the format job step) so the workflow uses a stable, known release/sha;
locate the two uses of DeterminateSystems/magic-nix-cache-action and update them
to a specific tag like @vX.Y.Z or a commit SHA.

@@ -0,0 +1 @@
test -x ~/.local/bin/kiro-cli; and eval (~/.local/bin/kiro-cli init fish post --rcfile 99_fig_post | string split0) No newline at end of file
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify kiro-cli availability and any references to "fig" vs "kiro"

# Check if kiro-cli is defined in Nix configurations
echo "=== Searching for kiro-cli in Nix configurations ==="
rg -n "kiro-cli" nix/ 2>/dev/null || echo "No kiro-cli references found in nix/"

echo -e "\n=== Searching for kiro-cli in entire repo ==="
rg -n "kiro-cli" . 2>/dev/null || echo "No kiro-cli references found"

echo -e "\n=== Searching for 'fig' references in fish/conf.d/ ==="
rg -n "fig" fish/conf.d/ 2>/dev/null || echo "No 'fig' references found in fish/conf.d/"

echo -e "\n=== Searching for 'fig' references in .config/fish/ ==="
rg -n "fig" .config/fish/ 2>/dev/null || echo "No 'fig' references found in .config/fish/"

echo -e "\n=== Checking if file 99_fig_post.fish exists and its content ==="
cat -n fish/conf.d/99_fig_post.fish 2>/dev/null || echo "File not found"

Repository: posaune0423/dotfiles

Length of output: 1131


Verify and resolve filename-content mismatch across fish configuration files.

Both 00_fig_pre.fish and 99_fig_post.fish contain kiro-cli references but use "fig" in their filenames. The filenames are passed as --rcfile parameters to kiro-cli (e.g., --rcfile 99_fig_post), suggesting they may be intentional or required by the tool. Before renaming, verify whether kiro-cli expects these specific filenames or if they can be changed without breaking functionality.

Comment on lines +49 to +63
function __z_uninstall --on-event z_uninstall
functions -e __z_on_variable_pwd
functions -e $Z_CMD
functions -e $ZO_CMD

if test ! -z "$Z_DATA"
printf "To completely erase z's data, remove:\n" >/dev/stderr
printf "%s\n" "$Z_DATA" >/dev/stderr
end

set -e Z_CMD
set -e ZO_CMD
set -e Z_DATA
set -e Z_EXCLUDE
end
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add Z_DATA_DIR to the uninstall cleanup.

The uninstall function removes Z_CMD, ZO_CMD, Z_DATA, and Z_EXCLUDE universal variables, but omits Z_DATA_DIR which is set on line 3 or 5. This leaves an orphaned universal variable after uninstall.

🧹 Proposed fix
     set -e Z_CMD
     set -e ZO_CMD
     set -e Z_DATA
+    set -e Z_DATA_DIR
     set -e Z_EXCLUDE
📝 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
function __z_uninstall --on-event z_uninstall
functions -e __z_on_variable_pwd
functions -e $Z_CMD
functions -e $ZO_CMD
if test ! -z "$Z_DATA"
printf "To completely erase z's data, remove:\n" >/dev/stderr
printf "%s\n" "$Z_DATA" >/dev/stderr
end
set -e Z_CMD
set -e ZO_CMD
set -e Z_DATA
set -e Z_EXCLUDE
end
function __z_uninstall --on-event z_uninstall
functions -e __z_on_variable_pwd
functions -e $Z_CMD
functions -e $ZO_CMD
if test ! -z "$Z_DATA"
printf "To completely erase z's data, remove:\n" >/dev/stderr
printf "%s\n" "$Z_DATA" >/dev/stderr
end
set -e Z_CMD
set -e ZO_CMD
set -e Z_DATA
set -e Z_DATA_DIR
set -e Z_EXCLUDE
end
🤖 Prompt for AI Agents
In @fish/conf.d/z.fish around lines 49 - 63, The __z_uninstall function
currently unsets Z_CMD, ZO_CMD, Z_DATA, and Z_EXCLUDE but misses removing the
universal Z_DATA_DIR; update the uninstall cleanup in function __z_uninstall to
also unset Z_DATA_DIR (i.e., add a set -e Z_DATA_DIR alongside the existing set
-e Z_CMD, ZO_CMD, Z_DATA, and Z_EXCLUDE) so no orphaned universal variable
remains after uninstall.

Comment on lines +40 to +42
else if set -q _flag_delete
sed -i -e "\:^$PWD|.*:d" $Z_DATA
return 0
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

sed -i is not portable across BSD and GNU.

On macOS (BSD sed), sed -i requires a backup extension argument (e.g., sed -i ''). The current invocation will fail on macOS with an error like "invalid command code".

🐛 Proposed fix for macOS compatibility
     else if set -q _flag_delete
-        sed -i -e "\:^$PWD|.*:d" $Z_DATA
+        sed -i '' -e "\:^$PWD|.*:d" $Z_DATA
         return 0
     end

Alternatively, for cross-platform compatibility, consider using a temp file approach similar to __z_clean.

📝 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
else if set -q _flag_delete
sed -i -e "\:^$PWD|.*:d" $Z_DATA
return 0
else if set -q _flag_delete
sed -i '' -e "\:^$PWD|.*:d" $Z_DATA
return 0
🤖 Prompt for AI Agents
In @fish/functions/__z.fish around lines 40 - 42, The sed -i usage in the delete
branch (when _flag_delete is set) is not portable to BSD/macOS; change the
implementation to avoid in-place sed -i: either call sed with a POSIX-compatible
pattern and write output to a temporary file then move it back (similar to
__z_clean), or detect BSD sed and pass an empty backup extension (''), ensuring
you operate on the same Z_DATA variable and preserve permissions; update the
branch that references _flag_delete and Z_DATA to use the temp-file replace
approach for cross-platform compatibility.

Comment on lines +160 to +165
else if test "$OS" = Windows_NT
# Be careful, in msys2, explorer always return 1
type -q explorer; and explorer "$target"
return 0
echo "Cannot open file explorer"
return 1
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Unreachable code after return 0.

Lines 164-165 can never execute because return 0 on line 163 exits the function unconditionally. The error messages for the Windows explorer case are dead code.

♻️ Proposed fix
         else if test "$OS" = Windows_NT
             # Be careful, in msys2, explorer always return 1
-            type -q explorer; and explorer "$target"
-            return 0
-            echo "Cannot open file explorer"
-            return 1
+            if type -q explorer
+                explorer "$target"
+                return 0
+            else
+                echo "Cannot open file explorer"
+                return 1
+            end
📝 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
else if test "$OS" = Windows_NT
# Be careful, in msys2, explorer always return 1
type -q explorer; and explorer "$target"
return 0
echo "Cannot open file explorer"
return 1
else if test "$OS" = Windows_NT
# Be careful, in msys2, explorer always return 1
if type -q explorer
explorer "$target"
return 0
else
echo "Cannot open file explorer"
return 1
end
🤖 Prompt for AI Agents
In @fish/functions/__z.fish around lines 160 - 165, In the Windows_NT branch
(the else if test "$OS" = Windows_NT block) the echo "Cannot open file explorer"
and the subsequent return 1 are unreachable because of the unconditional return
0 immediately after launching explorer; fix by removing or moving the premature
return 0 and instead check the result of the explorer invocation (e.g., run type
-q explorer; and explorer "$target" and if that fails then echo "Cannot open
file explorer" and return 1; otherwise return 0) so the error message and
non-zero return occur only on failure.

Comment on lines +146 to +152
# =============================================================================
# Check Dependencies
# =============================================================================
need_cmd() {
command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1"
}
need_cmd git
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add dependency check for curl.

The script uses curl extensively (lines 180, 187) but only checks for git. Add a check for curl to fail early with a clear message if it's missing.

🔧 Proposed fix
 need_cmd() {
   command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1"
 }
 need_cmd git
+need_cmd curl
📝 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
# =============================================================================
# Check Dependencies
# =============================================================================
need_cmd() {
command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1"
}
need_cmd git
# =============================================================================
# Check Dependencies
# =============================================================================
need_cmd() {
command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1"
}
need_cmd git
need_cmd curl
🤖 Prompt for AI Agents
In @install.sh around lines 146 - 152, The script's dependency check only
verifies git but not curl, which is used later; update the need_cmd usage to
also call need_cmd for "curl" (i.e., add a dependency check for curl alongside
the existing need_cmd git) so the installer fails early with a clear "Required
command not found: curl" message if curl is missing; locate the checks in the
need_cmd block and the invocation area where need_cmd git is called and add
need_cmd curl there.

Comment on lines 170 to +189
# =============================================================================
# Clone or Update Repository
# Step 1: Install Nix (if needed)
# =============================================================================
print_section "${ICON_NIX} Nix Setup"

if command -v nix >/dev/null 2>&1; then
success "Nix is already installed"
else
info "Installing Nix (Determinate Systems installer)..."
if [ "$DRY_RUN" -eq 0 ]; then
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# Source Nix for current shell
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
success "Nix installed"
else
dry_run_msg "curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install"
fi
fi
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Verify Nix installation succeeded before proceeding.

After installing Nix, the script should verify that the nix command is now available. If the installation fails silently or the PATH isn't properly updated, subsequent steps will fail with unclear errors.

🔒 Proposed fix
     curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
     # Source Nix for current shell
     if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
       . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
     fi
+    # Verify Nix is now available
+    command -v nix >/dev/null 2>&1 || die "Nix installation failed - nix command not found"
     success "Nix installed"
   else
     dry_run_msg "curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install"
📝 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
# =============================================================================
# Clone or Update Repository
# Step 1: Install Nix (if needed)
# =============================================================================
print_section "${ICON_NIX} Nix Setup"
if command -v nix >/dev/null 2>&1; then
success "Nix is already installed"
else
info "Installing Nix (Determinate Systems installer)..."
if [ "$DRY_RUN" -eq 0 ]; then
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# Source Nix for current shell
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
success "Nix installed"
else
dry_run_msg "curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install"
fi
fi
# =============================================================================
# Step 1: Install Nix (if needed)
# =============================================================================
print_section "${ICON_NIX} Nix Setup"
if command -v nix >/dev/null 2>&1; then
success "Nix is already installed"
else
info "Installing Nix (Determinate Systems installer)..."
if [ "$DRY_RUN" -eq 0 ]; then
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# Source Nix for current shell
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# Verify Nix is now available
command -v nix >/dev/null 2>&1 || die "Nix installation failed - nix command not found"
success "Nix installed"
else
dry_run_msg "curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install"
fi
fi
🤖 Prompt for AI Agents
In @install.sh around lines 170 - 189, After running the Determinate Nix
installer (when DRY_RUN == 0) ensure the script verifies the installation by
re-checking command -v nix and/or attempting nix --version; if the command is
not found log an error via failure helper (e.g., use existing success/info
functions or call success/info/fail) and exit non‑zero. In the block that
sources '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' and after
the installer completes, add a validation step that retries sourcing if
necessary, runs command -v nix || nix --version to confirm availability, and on
failure emit a clear error message and exit to prevent later silent failures.

Comment on lines 209 to +227
# =============================================================================
# Create Symlinks
# Step 3: Run nix-darwin switch
# =============================================================================
print_section "${ICON_FOLDER} Creating Symlinks"

# Ensure XDG config home exists
run mkdir -p "$HOME/.config"
print_section "${ICON_NIX} Applying Nix Configuration"

# Count total items (4 root + 8 config = 12)
set_total_items 12
info "Running nix-darwin switch (this may take a while on first run)..."

# Root dotfiles
link_item "$DOTFILES_DIR/.zshenv" "$HOME/.zshenv" "$TS"
link_item "$DOTFILES_DIR/.zshrc" "$HOME/.zshrc" "$TS"
link_item "$DOTFILES_DIR/.zprofile" "$HOME/.zprofile" "$TS"
link_item "$DOTFILES_DIR/.gitconfig" "$HOME/.gitconfig" "$TS"

# XDG configs (link individual apps, not ~/.config as a whole)
link_item "$DOTFILES_DIR/.config/zsh" "$HOME/.config/zsh" "$TS"
link_item "$DOTFILES_DIR/.config/sheldon" "$HOME/.config/sheldon" "$TS"
link_item "$DOTFILES_DIR/.config/nvim" "$HOME/.config/nvim" "$TS"
link_item "$DOTFILES_DIR/.config/wezterm" "$HOME/.config/wezterm" "$TS"
link_item "$DOTFILES_DIR/.config/mise" "$HOME/.config/mise" "$TS"
link_item "$DOTFILES_DIR/.config/karabiner" "$HOME/.config/karabiner" "$TS"
link_item "$DOTFILES_DIR/.config/ghostty" "$HOME/.config/ghostty" "$TS"
link_item "$DOTFILES_DIR/.config/starship.toml" "$HOME/.config/starship.toml" "$TS"
if [ "$DRY_RUN" -eq 0 ]; then
cd "$DOTFILES_DIR"
# First time: use nix run nix-darwin; afterwards darwin-rebuild is in PATH
if command -v darwin-rebuild >/dev/null 2>&1; then
sudo darwin-rebuild switch --flake ".#$HOST"
else
sudo nix run nix-darwin -- switch --flake ".#$HOST"
fi
success "Configuration applied"
else
dry_run_msg "cd $DOTFILES_DIR && sudo nix run nix-darwin -- switch --flake .#$HOST"
fi
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Explore repository structure
echo "=== Repository structure ==="
git ls-files | head -20

echo -e "\n=== Looking for flake.nix ==="
fd flake.nix

echo -e "\n=== Checking current directory structure ==="
ls -la | head -20

Repository: posaune0423/dotfiles

Length of output: 1876


🏁 Script executed:

#!/bin/bash
# Check if install.sh exists and examine the relevant lines
echo "=== Checking install.sh ==="
fd install.sh

echo -e "\n=== Examining install.sh lines 209-227 ==="
if [ -f install.sh ]; then
  sed -n '209,227p' install.sh
fi

echo -e "\n=== Looking for HOST variable definition in install.sh ==="
rg -n "HOST" install.sh | head -20

Repository: posaune0423/dotfiles

Length of output: 1244


🏁 Script executed:

#!/bin/bash
# Check for darwinConfigurations in flake.nix
echo "=== Checking for darwinConfigurations in flake.nix ==="
if [ -f flake.nix ]; then
  echo "flake.nix found"
  rg -n "darwinConfigurations" flake.nix
  echo -e "\n=== Full flake.nix content (first 100 lines) ==="
  head -100 flake.nix
fi

Repository: posaune0423/dotfiles

Length of output: 2431


Critical mismatch between install.sh HOST parameterization and flake.nix configuration.

The script accepts a HOST parameter (line 130, defaults to "mac") and passes it to the flake via --flake ".#$HOST" (lines 220, 222). However, flake.nix hard-codes host = "mac" and only defines darwinConfigurations.mac. If the script is run with a different hostname (e.g., ./install.sh myhost), the nix-darwin switch will fail because darwinConfigurations.myhost doesn't exist in flake.nix.

Either:

  1. Make flake.nix accept the host as a parameter instead of hard-coding "mac", or
  2. Remove the HOST parameter from install.sh and always use "mac"
🤖 Prompt for AI Agents
In @install.sh around lines 209 - 227, The install script's HOST parameter
(variable HOST and the --flake ".#$HOST" usage in install.sh) can mismatch
flake.nix which hard-codes host = "mac" and only defines
darwinConfigurations.mac, causing nix-darwin switch to fail for other hostnames;
fix by either removing the HOST parameter and always using ".#mac" in the
--flake invocation (and delete or default HOST usage) or update flake.nix to
accept a host input and expose darwinConfigurations.<host> dynamically (so the
flake honors the passed HOST), ensuring the symbols to change are the HOST
variable and the --flake ".#$HOST" string in install.sh or the host = "mac" /
darwinConfigurations.mac entries in flake.nix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant