cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
4.4k stars 330 forks source link

Be able to get something like `config.languages.rust.package` #1549

Open bbigras opened 1 week ago

bbigras commented 1 week ago

I would like to use the same exact rustc and pass it to crate2nix.

I ran nix flake init --template github:cachix/devenv#flake-parts and then added this diff: https://github.com/bbigras/test-devenv-rust/commit/d993ef34c541c1e028673084d62e427e78b3b0b1

Note that I don't really need it set as RUST_PKG, it's just as an example.

error:
       … while calling the 'derivationStrict' builtin
         at /builtin/derivation.nix:1:208:
       … while evaluating derivation 'devenv-shell'
         whose name attribute is located at /nix/store/mnfbbcdbbwh3iif9m9xp8jnsgys65f2g-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'RUST_PKG' of derivation 'devenv-shell'

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: attribute 'languages' missing
       at /nix/store/a9lcxd29b63scdccpnargrzprbfwy96q-source/flake.nix:55:27:
           54|           env = {
           55|             RUST_PKG = "${config.languages.rust.package}";
             |                           ^
           56|           };
domenkozar commented 1 week ago

Any reasons you're using flakes? It makes this confusing. You're using config that comes from flake-parts, you should be using the one from devenv.sh