!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

701 Members
Rust158 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
21 Feb 2025
@kraem:ne.bul.aekraem

i'm using crane to build dependencies and the finaly binary in two different steps.
after building the dependencies i'm exporting the closure using nix-store --export $(nix-store --query --requisites ./result).
since that doesn't include the cargo-deps-.drv-files and their outputs, when i run nix-store --import and building the final binary (on a different host for example) the final-binary-step builds them, creating double work.
when trying to export them as well, some of the drv-files aren't present:

export drvs=$(nix-store -q --requisites $(nix-store --query --deriver ./result/) | grep cargo-package)
export outputs$(nix-store -q --outputs $(nix-store -q --requisites $drvs)) # <- this errors since some of the drv-files aren't present in the nix store

how can i make sure to export all the drv-files and their outputs when exporting a nix store closure?

12:58:43
@kraem:ne.bul.aekraem *

i'm using crane to build dependencies and the finaly binary in two different steps.
after building the dependencies i'm exporting the closure using nix-store --export $(nix-store --query --requisites ./result).
since that doesn't include the cargo-deps-.drv-files and their outputs, when i run nix-store --import and building the final binary (on a different host for example) the final-binary-step builds them, creating double work.
when trying to export them as well, some of the drv-files aren't present:

export drvs=$(nix-store -q --requisites $(nix-store --query --deriver ./result/) | grep cargo-package)
export outputs$(nix-store -q --outputs $(nix-store -q --requisites $drvs)) 
# the line above errors since some of the drv-files aren't present in the nix store,
# even though i'm running this after building the final closure successfully

how can i make sure to export all the drv-files and their outputs when exporting a nix store closure?

13:00:04
@kraem:ne.bul.aekraem

oh. actually i might not need the drvs, just their outputs:

deps=$(nix-store -r $(nix-store -q --requisites $(nix-store -q --deriver ./result/) | rg cargo-package))
final_closure=$(nix-store -q --requisites ./result/)
nix-store --export $deps $final_closure > /tmp/deps_and_final_closure
13:35:18

Show newer messages


Back to Room ListRoom Version: 6