Is it possible to configure the directory where Cargo caches the crates it downloads? [duplicate]












1
















This question already has an answer here:




  • How can the location of Cargo's configuration directory be overridden?

    2 answers




In GitLab's CI, I can breakdown my build into stages and each stage can pass artifacts to the next configuration:



cache:
paths:
- target/
- Cargo.lock


However, if the cache directory is outside the project directory or the /cache directory, it becomes hard to pass those artifacts along. I need to tell Cargo a good place to put (and look for) its cached crates.



In my case, I wish to use /cache/cargo/registry/... rather than ~/.cargo/registry/.... or /usr/local/cargo/registry/....



Bonus points for doing that via an environment variable.










share|improve this question















marked as duplicate by Shepmaster rust
Users with the  rust badge can single-handedly close rust questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 1 at 17:37


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.























    1
















    This question already has an answer here:




    • How can the location of Cargo's configuration directory be overridden?

      2 answers




    In GitLab's CI, I can breakdown my build into stages and each stage can pass artifacts to the next configuration:



    cache:
    paths:
    - target/
    - Cargo.lock


    However, if the cache directory is outside the project directory or the /cache directory, it becomes hard to pass those artifacts along. I need to tell Cargo a good place to put (and look for) its cached crates.



    In my case, I wish to use /cache/cargo/registry/... rather than ~/.cargo/registry/.... or /usr/local/cargo/registry/....



    Bonus points for doing that via an environment variable.










    share|improve this question















    marked as duplicate by Shepmaster rust
    Users with the  rust badge can single-handedly close rust questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    Jan 1 at 17:37


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      1












      1








      1









      This question already has an answer here:




      • How can the location of Cargo's configuration directory be overridden?

        2 answers




      In GitLab's CI, I can breakdown my build into stages and each stage can pass artifacts to the next configuration:



      cache:
      paths:
      - target/
      - Cargo.lock


      However, if the cache directory is outside the project directory or the /cache directory, it becomes hard to pass those artifacts along. I need to tell Cargo a good place to put (and look for) its cached crates.



      In my case, I wish to use /cache/cargo/registry/... rather than ~/.cargo/registry/.... or /usr/local/cargo/registry/....



      Bonus points for doing that via an environment variable.










      share|improve this question

















      This question already has an answer here:




      • How can the location of Cargo's configuration directory be overridden?

        2 answers




      In GitLab's CI, I can breakdown my build into stages and each stage can pass artifacts to the next configuration:



      cache:
      paths:
      - target/
      - Cargo.lock


      However, if the cache directory is outside the project directory or the /cache directory, it becomes hard to pass those artifacts along. I need to tell Cargo a good place to put (and look for) its cached crates.



      In my case, I wish to use /cache/cargo/registry/... rather than ~/.cargo/registry/.... or /usr/local/cargo/registry/....



      Bonus points for doing that via an environment variable.





      This question already has an answer here:




      • How can the location of Cargo's configuration directory be overridden?

        2 answers








      caching rust rust-cargo






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 1 at 16:53









      Shepmaster

      157k14316459




      157k14316459










      asked Jan 1 at 15:21









      Chen LevyChen Levy

      8,756155677




      8,756155677




      marked as duplicate by Shepmaster rust
      Users with the  rust badge can single-handedly close rust questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Jan 1 at 17:37


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by Shepmaster rust
      Users with the  rust badge can single-handedly close rust questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Jan 1 at 17:37


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          1














          Found it:



          variables:
          CARGO_HOME: "/cache/cargo/"





          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Found it:



            variables:
            CARGO_HOME: "/cache/cargo/"





            share|improve this answer




























              1














              Found it:



              variables:
              CARGO_HOME: "/cache/cargo/"





              share|improve this answer


























                1












                1








                1







                Found it:



                variables:
                CARGO_HOME: "/cache/cargo/"





                share|improve this answer













                Found it:



                variables:
                CARGO_HOME: "/cache/cargo/"






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 1 at 15:22









                Chen LevyChen Levy

                8,756155677




                8,756155677

















                    Popular posts from this blog

                    MongoDB - Not Authorized To Execute Command

                    How to fix TextFormField cause rebuild widget in Flutter

                    in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith