diff --git a/CLAUDE.md b/CLAUDE.md index 4c88c4d..c0b7edb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -113,9 +113,7 @@ Follow semantic versioning: - **Minor** (0.x.0): Non-breaking changes adding features - **Major** (x.0.0): Breaking changes -Update the version in **both** locations: -1. `const version` in `cmd/homelab-deploy/main.go` -2. `version` field in `flake.nix` +Update `const version` in `cmd/homelab-deploy/main.go`. The Nix build extracts the version from there automatically. **When to bump**: If any Go code has changed, bump the version before committing. Do this automatically when asked to commit. On feature branches, only bump once per branch (check if version has already been bumped compared to master). diff --git a/flake.nix b/flake.nix index 961d380..f8542bf 100644 --- a/flake.nix +++ b/flake.nix @@ -15,11 +15,16 @@ packages = forAllSystems (system: let pkgs = pkgsFor system; + # Extract version from main.go + version = builtins.head ( + builtins.match ''.*const version = "([^"]+)".*'' + (builtins.readFile ./cmd/homelab-deploy/main.go) + ); in { homelab-deploy = pkgs.buildGoModule { pname = "homelab-deploy"; - version = "0.1.0"; + inherit version; src = ./.; vendorHash = "sha256-JXa+obN62zrrwXlplqojY7dvEunUqDdSTee6N8c5JTg="; subPackages = [ "cmd/homelab-deploy" ];