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 development environment via nix #2274

Merged
merged 77 commits into from
Oct 13, 2024

Conversation

niklasmohrin
Copy link
Member

@niklasmohrin niklasmohrin commented Aug 26, 2024

This is a working version for #2191. We use poetry and poetry2nix for Python dependencies. For nodejs, we (for now) just install node through nix and then use npm ci as before. Leftover tasks / questions:

  • CI: we probably want to use https://install.determinate.systems/
  • Windows: we should look up the PowerShell commands needed to install WSL 2 etc. and provide them somewhere so that the first time setup for first semester students goes quicker; edit: Now we just recommend podman instead of WSL
  • we should check the Podman example setup on different platforms
  • should we recommend https://github.com/nix-community/NixOS-WSL instead of using Ubuntu WSL with nix? I think that if people set up their first WSL box, they won't be happy to fight with NixOS later; edit: We decided: No
  • ... (to be continued)

nix/shell.nix Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
deployment/update_production.sh Outdated Show resolved Hide resolved
flake.nix Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Member

@richardebeling richardebeling left a comment

Choose a reason for hiding this comment

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

Code looks good to me. Will re-test setup on Windows and Ubuntu.

deployment/update_production.sh Outdated Show resolved Hide resolved
nix/setup-nix Outdated Show resolved Hide resolved
nix/tricks.md Outdated Show resolved Hide resolved
Copy link
Member

@richardebeling richardebeling left a comment

Choose a reason for hiding this comment

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

  • wsl --install -d Ubuntu-24.04 on a WSL-disabled Windows with the Image uninstalled from the App store (~= fresh installation) downloads the distro image, but doesn't register/initialize it. It has to be run again after reboot

    • It will just register Ubuntu-24.04 after the reboot and immediately run it, so it seems acceptable
    • Proposal: Extend readme comment: (you may have to restart your computer, and you may need to re-run the command afterwards if you get an error)
  • wsl will open a shell in the current directory, which might be mounted ntfs

    • run .#services(-full) will then exit immediately upon (quiet) failure about unix sockets.
    • Proposal: Add a comment to the readme: **Windows users**: Make sure you are not in the mounted NTFS filesystem when cloning.
  • in wsl, on non-mounted directory, compilemessages still errors about msgfmt missing

    • looks to me as if the gettext package is a dependency for the shell, but not for the services
    • @niklasmohrin can you fix this?
  • On laptop (slow, but not as slow as some surface tablets we will see), nix develop took >13min, mostly in tests.

    • same laptop: docker vagrant provisioning passed in 5m21, so almost a 3x slowdown for dev-setup
    • especially python3.10-cherrypy-18.10.0 seems to take very long, some tests seem to be stuck on timers/mutexes/without cpu utilization?
    • Ryzen Octacore still takes 6m49
    • I think this was faster the last time I tested it? Don't know what happened. In any case, disabling the tests would be hugely beneficial, I think. Can we somehow get official cached populated for these pyton dependencies with python3.10?
  • running services with --detached can, on error, just appear as "stuck without message" or even "succeeded" (observed: wsl socket error, gettext error, when retrying: localsettings.py already existed). It's not intuitive to debug. I'm sorry for bringing this up again, but I'd vote to just run nix run .#services-full in foreground.

Apart from these, everything seems to work.

While `poetry2nix` adds an overlay on the Python package set that
disables running the tests, this was not true for the additional poetry
from nixpkgs directly. With the override, this poetry had to be rebuilt
and thus the tests ran again.
This should fix msgfmt errors for `./manage.py compilemessages`.
Copy link
Member

@richardebeling richardebeling left a comment

Choose a reason for hiding this comment

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

Thanks! :)

@niklasmohrin niklasmohrin merged commit 38ce586 into e-valuation:main Oct 13, 2024
11 of 12 checks passed
@niklasmohrin
Copy link
Member Author

Side note: Got a CI failure with seed 1953118040, but couldn't reproduce locally: https://github.com/e-valuation/EvaP/actions/runs/11225675155/job/31204789097?pr=2274

Happened again on main with seed 7524442357. This time though, it also happens locally!

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

Successfully merging this pull request may close these issues.

4 participants