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

Updating shell.nix to flakes #114

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

jaoleal
Copy link

@jaoleal jaoleal commented Feb 29, 2024

Updating the shell.nix to a flake.nix.
See the Issue on gdnative for more understanding.

godot-rust/gdnative#1069 (comment)

Updating the shell.nix to a flake.nix. 
See the Issue on gdnative for more understanding

godot-rust/gdnative#1069 (comment)
Copy link
Member

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

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

Thanks!

I'm not using NixOS myself, so I'll need some other reviewers to check on the content and rationale.


[Nix](https://nixos.org/) is a package manager that employs a pure functional approach to dependency management. Nix packages are built and ran in isolated environments. It makes them more portable, but also harder to author. This tutorial will walk you through the process of setting up a package for Godot, GDNative and Rust with Nix.
Copy link
Member

Choose a reason for hiding this comment

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

Why did you remove the introduction about NixOS? I don't think Flakes should be explained before NixOS itself.

Copy link
Author

Choose a reason for hiding this comment

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

a little redundant since the relation is with flakes feature not nix package manager. But this doesnt change nothing after all

Choose a reason for hiding this comment

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

We shouldn't remove this.

src/recipes/nix-build-system.md Outdated Show resolved Hide resolved
src/recipes/nix-build-system.md Outdated Show resolved Hide resolved
@Bromeon Bromeon added the outdated-api An API change needs to be reflected in the docs label Feb 29, 2024
jaoleal and others added 3 commits February 29, 2024 10:55
@jaoleal
Copy link
Author

jaoleal commented Feb 29, 2024

Actually, im not a experienced user of NixOs, flakes and all that good stuff. I prefer that some other folks check the content too

Co-authored-by: Jose Storopoli <[email protected]>
@jaoleal
Copy link
Author

jaoleal commented Feb 29, 2024

Im commting the nix on non-nixos changes. May the Nixgl is not necessary at all.

jaoleal and others added 3 commits February 29, 2024 17:08
Co-authored-by: Jose Storopoli <[email protected]>
Prevent Errors... gdnative needs to godot be casted as godot
@chitoyuu
Copy link
Contributor

chitoyuu commented Mar 1, 2024

Should the old content really be replaced altogether? On https://nixos.wiki/wiki/Flakes it is stated that (emphasis mine):

Nix flakes is an experimental feature of the Nix package manager.

Not everyone might want to enable experimental features for their package manager, and not everyone is using NixOS (instead of non-NixOS Nix environments, which the previous author apparently was on, and this setup is stated to not support). I'm not sure if the old directions should be removed, if it isn't superseded entirely.

@PgBiel
Copy link

PgBiel commented Mar 1, 2024

Nix flakes are pretty widely used nowadays despite that warning. Even then, I agree we should keep previous instructions regarding default.nix and shell.nix (& co.) if they were already there. I'd be more in favor of having a separate section, e.g. "Using Flakes", with an alternative setup with flakes. They do deserve a mention, but that doesn't mean we have to remove or deprecate prior instructions.
(Disclaimer: I am a NixOS user, but I'm not a full expert on the subject.)

Of note, unless we are doing something with some specific cursed dependencies, it's very likely a Nix setup - with flakes or otherwise - would work on non-NixOS environments as well. At least, it's worth testing in other distros with Nix installed (e.g. Ubuntu, Fedora, OpenSUSE).

EDIT: From a quick look at the PR, it seems that NixGL is used, so I think there might be problems using this particular setup outside of NixOS, but I'm not sure. Worth testing.

@storopoli
Copy link

Even then, I agree we should keep previous instructions regarding default.nix and shell.nix (& co.) if they were already there. I'd be more in favor of having a separate section, e.g. "Using Flakes", with an alternative setup with flakes.

If you have a Flake.nix it is trivial to extend that to a Nix shell.
The problem with Nix shells (outside of a Flake, i.e. default.nix or shell.nix) is that they are not reproducible and are tied to the users config and nixpkgs.

@PgBiel
Copy link

PgBiel commented Mar 1, 2024

If you have a Flake.nix it is trivial to extend that to a Nix shell.

True, you have a point. You can use flake-compat to convert a Flake to the older format.
Then, for the sake of maintainability, it might be better to just present the flake setup, and suggest using flake-compat if flakes are not enabled.

Alternatively, we can have some more high-level instructions indicating which packages you need to use gdnative with Nix, and then use the flake as an example.

@storopoli
Copy link

@jaoleal see if you understand these suggestions.
I think that they are a good way forward for this PR.
I can help you clarify anything if you need.

@jaoleal
Copy link
Author

jaoleal commented Mar 1, 2024

Should the old content really be replaced altogether?

Well, thinking that is good if we have options to use on Nix... I think that we have to maintain those that work and not hold on to outdated technologies or ways to do the same thing. In every context that i used that file, i had problems.

@jaoleal
Copy link
Author

jaoleal commented Mar 1, 2024

Of note, unless we are doing something with some specific cursed dependencies, it's very likely a Nix setup - with flakes or otherwise - would work on non-NixOS environments as well. At least, it's worth testing in other distros with Nix installed (e.g. Ubuntu, Fedora, OpenSUSE).

So, the non-NixOs environment... In that context, as the previous docs say, we could have some problems with opengl and then we could use NixGl that... is something I couldn't get to work on my environment until now, i`ll give another try.
If my speak sound confusing, feel free to ask me again.

@PgBiel
Copy link

PgBiel commented Mar 1, 2024

Of note, unless we are doing something with some specific cursed dependencies, it's very likely a Nix setup - with flakes or otherwise - would work on non-NixOS environments as well. At least, it's worth testing in other distros with Nix installed (e.g. Ubuntu, Fedora, OpenSUSE).

So, the non-NixOs environment... In that context, as the previous docs say, we could have some problems with opengl and then we could use NixGl that... is something I couldn't get to work on my environment until now, i`ll give another try. If my speak sound confusing, feel free to ask me again.

No you're right, I hadn't seen the NixGL dependency. That one can definitely be a pain outside of NixOS I believe. So it's fair enough.

I do, however, wonder if there's some escape hatch which would allow us to not depend on NixGL for non-NixOS users. But that will suffice for the goal of this PR.

@jaoleal
Copy link
Author

jaoleal commented Mar 1, 2024

I do, however, wonder if there's some escape hatch which would allow us to not depend on NixGL for non-NixOS users. But that will suffice for the goal of this PR.

The goal of this PR is that anyone have to spend some time on managing painfull deps. ill be happy to ensure that non-NixOs nix users have they time saved but i cannot absolutely sure that it will work... i only have a NixOs machine.
Anyway, ill try to include NixGl on the party. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
outdated-api An API change needs to be reflected in the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants