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

add nix build instructions and README section #173

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

sheepforce
Copy link
Contributor

This adds Nix build instructions and a README section on its usage.

sheepforce added a commit to sheepforce/trexio that referenced this pull request Dec 10, 2024
@sheepforce sheepforce force-pushed the nix branch 2 times, most recently from c776eb4 to c068098 Compare December 10, 2024 17:56
@scemama
Copy link
Member

scemama commented Dec 11, 2024

@sheepforce Thanks a lot!
I see that in your nix file you get trexio from git clone, so there is a dependency to emacs and swig. This dependency is not required if you compile trexio from the tar.gz instead of the git cloned repository. Is it possible for you to modify the nix package so that it fetches the tar.gz on the release page instead?

@sheepforce
Copy link
Contributor Author

I see that in your nix file you get trexio from git clone, so there is a dependency to emacs and swig.

You mean in upstream nix here: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/tr/trexio/package.nix#L16
or in the Nix files in this PR here https://github.com/TREX-CoE/trexio/pull/173/files#diff-ff58cc3517012ebf72873a9638bd18d5acb9b8f9d9032c2df4d98c861bf3ebe6R16 ?

For upstream Nix we had a short discussion in the PR about that and decided to use the Git sources directly. It plays nicer with the fetchers and Nix is a source oriented package manager, where we often try to by as close to the source as possible. For example, we also run the libint generator and do not only build the libint release tarballs with generated code. In principle, it would of course be possible to use the release tarballs directly, but it would not really reduce dependencies. Emacs and Swig are in nativeBuildInputs and thus not part of the runtime closure: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/tr/trexio/package.nix#L30

For the second case, i.e. the flake.nix in this PR, Nix is using the code of the git checkout, the flake.nix itself is in (sorry if this sentence is confusing. I couldn't find a better wording 😅) I.e. you instruct Nix to build a specific git reference, Nix will build exactly that specific git reference, using the flake.nix contained in that commit. For example nix build github:trex-coe/trexio/madelung would build the code of the madelung branch (if this PR would already be merged and part of the madelung branch). Thus, in this case, it doesn't really make sense to fetch the release tarball. This is basically the overarching goal of flakes: You include a flake.nix in all of your repos and use git references to build exactly that checkout, e.g. in another repo

{
  inputs.trexio.url = "github:trex-coe/trexio/madelung";
  outputs = { trexio, ... }: # ...
}

@scemama
Copy link
Member

scemama commented Dec 11, 2024

OK, I get it! Thanks for the details.

@scemama scemama requested review from scemama and q-posev December 11, 2024 13:56
Copy link
Member

@q-posev q-posev left a comment

Choose a reason for hiding this comment

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

Thank you @sheepforce ! Looks good to me.

@q-posev q-posev merged commit df0e3a8 into TREX-CoE:master Dec 11, 2024
4 checks passed
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