Use a system nixpkgs version in a flake?

TLDR below!

I’m working on updating a flake containing a tauri project. There are a lot of C lib dependencies and I’ve had a few problems, the latest of which is this:

[bburdette@HOSS:~/code/zknotes/tauri-zknotes/tauri/src-tauri]$ ./debugrun.sh
dbinit ret: Ok(())
Could not determine the accessibility bus address
src/nv_gbm.c:288: GBM-DRV error (nv_gbm_create_device_native): nv_common_gbm_create_device failed (ret=-1)

DRI driver not from this Mesa build ('24.0.3' vs '24.0.5')
failed to bind extensions
DRI driver not from this Mesa build ('24.0.3' vs '24.0.5')
failed to bind extensions
DRI driver not from this Mesa build ('24.0.3' vs '24.0.5')
failed to bind extensions
Failed to create GBM device for render device: /dev/dri/renderD128: Illegal seek
eglExportDMABUFImageMESA failed

I figure this is probably because my system was built with a different version of unstable than my dev flake, so this DRI thing doesn’t match what’s running in the system. Currently am upgrading my system to see if that fixes it.

TLDR

Is there a way to make a flake use the same nixpkgs version as another flake (say my system flake)? I guess I could manually edit the flake.lock, but that seems hacky.

You can pin an input to a specific git revision or, if the flakes are local-only, you could (ab?)use the nix.registry option to pin the “system” flake inputs like so.

If you are on nixpkgs-unstable, the nixpkgs flake registry entry should automatically point to the Nixpkgs your system was built with: nixos/flake: set up NIX_PATH and system flake registry automatically by lf- · Pull Request #254405 · NixOS/nixpkgs · GitHub

2 Likes