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

Feature: Added nix build support #603

Merged
merged 2 commits into from
Mar 26, 2023

Conversation

dev-null-undefined
Copy link
Contributor

Not sure if this will work, but basic example seems to be working.
Can you confirm that this lib has no dependencies and no absolute path.

Closes #598

@ArthurSonzogni
Copy link
Owner

Thanks!


+CC @IvarWithoutBones who made the default.nix in nixpkgs:
NixOS/nixpkgs#181000
If possible, could you tell me if this patch makes sense? If you have some suggestions, they would be very appreciated. I don't know much about nix yet.


@dev-null-undefined, thank you very much!

I don't know nix. For now, I did:

  • install nix
  • enable flakes experimental feature
  • tried nix build . with errors about not defaultPackage defined. I guess I am following the wrong path.

To merge this patch, and do some due dilligence. I would like to verify myself. What step should I follow to depend on ftxui using this config and nix?

@dev-null-undefined
Copy link
Contributor Author

I decided against defining this as default package for you to build this you would have to run nix build .#ftxui

@dev-null-undefined
Copy link
Contributor Author

dev-null-undefined commented Mar 25, 2023

But it could be that I am mistaking in not defining defaultPackage it would probably also make sense to add default.nix for those with out nix experimental features enabled

@dev-null-undefined
Copy link
Contributor Author

It would also make sense to a change the default cmakelist (in the docs) since when building under nix you do not have network connection for purity reasons.

@dev-null-undefined
Copy link
Contributor Author

Thanks!


+CC @IvarWithoutBones who made the default.nix in nixpkgs:
NixOS/nixpkgs#181000
If possible, could you tell me if this patch makes sense? If you have some suggestions, they would be very appreciated. I don't know much about nix yet.


@dev-null-undefined, thank you very much!

I don't know nix. For now, I did:

  • install nix
  • enable flakes experimental feature
  • tried nix build . with errors about not defaultPackage defined. I guess I am following the wrong path.

To merge this patch, and do some due dilligence. I would like to verify myself. What step should I follow to depend on ftxui using this config and nix?

Why didn't you tell me about that nix config in nixpkgs :D i didn't even notice it until now 😂

@ArthurSonzogni
Copy link
Owner

I decided against defining this as default package for you to build this you would have to run nix build .#ftxui

It works! Thanks!


Why didn't you tell me about that nix config in nixpkgs :D i didn't even notice it until now joy

I discovered it after your patch, while trying to learn nix.


Question: Why do we need a devshell?

@dev-null-undefined
Copy link
Contributor Author

Question: Why do we need a devshell?

For testing without having to compile the ftxui your self (nix will use the cached version instead), you can also append all build tools that are used by this for example doxygen cmake gcc and others if needed (graphviz, valgrind, formatter?) and make it into very simple single command dev environment.

And also because of the way that nix builds packages, it will not reuse object files from past compilations which will make it compile the whole project from scratch meaning that even the simplest change can take several minutes to build.

And it also provided a way to specify custom commands such as the compile (alias, function) that I have provided as example.

This is just a draft for that exact reason, this is how I would do it but I do not know this project very well for me to make any of those decisions.

@dev-null-undefined
Copy link
Contributor Author

dev-null-undefined commented Mar 25, 2023

But dev shells are not the main objective over here, those could be added only to the example project if you feel like they are more distraction then they are benefit to this project.

Mainly I would love the CMakelist.txt to change in the docs and maybe even the flake.nix, even if it would be without the dev shells, being merged so that we can get the new version on nix as well. And others can easily use this lib with nix.

@ArthurSonzogni
Copy link
Owner

I am now sufficiently up-to-date with nix to understand the current patch. What do you think?

@ArthurSonzogni ArthurSonzogni marked this pull request as ready for review March 26, 2023 10:16
@ArthurSonzogni ArthurSonzogni merged commit a366c5a into ArthurSonzogni:master Mar 26, 2023
ArthurSonzogni added a commit that referenced this pull request May 19, 2023
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
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.

[Feature requests] Nix build system support
2 participants