Skip to content

feat: add Linux (DGX OS / Ubuntu) support#77

Open
toku345 wants to merge 1 commit intomainfrom
feat/issue-58-linux-support
Open

feat: add Linux (DGX OS / Ubuntu) support#77
toku345 wants to merge 1 commit intomainfrom
feat/issue-58-linux-support

Conversation

@toku345
Copy link
Owner

@toku345 toku345 commented Nov 30, 2025

Summary

  • Add OS branching to package installation script (Homebrew for macOS, apt for Linux)
  • Add macOS guard to iTerm2 shell integration script
  • Exclude macOS-only configs (Karabiner, iTerm2) on Linux via .chezmoiignore

Linux package installation includes:

  • Core tools via apt (git, tmux, fish, fzf, ripgrep, etc.)
  • Tools from GitHub releases (starship, eza, age, delta, direnv, asdf)
  • Nerd Fonts for desktop usage

Test plan

  • Verify macOS behavior with chezmoi apply
  • Test on NVIDIA DGX OS (Ubuntu-based) environment

Closes #58

🤖 Generated with Claude Code

Add multi-platform support for NVIDIA DGX OS (Ubuntu-based):

- Add OS branching to package installation script (Homebrew for macOS, apt for Linux)
- Add macOS guard to iTerm2 shell integration script
- Exclude macOS-only configs (Karabiner, iTerm2) on Linux via .chezmoiignore

Linux package installation includes:
- Core tools via apt (git, tmux, fish, fzf, ripgrep, etc.)
- Tools from GitHub releases (starship, eza, age, delta, direnv, asdf)
- Nerd Fonts for desktop usage

Closes #58

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Nov 30, 2025

Walkthrough

This pull request extends dotfiles configuration for cross-platform support. Changes add OS-level branching using the CHEZMOI_OS environment variable to conditionally apply macOS-specific settings on Linux/WSL environments. Updates include file exclusions, shell integration checks, and comprehensive package manager selection based on operating system.

Changes

Cohort / File(s) Change Summary
Configuration and Exclusions
\.chezmoiignore
Added macOS-specific (darwin) exclusion block using conditional template logic to exclude karabiner and iterm2 configurations on non-macOS systems.
Installation Scripts
\.chezmoiscripts/run_once_after_install-item2-fish-shell-integration.sh
Added CHEZMOI_OS guard to skip iTerm2 shell integration on non-macOS; relocated file operations (directory creation and download) behind the OS check; improved path quoting in shell commands.
Package Installation
\.chezmoiscripts/run_once_before_install-minimum-packages.sh
Introduced OS-aware branching for macOS (darwin) and Linux; replaced flat brew-only sequence with conditional logic for apt-get, curl, wget, dpkg on Linux; added fallback mechanisms for tool aliases (bat/batcat, fd/fdfind); consolidated package installation with post-install steps including asdf cloning and Nerd Font fetching.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • run_once_before_install-minimum-packages.sh requires careful review of the new conditional branching logic to verify correct package manager selections and command syntax across both macOS and Linux paths
  • Cross-platform compatibility details in package names and installation methods (e.g., bat vs. batcat, fd vs. fdfind) should be validated
  • Path handling changes and quoting in shell commands should be checked for correctness

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main objective of adding Linux support to the dotfiles configuration.
Description check ✅ Passed The description clearly explains the changes made, includes specific implementation details, mentions the target issue, and provides a test plan aligned with the changeset.
Linked Issues check ✅ Passed The PR successfully implements core requirements from issue #58: OS-specific branching in installation scripts, macOS guards for platform-specific tools, and conditional config exclusions for Linux.
Out of Scope Changes check ✅ Passed All changes in the PR are directly related to adding Linux support as specified in issue #58; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/issue-58-linux-support

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

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

🧹 Nitpick comments (2)
.chezmoiscripts/run_once_after_install-item2-fish-shell-integration.sh (1)

9-10: LGTM! Proper shell integration installation.

The directory creation and download logic are correct, with appropriate quoting and HTTPS usage.

Minor note: The script filename contains a typo ("item2" instead of "iterm2"), though this doesn't affect functionality.

.chezmoiscripts/run_once_before_install-minimum-packages.sh (1)

30-45: LGTM! Appropriate use of official installers with good fallback logic.

The starship installation via official installer and eza's graceful fallback to the community repository are well-implemented. The GPG key verification for the eza repository adds good security hygiene.

Security note: Piping curl output to shell (line 32) is a common pattern for installer scripts but does carry inherent trust assumptions. This is acceptable for dotfiles installation from trusted sources.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2fcde0b and 51301c4.

📒 Files selected for processing (3)
  • .chezmoiignore (1 hunks)
  • .chezmoiscripts/run_once_after_install-item2-fish-shell-integration.sh (1 hunks)
  • .chezmoiscripts/run_once_before_install-minimum-packages.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/.chezmoiscripts/**

📄 CodeRabbit inference engine (CLAUDE.md)

Use environment variables or runtime detection in shell scripts (.chezmoiscripts/) and config files instead of Go Templates

Files:

  • .chezmoiscripts/run_once_before_install-minimum-packages.sh
  • .chezmoiscripts/run_once_after_install-item2-fish-shell-integration.sh
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: toku345/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-29T15:38:35.953Z
Learning: Applies to **/.chezmoiscripts/** : Use environment variables or runtime detection in shell scripts (`.chezmoiscripts/`) and config files instead of Go Templates
📚 Learning: 2025-11-29T15:38:35.953Z
Learnt from: CR
Repo: toku345/dotfiles PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-29T15:38:35.953Z
Learning: Applies to **/.chezmoiscripts/** : Use environment variables or runtime detection in shell scripts (`.chezmoiscripts/`) and config files instead of Go Templates

Applied to files:

  • .chezmoiignore
  • .chezmoiscripts/run_once_before_install-minimum-packages.sh
🔇 Additional comments (8)
.chezmoiignore (1)

8-13: LGTM! Clean OS-aware exclusion logic.

The conditional exclusion correctly prevents macOS-only configurations from being applied on Linux systems. The use of Go templates is appropriate here since .chezmoiignore is processed by chezmoi's template engine.

.chezmoiscripts/run_once_after_install-item2-fish-shell-integration.sh (1)

3-7: LGTM! Correct use of environment variable for OS detection.

The OS guard correctly uses the CHEZMOI_OS environment variable for runtime detection, following the coding guidelines for .chezmoiscripts/ files.

Based on learnings, this approach is preferred over Go templates in shell scripts.

.chezmoiscripts/run_once_before_install-minimum-packages.sh (6)

3-10: LGTM! Clean macOS package installation.

The Homebrew-based installation correctly uses the CHEZMOI_OS environment variable and efficiently groups related package installations.

Based on learnings, using environment variables for OS detection in shell scripts is the preferred approach.


11-14: LGTM! Comprehensive base package installation.

The Linux base setup installs essential development and utility packages using standard apt-get practices.


16-28: LGTM! Excellent handling of Ubuntu package naming differences.

The conditional symlink creation elegantly addresses Ubuntu's different package names (batcat and fdfind) while maintaining consistent command names across platforms.


65-68: LGTM! Standard direnv installation.

Uses the official installer with appropriate existence check.


70-74: LGTM! Correct asdf installation.

Standard asdf installation using git clone with version pinning.


76-88: LGTM! Well-designed font installation with caching.

The Nerd Fonts installation correctly checks for existing fonts to avoid redundant downloads and properly updates the font cache.

Comment on lines +47 to +63
# age (暗号化ツール) - 最新版を取得
if ! command -v age >/dev/null 2>&1; then
sudo apt-get install -y age 2>/dev/null || {
AGE_VERSION=$(curl -sL https://api.github.com/repos/FiloSottile/age/releases/latest | grep '"tag_name"' | cut -d'"' -f4 | sed 's/^v//')
wget -qO /tmp/age.tar.gz "https://github.com/FiloSottile/age/releases/download/v${AGE_VERSION}/age-v${AGE_VERSION}-linux-amd64.tar.gz"
sudo tar -xzf /tmp/age.tar.gz -C /usr/local/bin --strip-components=1 age/age age/age-keygen
rm /tmp/age.tar.gz
}
fi

# git-delta (GitHub Release) - 最新版を取得
if ! command -v delta >/dev/null 2>&1; then
DELTA_VERSION=$(curl -sL https://api.github.com/repos/dandavison/delta/releases/latest | grep '"tag_name"' | cut -d'"' -f4)
wget -qO /tmp/delta.deb "https://github.com/dandavison/delta/releases/download/${DELTA_VERSION}/git-delta_${DELTA_VERSION}_amd64.deb"
sudo dpkg -i /tmp/delta.deb
rm /tmp/delta.deb
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

Hardcoded architecture breaks ARM64 compatibility.

Lines 51 and 60 hardcode amd64 architecture, which will fail on ARM64 systems (increasingly common with Raspberry Pi, AWS Graviton, Apple Silicon Linux VMs, etc.).

Detect the system architecture dynamically:

-            wget -qO /tmp/age.tar.gz "https://github.com/FiloSottile/age/releases/download/v${AGE_VERSION}/age-v${AGE_VERSION}-linux-amd64.tar.gz"
+            ARCH=$(uname -m)
+            case "$ARCH" in
+                x86_64) ARCH="amd64" ;;
+                aarch64) ARCH="arm64" ;;
+                *) echo "Unsupported architecture: $ARCH"; exit 1 ;;
+            esac
+            wget -qO /tmp/age.tar.gz "https://github.com/FiloSottile/age/releases/download/v${AGE_VERSION}/age-v${AGE_VERSION}-linux-${ARCH}.tar.gz"

Apply similar changes to the delta installation (line 60).

Additional considerations:

  1. GitHub API rate limiting: Unauthenticated API calls (lines 50, 59, 72, 79) are limited to 60/hour per IP. In CI/CD or multiple runs, consider caching version numbers or using authenticated requests via gh api if available.

  2. Security: Downloaded binaries lack checksum or signature verification. For enhanced security in production use, verify release signatures or checksums published by the projects.

Committable suggestion skipped: line range outside the PR's diff.

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