refactor: move version to Go source, extract in flake.nix

Define version once in cmd/oubliette/main.go and use builtins.match
in flake.nix to extract it. Add versioning guidelines to CLAUDE.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 16:56:54 +01:00
parent fc872b9c1b
commit 8e8f5366be
3 changed files with 15 additions and 1 deletions

View File

@@ -14,11 +14,13 @@
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
mainGo = builtins.readFile ./cmd/oubliette/main.go;
version = builtins.head (builtins.match ''.*const Version = "([^"]+)".*'' mainGo);
in
{
default = pkgs.buildGoModule {
pname = "oubliette";
version = "0.1.0";
inherit version;
src = ./.;
vendorHash = "sha256-z/E1ZDfedOxI8CSUfcpFGYX0SrdcnAYuu2p0ATozDaA=";
subPackages = [ "cmd/oubliette" ];