Stream: nix

Topic: Nixifying the vlang dev environment


view this post on Zulip Srid (Dec 08 2023 at 19:10):

https://github.com/vlang/v

I see that vlang is already in nixpkgs. That is, it has been packaged in nixpkgs. But the repository itself doesn't have Nix-based development environment.

Nix is used not only for packaging, but also for development: https://nixos.asia/en/dev

@Swastik Baranwal So I'd propose that we create a flake.nix file in this repo, so that anyone can just git clone it and run nix develop to be dropped in a shell where they build the project, etc. They don't have to install anything on their computer, other than Nix itself.

The README says the Makefile does some magical things, including:

The Tiny C Compiler (tcc) is downloaded for you by make if there is a compatible version for your system, and installed under the V thirdparty directory.

When using Nix, none of this need to happen, for the devShell can include the same Tiny C Compiler which is in fact available in nixpkgs.

view this post on Zulip Swastik Baranwal (Dec 08 2023 at 19:13):

We have our own TCC with our own patches afaik

view this post on Zulip Srid (Dec 08 2023 at 19:13):

Nixifying that patched TCC would be the first step I'd think

view this post on Zulip Swastik Baranwal (Dec 08 2023 at 19:14):

I see

view this post on Zulip Swastik Baranwal (Dec 08 2023 at 19:14):

Let me see how I can do it

view this post on Zulip Srid (Dec 08 2023 at 19:15):

Write a flake.nix in that TCC repo, then if I run nix run in that repo it should run the compiler.

view this post on Zulip Swastik Baranwal (Dec 08 2023 at 19:16):

Are there any guides on how to write a flake.nix

view this post on Zulip Swastik Baranwal (Dec 08 2023 at 19:16):

This is for non-windows https://github.com/vlang/tccbin

view this post on Zulip Srid (Dec 08 2023 at 19:17):

I could use this opportunity to see how useful https://nixos.asia/en/blog/nix-rapid is

Can you try that and let me know if there's anything you don't understand, as far as introduction goes?

view this post on Zulip Swastik Baranwal (Dec 08 2023 at 19:17):

This is for windows https://github.com/vlang/tccbin_win

view this post on Zulip Srid (Dec 08 2023 at 19:17):

Srid said:

I could use this opportunity to see how useful https://nixos.asia/en/blog/nix-rapid is

Can you try that and let me know if there's anything you don't understand, as far as introduction goes?

This post actually introduces flakes

view this post on Zulip Swastik Baranwal (Dec 08 2023 at 19:17):

Srid said:

I could use this opportunity to see how useful https://nixos.asia/en/blog/nix-rapid is

Can you try that and let me know if there's anything you don't understand, as far as introduction goes?

Sure, I will work on it tomorrow. It is mid night here.


Last updated: Nov 15 2024 at 12:33 UTC