How to update lock file input to a specific version

Is it possible to request a specific version for a flake input? One of my inputs (emacs-overlay) is locked to a very recent commit which is problematic, and I’d like to lock it to a known good commit. It seems that I could manually update the flake.lock file, but this is a bit painful and error-prone.

Yup, you can use github:owner/repo/commit or github:owner/repo?rev=commit

You can also pin to a branch or a tag. See examples

1 Like

thanks, @rehno. Just so I understand, you are recommending I specify the revision in the flake input instead of trying to manage the pinning only via the lock file?

The lockfiles pin will be overwritten on the next nix flake update, thats why a pin through the flake.nix inputs section is usually prefered. especially as the flake.lock also holds additional metadata like the date of the commit or its content sha, which you would need to keep correct on your own as well.

1 Like

Thanks @NobbZ. FWIW, I just tried this and nix flake lock --update-input emacs-overlay works as I wanted, downgrading the input to the version I specified and locking it.