Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a more convinient way of developing rustc on NixOS #129620

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

WaffleLapkin
Copy link
Member

@WaffleLapkin WaffleLapkin commented Aug 26, 2024

This PR adds envrc files which, once symlinked as .envrc will activates a dev shell from src/tools/nix-dev-shell/flake.nix or src/tools/nix-dev-shell/shell.nix.

This is based on

This is something that I plan to use personally, but I thought it might be worth upstreaming :)

r? Noratrieb

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 26, 2024
@rust-log-analyzer

This comment has been minimized.

@Noratrieb
Copy link
Member

i feel like it makes more sense to just have a shell.nix and not a flake, to avoid having to update the lockfile and also because it's just simpler. i don't think we win much from having a flake

@Noratrieb Noratrieb added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 15, 2024
@WaffleLapkin
Copy link
Member Author

@Noratrieb I thought about it for a while, and I think I would still prefer this being a flake, simply for the purposes of stability. I've removed the lock file though (and .gitignored it), as updating it in-repo will just be useless churn.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 20, 2024
@rust-log-analyzer

This comment has been minimized.

@Noratrieb
Copy link
Member

well, flakes are literally unstable :P

i think making everyone update their flake is annoying and I wouldn't want to use it myself - but the .envrc forces me to (I assume direnv has ways to work around this but it's still annoying). I'd be happy with having both a flake.nix and a shell.nix in the subdirectory, and also moving the .envrc there, so people can pick what they prefer (and the .envrc doesn't pollute the top level files even more)

@WaffleLapkin
Copy link
Member Author

I'd be happy with having both a flake.nix and a shell.nix in the subdirectory, and also moving the .envrc there, so people can pick what they prefer (and the .envrc doesn't pollute the top level files even more)

Done. I've added a nix-shell shell and two envrc files for flakes and nix-shell respectively, with the instruction on how to "enable" them.

Copy link
Member

@Noratrieb Noratrieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, we can always patch it later if it's not good

@Noratrieb
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 17, 2024

📌 Commit 002a6b1 has been approved by Noratrieb

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 17, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 17, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#129620 (Provide a more convinient way of developing rustc on NixOS)
 - rust-lang#131805 (rustc_llvm: Fix flattened CLI args)
 - rust-lang#131818 (Enable XRay instrumentation for LoongArch Linux targets)
 - rust-lang#131825 (SolverDelegate add assoc type for Infcx)
 - rust-lang#131833 (Add `must_use` to `CommandExt::exec`)
 - rust-lang#131835 (Do not run test where it cannot run)
 - rust-lang#131844 (Add mailmap entry for kobzol)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7a7c313 into rust-lang:master Oct 17, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Oct 17, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 17, 2024
Rollup merge of rust-lang#129620 - WaffleLapkin:flake, r=Noratrieb

Provide a more convinient way of developing rustc on NixOS

This PR adds envrc files which, once symlinked as  `.envrc` will activates a dev shell from `src/tools/nix-dev-shell/flake.nix` or `src/tools/nix-dev-shell/shell.nix`.

This is based on
- [Current rustc dev guide recommendation for NixOS](https://rustc-dev-guide.rust-lang.org/building/suggested.html?highlight=nix#using-nix-shell)
- https://github.com/oxalica/rust-overlay?tab=readme-ov-file#use-in-devshell-for-nix-develop
- [Nora's `x` nix package](https://github.com/Noratrieb/nixos/tree/26ea68e1a0aadaab313c1b5a8c1033a9770bd138/custom-pkgs/x)
- rust-lang/rustup#2891
- [Direnv: use flake/nix according to availability](https://discourse.nixos.org/t/direnv-use-flake-nix-according-to-availability/29825)

This is something that I plan to use personally, but I thought it might be worth upstreaming :)

r? Noratrieb
@WaffleLapkin WaffleLapkin deleted the flake branch October 17, 2024 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants