Conversation
Replace the vanilla btop package with a custom flake-based build that enables cudaSupport. This adds a flake.nix that overrides btop with cudaSupport=true and updates devbox.json to reference the local flake output instead of the default nixpkgs package. https://claude.ai/code/session_01Cd4UZeN7xCZq4VdxFUYLai
- Replace destructive `chezmoi purge --force` with idempotent `chezmoi init || true` in install-chezmoi script - Add ~/.zshrc.local and ~/.bashrc.local sourcing hooks so machine-specific customizations survive chezmoi apply https://claude.ai/code/session_01Cd4UZeN7xCZq4VdxFUYLai
There was a problem hiding this comment.
Pull request overview
Adds a Nix flake override to build btop with CUDA support and wires Devbox to use that custom package, along with a couple of shell/chezmoi tweaks.
Changes:
- Added
flake.nixdefiningbtop-gpu(btopwithcudaSupport = true) and enabling unfree packages. - Updated
devbox.jsonto installbtopfrom the local flake output (path:./#btop-gpu) and adjusted theinstall-chezmoiscript. - Updated shell rc files to source optional machine-local overrides (
~/.zshrc.local,~/.bashrc.local).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
flake.nix |
Introduces a flake-based btop-gpu package override with CUDA enabled. |
devbox.json |
Switches Devbox to consume the flake-provided btop-gpu and modifies the chezmoi install script. |
chezmoi/dot_zshrc |
Sources an optional local zsh rc file for machine-specific overrides. |
bash/.bashrc |
Sources an optional local bash rc file for machine-specific overrides. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| outputs = { self, nixpkgs }: | ||
| let | ||
| system = "x86_64-linux"; | ||
| pkgs = import nixpkgs { | ||
| inherit system; |
There was a problem hiding this comment.
system is hard-coded to x86_64-linux, but this repo/config appears to be used on non-Linux hosts as well (e.g., Homebrew setup in shell rc files). With the current flake outputs, path:./#btop-gpu will fail to evaluate on aarch64-darwin/other systems. Consider generating outputs for multiple systems (e.g., via nixpkgs.lib.genAttrs) and/or using builtins.currentSystem, and make btop-gpu fall back to non-CUDA btop on unsupported systems.
| description = "Custom overrides for Devbox"; | ||
|
|
||
| inputs = { | ||
| nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; |
There was a problem hiding this comment.
This flake introduces an unlocked nixpkgs input, but the PR does not add a flake.lock. Without a lock file, btop-gpu will change over time and may break Devbox installs unpredictably. Add and commit flake.lock so the CUDA-enabled build is reproducible.
| nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | |
| # Pin nixpkgs to a specific revision for reproducible Devbox installs. | |
| nixpkgs.url = "github:nixos/nixpkgs/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
| system = "x86_64-linux"; | ||
| pkgs = import nixpkgs { | ||
| inherit system; | ||
| config.allowUnfree = true; |
There was a problem hiding this comment.
config.allowUnfree = true enables all unfree packages for this flake. If the intent is only to allow CUDA-related derivations, consider narrowing this (e.g., allowUnfreePredicate) or making it conditional so the flake doesn't silently broaden licensing scope for unrelated packages.
| config.allowUnfree = true; | |
| config.allowUnfreePredicate = pkg: true; |
| "atuin@latest", | ||
| "bat@latest", | ||
| "btop@latest", | ||
| "path:./#btop-gpu", |
There was a problem hiding this comment.
devbox.lock in this repo still pins btop@latest, but devbox.json now depends on path:./#btop-gpu. To keep installs reproducible and avoid confusing diffs for other contributors, regenerate/update the lockfile so it reflects the new dependency graph (or remove the stale btop@latest entry if it’s no longer used).
| "path:./#btop-gpu", | |
| "btop@latest", |
| "chezmoi init || true", | ||
| "cp -r $(devbox global path)/chezmoi/* $(chezmoi source-path)", | ||
| "chezmoi apply --no-pager --progress true" |
There was a problem hiding this comment.
chezmoi init || true will ignore any initialization failure (not just the “already initialized” case), which can mask real problems and lead to cp/apply operating on an unexpected source directory. Prefer an idempotent check (e.g., detect an existing chezmoi source dir / repo) and only ignore the specific non-fatal condition, or fail fast with a clearer error.
| # Machine-local overrides (not managed by chezmoi, survives devbox global pull) | ||
| [ -f ~/.zshrc.local ] && source ~/.zshrc.local |
There was a problem hiding this comment.
This PR adds sourcing of ~/.zshrc.local, which is unrelated to the stated PR goal (CUDA-enabled btop via Nix/Devbox). Either update the PR description to cover this additional behavior change, or move it into a separate PR to keep scope focused.
| # Machine-local overrides (survives devbox global pull) | ||
| [ -f ~/.bashrc.local ] && source ~/.bashrc.local |
There was a problem hiding this comment.
This PR adds sourcing of ~/.bashrc.local, which is unrelated to the stated PR goal (CUDA-enabled btop via Nix/Devbox). Either update the PR description to cover this additional behavior change, or move it into a separate PR to keep scope focused.
Summary
This PR adds a Nix flake configuration to enable CUDA support for btop and updates the Devbox configuration to use this custom build instead of the standard package.
Key Changes
flake.nix: New Nix flake that defines a custombtop-gpupackage with CUDA support enabled via thecudaSupportoverridedevbox.json: Changed btop dependency from the standardbtop@latestto the custompath:./#btop-gpupackage defined in the flakeImplementation Details
The flake configuration:
nixos-unstableas the nixpkgs input for up-to-date packagesx86_64-linuxsystembtop-gpupackage as a flake output that can be referenced locallyThis allows developers in the Devbox environment to use btop with GPU monitoring capabilities via CUDA.
https://claude.ai/code/session_01Cd4UZeN7xCZq4VdxFUYLai