Add automated update script for claude-cli package
Create update.sh script that fetches the latest claude-code version and SHA256 hashes from Homebrew cask and automatically updates the Nix package definition. Features: - Fetches version and all 4 platform SHA256 hashes from Homebrew - Updates default.nix in-place using awk for reliable parsing - Validates extracted data before updating - Supports --dry-run mode to preview changes - Supports --help flag for usage information - Idempotent (safe to run multiple times) Update README to document the automated update method as the recommended approach, with manual update as a fallback option.
This commit is contained in:
@@ -8,9 +8,33 @@ The official `claude-code` package in nixpkgs tries to fetch from npm registry,
|
||||
|
||||
## Updating to a New Version
|
||||
|
||||
When a new version of Claude Code is released, follow these steps:
|
||||
### Automated Update (Recommended)
|
||||
|
||||
### 1. Find the Latest Version and Hashes
|
||||
Run the update script to automatically fetch and update to the latest version:
|
||||
|
||||
```bash
|
||||
cd packages/claude-cli
|
||||
./update.sh
|
||||
```
|
||||
|
||||
The script will:
|
||||
- Fetch the latest version from Homebrew cask
|
||||
- Update version and all SHA256 hashes in default.nix
|
||||
- Show you what changed
|
||||
|
||||
For a dry-run to see what would change:
|
||||
|
||||
```bash
|
||||
./update.sh --dry-run
|
||||
```
|
||||
|
||||
After the script completes, follow the "Test the Build" steps below.
|
||||
|
||||
### Manual Update
|
||||
|
||||
If you prefer to update manually, or if the automated script fails:
|
||||
|
||||
#### 1. Find the Latest Version and Hashes
|
||||
|
||||
Check the Homebrew cask formula for the latest version info:
|
||||
|
||||
@@ -22,7 +46,7 @@ This will show:
|
||||
- The latest `version` number
|
||||
- SHA256 hashes for all platforms (`arm64`, `x86_64`, `x86_64_linux`, `arm64_linux`)
|
||||
|
||||
### 2. Update default.nix
|
||||
#### 2. Update default.nix
|
||||
|
||||
Edit `default.nix` and update:
|
||||
|
||||
@@ -47,7 +71,7 @@ Edit `default.nix` and update:
|
||||
};
|
||||
```
|
||||
|
||||
### 3. Test the Build
|
||||
#### 3. Test the Build
|
||||
|
||||
Before committing, test that the package builds successfully:
|
||||
|
||||
@@ -67,7 +91,7 @@ Clean up the test build:
|
||||
rm result
|
||||
```
|
||||
|
||||
### 4. Deploy
|
||||
#### 4. Deploy
|
||||
|
||||
Commit your changes and rebuild:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user