Skip to content

make shell.nix better #1858

New issue

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

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

Already on GitHub? # to your account

Merged
merged 5 commits into from
Mar 1, 2024
Merged

make shell.nix better #1858

merged 5 commits into from
Mar 1, 2024

Conversation

Noratrieb
Copy link
Member

This makes it less opinionated.

cc @Nadrieril @fee1-dead i know you're using nixos

@5225225
Copy link
Contributor

5225225 commented Jan 21, 2024

One thing that would be useful is somehow getting x in the PATH and having it work.

Just doing

x_application = pkgs.writeShellApplication {
  name = "x";
  text = ''exec ${./x} "$@"'';
};

and putting that in nativeBuildInputs doesn't work, since the script looks up stuff relative to itself, which is fair enough.

x_application = pkgs.writeShellApplication {
  name = "x";
  text = ''
      cd "${builtins.toString ./.}"
      ./x "$@"
  '';
};

seems to work fine? I don't know nix or bootstrap terribly well so there's probably a cleaner way of doing this.

@Nadrieril
Copy link
Member

Oh RUSTC_ICE is the setting I didn't know I needed x) So many files turning up for no apparent reason!

I agree with most of the changes except that I really liked the RUSTC_BOOTSTRAP_CONFIG example. I wouldn't have known it was an option but now I can share my config.toml between machines. You could perhaps edit the comment instead, to have it say "this is an example config.toml, edit at your convenience"?

@rowan-sl
Copy link

rowan-sl commented Jan 21, 2024

In order to fix #1812 nativeBuildInputs can be changed to include glibc.out glibc.static (in that order)

  • additionally, gcc_multi can be removed Looks like it was used in a different part than the part of the test suite i ran

for some reason glibc.out doesn't create the issues with stdlib.h that glibc did - see this discussion

@Nadrieril
Copy link
Member

I added gcc_multi because it was required to run the mir_opts tests (see this discussion)

@eopb
Copy link
Contributor

eopb commented Jan 22, 2024

I generally agree with this change but I think it would be a shame to get rid of the recommendation of patch-binaries-for-nix = true.

That line is needed for nix shells on non-NixOS systems because bootstrap doesn't have perfect nix detection. I added it in #1774.

If we are going to get rid of the config.toml part of this shell.nix we should probably recommend patch-binaries-for-nix separately on the same page.

@fee1-dead
Copy link
Member

Thanks for the ping. I actually don't use a shell.nix for hacking the rust compiler, since I thought it would be more hassle free if I installed these required things globally.

It might be helpful to showcase that using nix to manage config.toml is possible, but leave a comment saying that if anyone wants to change the behavior to use the ./config.toml instead they can remove it.

@Noratrieb
Copy link
Member Author

In order to fix #1812 nativeBuildInputs can be changed to include glibc.out glibc.static (in that order)

* ~additionally, `gcc_multi` can be removed~ Looks like it was used in a different part than the part of the test suite i ran

for some reason glibc.out doesn't create the issues with stdlib.h that glibc did - see this discussion

lol, i tried this out with awesome results: compiling rustc with this causes a rustc that just hangs (when cargo is invoking it to figure out cfgs etc). no problem, I try to perf top to figure out what's going on.

perf: Segmentation fault

@rowan-sl
Copy link

rowan-sl commented Feb 13, 2024

In order to fix #1812 nativeBuildInputs can be changed to include glibc.out glibc.static (in that order)

* ~additionally, `gcc_multi` can be removed~ Looks like it was used in a different part than the part of the test suite i ran

for some reason glibc.out doesn't create the issues with stdlib.h that glibc did - see this discussion

lol, i tried this out with awesome results: compiling rustc with this causes a rustc that just hangs (when cargo is invoking it to figure out cfgs etc). no problem, I try to perf top to figure out what's going on.

perf: Segmentation fault

it has this problem when using the fix I gave? (or did you mean when gcc_multi is removed?)
(asking because it (at least the test suite) worked for me with this)

@Noratrieb
Copy link
Member Author

ok my perf is always broken somehow (???). I did remove gcc_multi because it's useless now (as mir opt tests now don't require C anymore) but the change I made is adding glibc.out glibc.static to nativeBuildInputs (shouldn't it be buildInputs too?) which makes programs (build scripts, rustc) hang... will debug it further and report back
@Nemo157 mentioned that it works though

@Noratrieb
Copy link
Member Author

moving it to buildInputs fixed the hangs. i do not want to know where they come from. but i will put it there, that seems more appropriate anyways.

@Nadrieril
Copy link
Member

Can you try running ./x.py test tests/mir-opts --bless just to be sure? I remember gcc_multi being required for entirely silly reasons (bless is important because that runs more tests than without it 😅)

@Noratrieb
Copy link
Member Author

saethlin very recently made this not required anymore, being able to bless without a C toolchain.

@Nadrieril
Copy link
Member

Ah I see, amazing then :D

@Noratrieb
Copy link
Member Author

This should be fine to merge now. We could also mention this in x setup when it detects nix (which it already) can, but that's something for later.

@Noratrieb Noratrieb merged commit 9ef55c5 into rust-lang:master Mar 1, 2024
@Noratrieb Noratrieb deleted the nix branch March 1, 2024 20:26
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 11, 2024
Update books

## rust-lang/reference

3 commits in 3417f866932cb1c09c6be0f31d2a02ee01b4b95d..5afb503a4c1ea3c84370f8f4c08a1cddd1cdf6ad
2024-03-06 21:29:54 UTC to 2024-02-28 04:06:45 UTC

- Input format (rust-lang/reference#1459)
- Lexer: say that lifetime-like tokens can't be immediately followed by ' (rust-lang/reference#1479)
- Patterns and enums (rust-lang/reference#1460)

## rust-lang/rust-by-example

2 commits in 57f1e708f5d5850562bc385aaf610e6af14d6ec8..e093099709456e6fd74fecd2505fdf49a2471c10
2024-03-08 23:30:57 UTC to 2024-02-26 21:10:20 UTC

- While-Let Unable to compile code example on page (rust-lang/rust-by-example#1819)
- Update new_types.md wording (rust-lang/rust-by-example#1823)

## rust-lang/rustc-dev-guide

14 commits in 7b0ef5b..8a5d647
2024-03-11 10:37:18 UTC to 2024-02-29 09:46:28 UTC

- update rustc-driver-interacting-with-the-ast.md (rust-lang/rustc-dev-guide#1930)
- Update rustc-driver-getting-diagnostics.md (rust-lang/rustc-dev-guide#1931)
- Document that test names cannot contain dots (rust-lang/rustc-dev-guide#1927)
- Update overview.md (rust-lang/rustc-dev-guide#1898)
- actually need to fix two occurances (rust-lang/rustc-dev-guide#1925)
- fix broken links (rust-lang/rustc-dev-guide#1924)
- next-solver: document caching (rust-lang/rustc-dev-guide#1923)
- Add compiletest docs for FileCheck prefixes and `//@ filecheck-flags:` (rust-lang/rustc-dev-guide#1914)
- Use different type in an example (rust-lang/rustc-dev-guide#1908)
- Update run-make test description (rust-lang/rustc-dev-guide#1920)
- Add some more details on feature gating (rust-lang/rustc-dev-guide#1891)
- make shell.nix better (rust-lang/rustc-dev-guide#1858)
- opaque types in new solver (rust-lang/rustc-dev-guide#1918)
- add implied bounds doc (rust-lang/rustc-dev-guide#1915)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 12, 2024
Update books

## rust-lang/reference

3 commits in 3417f866932cb1c09c6be0f31d2a02ee01b4b95d..5afb503a4c1ea3c84370f8f4c08a1cddd1cdf6ad
2024-03-06 21:29:54 UTC to 2024-02-28 04:06:45 UTC

- Input format (rust-lang/reference#1459)
- Lexer: say that lifetime-like tokens can't be immediately followed by ' (rust-lang/reference#1479)
- Patterns and enums (rust-lang/reference#1460)

## rust-lang/rust-by-example

2 commits in 57f1e708f5d5850562bc385aaf610e6af14d6ec8..e093099709456e6fd74fecd2505fdf49a2471c10
2024-03-08 23:30:57 UTC to 2024-02-26 21:10:20 UTC

- While-Let Unable to compile code example on page (rust-lang/rust-by-example#1819)
- Update new_types.md wording (rust-lang/rust-by-example#1823)

## rust-lang/rustc-dev-guide

14 commits in 7b0ef5b..8a5d647
2024-03-11 10:37:18 UTC to 2024-02-29 09:46:28 UTC

- update rustc-driver-interacting-with-the-ast.md (rust-lang/rustc-dev-guide#1930)
- Update rustc-driver-getting-diagnostics.md (rust-lang/rustc-dev-guide#1931)
- Document that test names cannot contain dots (rust-lang/rustc-dev-guide#1927)
- Update overview.md (rust-lang/rustc-dev-guide#1898)
- actually need to fix two occurances (rust-lang/rustc-dev-guide#1925)
- fix broken links (rust-lang/rustc-dev-guide#1924)
- next-solver: document caching (rust-lang/rustc-dev-guide#1923)
- Add compiletest docs for FileCheck prefixes and `//@ filecheck-flags:` (rust-lang/rustc-dev-guide#1914)
- Use different type in an example (rust-lang/rustc-dev-guide#1908)
- Update run-make test description (rust-lang/rustc-dev-guide#1920)
- Add some more details on feature gating (rust-lang/rustc-dev-guide#1891)
- make shell.nix better (rust-lang/rustc-dev-guide#1858)
- opaque types in new solver (rust-lang/rustc-dev-guide#1918)
- add implied bounds doc (rust-lang/rustc-dev-guide#1915)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 12, 2024
Rollup merge of rust-lang#122339 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/reference

3 commits in 3417f866932cb1c09c6be0f31d2a02ee01b4b95d..5afb503a4c1ea3c84370f8f4c08a1cddd1cdf6ad
2024-03-06 21:29:54 UTC to 2024-02-28 04:06:45 UTC

- Input format (rust-lang/reference#1459)
- Lexer: say that lifetime-like tokens can't be immediately followed by ' (rust-lang/reference#1479)
- Patterns and enums (rust-lang/reference#1460)

## rust-lang/rust-by-example

2 commits in 57f1e708f5d5850562bc385aaf610e6af14d6ec8..e093099709456e6fd74fecd2505fdf49a2471c10
2024-03-08 23:30:57 UTC to 2024-02-26 21:10:20 UTC

- While-Let Unable to compile code example on page (rust-lang/rust-by-example#1819)
- Update new_types.md wording (rust-lang/rust-by-example#1823)

## rust-lang/rustc-dev-guide

14 commits in 7b0ef5b..8a5d647
2024-03-11 10:37:18 UTC to 2024-02-29 09:46:28 UTC

- update rustc-driver-interacting-with-the-ast.md (rust-lang/rustc-dev-guide#1930)
- Update rustc-driver-getting-diagnostics.md (rust-lang/rustc-dev-guide#1931)
- Document that test names cannot contain dots (rust-lang/rustc-dev-guide#1927)
- Update overview.md (rust-lang/rustc-dev-guide#1898)
- actually need to fix two occurances (rust-lang/rustc-dev-guide#1925)
- fix broken links (rust-lang/rustc-dev-guide#1924)
- next-solver: document caching (rust-lang/rustc-dev-guide#1923)
- Add compiletest docs for FileCheck prefixes and `//@ filecheck-flags:` (rust-lang/rustc-dev-guide#1914)
- Use different type in an example (rust-lang/rustc-dev-guide#1908)
- Update run-make test description (rust-lang/rustc-dev-guide#1920)
- Add some more details on feature gating (rust-lang/rustc-dev-guide#1891)
- make shell.nix better (rust-lang/rustc-dev-guide#1858)
- opaque types in new solver (rust-lang/rustc-dev-guide#1918)
- add implied bounds doc (rust-lang/rustc-dev-guide#1915)
Kobzol pushed a commit to Kobzol/rustc-dev-guide that referenced this pull request Jan 3, 2025
* make shell.nix better

* Mention using RUST_BOOTSTRAP_CONFIG

* Move things to `buildInputs` and add `glibc.out glibc.static`

This fixes the nofile-limit.rs UI test.

* short lines for the short line fans

* Fix pkgs
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants