Skip to content

Commit d009ff7

Browse files
committed
feat: add flexible parameter override system with JSON configuration
- Add support for overriding claudeHash, claudeVersion, and claudeUrl via JSON input - Consolidate parameters into single claude-params input file - Maintain single source of truth for defaults in package definition - Support fallback to defaults when no parameters provided - Enable easy local customization without upstream dependency
1 parent bbf9abf commit d009ff7

3 files changed

Lines changed: 36 additions & 7 deletions

File tree

flake.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@
44
inputs = {
55
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
66
flake-utils.url = "github:numtide/flake-utils";
7+
8+
# Claude parameters file - JSON with hash, version, and url
9+
# Override with: inputs.claude-desktop.inputs.claude-params.url = "file+file:///path/to/params.json";
10+
claude-params = {
11+
url = "file+file:///dev/null";
12+
flake = false;
13+
};
714
};
815

916
outputs = {
1017
self,
1118
nixpkgs,
1219
flake-utils,
20+
claude-params,
1321
}:
1422
flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux"] (system: let
1523
pkgs = import nixpkgs {
@@ -19,9 +27,12 @@
1927
in {
2028
packages = rec {
2129
patchy-cnb = pkgs.callPackage ./pkgs/patchy-cnb.nix {};
22-
claude-desktop = pkgs.callPackage ./pkgs/claude-desktop.nix {
30+
claude-desktop = let
31+
paramsContent = builtins.readFile claude-params;
32+
params = if paramsContent == "" then {} else builtins.fromJSON paramsContent;
33+
in pkgs.callPackage ./pkgs/claude-desktop.nix ({
2334
inherit patchy-cnb;
24-
};
35+
} // params);
2536
claude-desktop-with-fhs = pkgs.buildFHSEnv {
2637
name = "claude-desktop";
2738
targetPkgs = pkgs:

pkgs/claude-desktop.nix

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@
1010
makeDesktopItem,
1111
makeWrapper,
1212
patchy-cnb,
13-
perl
13+
perl,
14+
# Allow overriding Claude executable parameters
15+
claudeHash ? "sha256-ISyVjtr9vGzCqq7oaDQd6h9kC7iumyo38z9VjuVCsu4=",
16+
claudeVersion ? "0.12.129",
17+
claudeUrl ? "https://storage.googleapis.com/osprey-downloads-c02f6a0d-347c-492b-a752-3e0651722e97/nest-win-x64/Claude-Setup-x64.exe"
1418
}: let
1519
pname = "claude-desktop";
16-
version = "0.12.129";
20+
version = claudeVersion;
1721
srcExe = fetchurl {
18-
# NOTE: `?v=0.10.0` doesn't actually request a specific version. It's only being used here as a cache buster.
19-
url = "https://storage.googleapis.com/osprey-downloads-c02f6a0d-347c-492b-a752-3e0651722e97/nest-win-x64/Claude-Setup-x64.exe?v=${version}";
20-
hash = "sha256-ISyVjtr9vGzCqq7oaDQd6h9kC7iumyo38z9VjuVCsu4=";
22+
# Use the provided URL and version, or defaults
23+
url = "${claudeUrl}?v=${version}";
24+
# Hash can be overridden via flake input
25+
hash = claudeHash;
2126
};
2227
in
2328
stdenvNoCC.mkDerivation rec {

0 commit comments

Comments
 (0)