serokell / deploy-rs

A simple multi-profile Nix-flake deploy tool.
Other
1.33k stars 101 forks source link

fix: let nixConfig be used at build step #206

Closed soupglasses closed 1 year ago

soupglasses commented 1 year ago

Allows nix build to become flake aware. This is important to allow nixConfig based changes to be used at build time. For example when setting extra-substituters through the flake.nix file.

Partially fixes: #204, this PR does not fix the remote builder.

soupglasses commented 1 year ago

That is some good spotting! I had not thought about that.

Handling nixConfig has ended up being much more of a pain than first thought. The only other idea that i have is running something similar to nix eval --json --file flake.nix nixConfig at the data step, using it to populate a nix-config list that could be applied with --option. This should not evaluate anything under the flake inputs and flake outputs for this second pass.

Originally wanted to avoid this as re-implementing how nix build works natively i feel could have small unexpected changes that could be hard to reason and debug, as well as there not being an easy way to handle the per permission toggle that nixConfig follows.

soupglasses commented 1 year ago

Dropping this PR due to my Rust knowledge not being up for the job. If anyone else wants to pick this up, feel free to.