From cb6ff9f873b7c7b26d682d52d683ac51e742b7cb Mon Sep 17 00:00:00 2001 From: Niklas Zender Date: Wed, 24 Jun 2026 14:17:55 +0200 Subject: [PATCH] fix(filegen): Stop committing the activation manifest The .config/filegen-manifest.json records absolute /nix/store source paths, which differ per system (e.g. x86_64-linux in CI vs aarch64-darwin locally). Committing it caused `prek --all-files` to report drift on any system other than the one that last generated it, even though the generated file contents are identical. Treat the manifest as local activation state: gitignore it, drop it from tracking, and remove its self-reference from the generated .gitattributes. Co-authored-by: Cursor --- .config/filegen-manifest.json | 33 --------------------------------- .gitattributes | 1 - .gitignore | 4 ++++ nix/modules/filegen.nix | 5 ++++- 4 files changed, 8 insertions(+), 35 deletions(-) delete mode 100644 .config/filegen-manifest.json diff --git a/.config/filegen-manifest.json b/.config/filegen-manifest.json deleted file mode 100644 index 715da839..00000000 --- a/.config/filegen-manifest.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "clobber-by-default": true, - "files": [ - { - "clobber": null, - "deactivate": null, - "ignore-modification": null, - "permissions": "600", - "source": "/nix/store/i9wgm4ljangrsv39rjdqyq9j96hj29zm-pre-commit-config.yaml", - "target": "./.pre-commit-config.yaml", - "type": "copy" - }, - { - "clobber": null, - "deactivate": null, - "ignore-modification": null, - "permissions": "600", - "source": "/nix/store/wyggpw11mkdvbcgbqzs80py8z8khjk9i-check-pre-commit-hooks.yml", - "target": "./.github/workflows/check-pre-commit-hooks.yml", - "type": "copy" - }, - { - "clobber": null, - "deactivate": null, - "ignore-modification": null, - "permissions": "600", - "source": "/nix/store/mv9zlzz043051izx92fxk6ibz6fn21yd-gitattributes", - "target": ".gitattributes", - "type": "copy" - } - ], - "version": 3 -} diff --git a/.gitattributes b/.gitattributes index 5daa663d..f2ec25bc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,3 @@ .pre-commit-config.yaml linguist-generated .github/workflows/check-pre-commit-hooks.yml linguist-generated .gitattributes linguist-generated -.config/filegen-manifest.json linguist-generated diff --git a/.gitignore b/.gitignore index f418f1ae..42e92352 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ .devenv/ + +# filegen activation state — contains machine-specific /nix/store source +# paths, so it must not be committed (would cause cross-system drift). +.config/filegen-manifest.json diff --git a/nix/modules/filegen.nix b/nix/modules/filegen.nix index 0e433399..e1a2b7b1 100644 --- a/nix/modules/filegen.nix +++ b/nix/modules/filegen.nix @@ -169,6 +169,9 @@ in { pkgs, config, ... }: let cfg = config.filegen; + # The manifest records absolute /nix/store source paths, which differ + # per system. It is therefore local activation state (gitignored), not a + # committed artifact — committing it would cause cross-system drift. new-manifest = pkgs.writers.writeJSON "filegen-manifest.json" ( config.filegen.settings // { inherit (smfh) version; } ); @@ -185,7 +188,7 @@ in target = ".gitattributes"; source = pkgs.writeTextFile { name = ".gitattributes"; - text = lib.pipe (cfg.settings.files ++ [ { target = ".config/filegen-manifest.json"; } ]) [ + text = lib.pipe cfg.settings.files [ (map (file: lib.removePrefix "./" file.target)) (map (target: "${target} linguist-generated")) lib.concatLines