# How do y'all develop Rust projects?

**URL:** <https://forum.systemcrafters.net/t/how-do-yall-develop-rust-projects/780>\
**Category:** Guix\
**Created:** [June 11, 2024, 3:31pm UTC](https://forum.systemcrafters.net/t/how-do-yall-develop-rust-projects/780 "2024-06-11T15:31:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PuercoPop](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/puercopop/32/585_2.png) [@PuercoPop](https://forum.systemcrafters.net/u/PuercoPop)\
**Post date:** [June 11, 2024, 3:31pm UTC](https://forum.systemcrafters.net/t/how-do-yall-develop-rust-projects/780/1 "2024-06-11T15:31:45Z")

</div>

Hi, I recently switch to guix from nix. I’m looking for something equivalent to nix shell. My understanding is that guix shell -D is what I’m looking for. However guix shell -D only loads the dependencies of the crate itself, things like rust-analyzer, clippy, cargo-next, etc are things I need on my development shell that are not part of the package. How do you handle those scenarios?

I’m curious what is the existing practice for Rust projects. Do y’all use a manifest to install cargo, rust, rust-analyzer and keep rust dependencies outside of guix?

Another limitation of guix shell -D is that it doesn’t allow one to set environment variables, which nix’s mkShell does.

Do you have any links to a rust project?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![mrok](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@mrok](https://forum.systemcrafters.net/u/mrok)\
**Post date:** [June 11, 2024, 7:56pm UTC](https://forum.systemcrafters.net/t/how-do-yall-develop-rust-projects/780/2 "2024-06-11T19:56:59Z")

</div>

I’m not a rust dev, just came here to say a couple of things.

1. ` guix shell -D` indeed only adds dependencies of the specified package. If you need something else, you need to specify it additionally in the manifest file or simply on the command line:

```auto
guix shell -D alacritty rust-cargo rust-analyzer rust-clippy

```

1. In order to specify environment variables, guile’s [setenv](https://www.gnu.org/software/guile/manual/html_node/Runtime-Environment.html#index-setenv) should be suitable. Something like this:

```Scheme
(use-modules ((gnu packages terminals)
              #:select (alacritty))
             ((gnu packages rust)
              #:select (rust-analyzer))
             ((gnu packages crates-io)
              #:select (rust-clippy-0.0))
             ((gnu packages rust-apps)
              #:select (rust-cargo)))

(setenv "MY_VARIABLE" "test!")

(concatenate-manifests
 (list (package->development-manifest alacritty)
       (packages->manifest (list rust-cargo
                                 rust-analyzer
                                 rust-clippy-0.0))))

```

Although I’ve tested this and it seems to me that for the shell to work correctly, it’s better to run it with the `--rebuild-cache` flag. Here’s what the [manual](https://guix.gnu.org/manual/devel/en/html_node/Invoking-guix-shell.html) says about that:

> The --rebuild-cache forces the cached environment to be refreshed. This is useful when using --file or --manifest and the `guix.scm` or `manifest.scm` file has external dependencies, or if its behavior depends, say, on environment variables.

Perhaps there are other ways to specify environment variables that don’t require additional flags, I don’t know.

---

<div class="post-metadata">

**Author:** ![mrok](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@mrok](https://forum.systemcrafters.net/u/mrok)\
**Post date:** [June 11, 2024, 8:01pm UTC](https://forum.systemcrafters.net/t/how-do-yall-develop-rust-projects/780/3 "2024-06-11T20:01:33Z")

</div>

Also, I recently found [this thing](https://git.sr.ht/~look/cargo2guix). Maybe this will be useful to you.

---

<div class="post-metadata">

**Author:** ![PuercoPop](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/puercopop/32/585_2.png) [@PuercoPop](https://forum.systemcrafters.net/u/PuercoPop)\
**Post date:** [June 12, 2024, 3:45am UTC](https://forum.systemcrafters.net/t/how-do-yall-develop-rust-projects/780/4 "2024-06-12T03:45:31Z")

</div>

Thanks, I didn’t know about `concatenate-manifests` or `package->development-manifest`. That would let me split the package and the ‘development shell’ into two separate files, guix.scm and maniest.scm. Similar to the nix convention of default.nix an shell.nix.

Thanks!
