One missing piece from my last PR, since deploy-rs builds drv files and not flake uri's, the nixConfig set in a flake.nix was ignored. This was pretty painful in Mamba, where it tried to build a lot of stuff that already exists in our S3 cache.
Nix code adapted from the upstream nix daemon module
The basic implementation is to copy the nix code into the binary as a static string so that the nix cli can apply the transformation at runtime without needing to reference the library file living in the deploy-rs directory.
We then search for a flake.nix in the current dir, or reursively upward through each parent dir until it is found, and then we simply call a nix import on the flake.nix, and if it contains a nixConfig attribute, we apply our static nix function to transform the attribute set into a "nix.conf" like string that can then be exported to the NIX_CONFIG variable.
One missing piece from my last PR, since deploy-rs builds
drv
files and not flake uri's, thenixConfig
set in a flake.nix was ignored. This was pretty painful in Mamba, where it tried to build a lot of stuff that already exists in our S3 cache.The implementation is here https://github.com/input-output-hk/deploy-rs/commit/4da8eb9fc3e611adf4bbe8c8df5b1fc604c4f906
Nix code adapted from the upstream nix daemon module
The basic implementation is to copy the nix code into the binary as a static string so that the nix cli can apply the transformation at runtime without needing to reference the library file living in the deploy-rs directory.
We then search for a flake.nix in the current dir, or reursively upward through each parent dir until it is found, and then we simply call a
nix import
on the flake.nix, and if it contains anixConfig
attribute, we apply our static nix function to transform the attribute set into a "nix.conf" like string that can then be exported to theNIX_CONFIG
variable.