Skip to content

Conversation

@RenjiSann
Copy link
Collaborator

I don't really know if this has its place here, but I've been using a nix flake to setup my dev environment for a while, and I thought I might share it here, and maybe integrate it to the main branch if it's coherent.

To make use of these scripts, you'll first need to install the Nix package manager (instructions)

Then, install the direnv package from your preferred distro (instructions)

Once that's done, open a shell and type

$ direnv allow

in the repository. The initial setup will take 1-2min.
After that, your environment will be instantly loaded every time you cd to this folder !

I note that for rust-analyzer to work in VS Code, I installed the direnv extension, which allows VS Code to load the .envrc.

@sylvestre
Copy link
Contributor

I am not a fan of adding specific configuration for each distros :/

@RenjiSann
Copy link
Collaborator Author

I am not a fan of adding specific configuration for each distros :/

Well most of the patch only eases Nix integration (not NixOS), which aside of being a package manager, also serves as a development environment manager with flakes (so exactly that kind of use case)

Also, the patch of build-gnu.sh, while being necessary to NixOS, is not specifically breaking anything for the others.

I understand that is a kind of arbitrary addition to the repository, but I think providing a simple way to build the project for newcomers and potential contributors is in our interest, even if it is something else than nix flakes

@@ -0,0 +1,5 @@
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't like the hardcoded versions here?
is there a better way?
or can we just land flake.nix ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To explain what's going on, direnv naturally supports the use flake directive. However, with the default implementation, we are doomed to re-computing the flake each time we get in/out of the directory.

This line allows to use an implementation that is made by the nix community and which caches the flake's build.

As for the version check, I guess we could remove it. I'm not very familiar with the previous versions, so I don't really know what this will imply.

@github-actions
Copy link

github-actions bot commented Jan 2, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@github-actions
Copy link

github-actions bot commented Feb 2, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)

@github-actions
Copy link

github-actions bot commented Feb 4, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)

@RenjiSann
Copy link
Collaborator Author

Coming back to this PR, I am not sure this is useful if barely anyone makes use of Nix for handling the project environment. However, I feel like having a streamlined, easy to setup, replicatable development environment would greatly improve contributors' lives, and maybe make it more accessible to new comers.

If Nix is not a popular enough solution, I suggest we could setup a devcontainer which may be more widespread among the community.

WDYT @sylvestre ?

@sylvestre sylvestre merged commit 112cb4c into uutils:main Feb 14, 2025
64 of 67 checks passed
@sylvestre
Copy link
Contributor

ok, let's do it

@s1syph0s
Copy link

@RenjiSann I noticed that you used rustup for this flake.. This means that using the flake, I still need to run rustup toolchain install stable manually, right?

@RenjiSann
Copy link
Collaborator Author

That's right, though in a second thought, it may not be ideal 😅

Feel free to open a PR to change that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants