Automatically update registry flakes' cache with nix-daemon?

I wanted to see if there’s an existing way to get the nix-daemon to automatically refresh registry flakes to avoid fetching and processing lazily with nix commands.

I’ve bumped my ttl-timeout mostly to speed up nix search but ideally I’d like nix-daemon to just auto update in the background so I never wait at all, and still get frequent updates.

I’m happy to write a separate service or extend the daemon in a PR, but wanted to make sure I wasn’t reinventing the wheel.

I think you are overthinking all this. I use this module https://github.com/gytis-ivaskevicius/flake-utils-plus/blob/f8d6d1f87b6177e3bc674c29f247bdbf897ba274/lib/options.nix#L23 it basically pins your registry entries to whatever is specified in your flake thus you never need to wait to fetch something and nix search/shell/run/etc uses whatever is specified by your flake thus you never need to fetch extra dependencies

1 Like

You could pin nixpkgs with option nix.registry. For example, I ping nixpkgs and etc. like this https://github.com/adomixaszvers/dotfiles-nix/blob/8801719dd72e1c2ead73cad7a50d7fe33f38179d/nixos/nix-registry.nix .

exposing all flake inputs in a predefined place and generating a proper REPL are patterns that should be, like, RFC’ed into Nix proper or something

1 Like