-
Notifications
You must be signed in to change notification settings - Fork 3
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
Nix shell #245
base: master
Are you sure you want to change the base?
Nix shell #245
Conversation
I'm a bit worried about adding more files to the top directory, but nevermind that. Before merging I'd like to test Nix myself. Are the build failures in commit 04fc920 unrelated? I've seen them before locally, but I don't know exactly what happens. |
I believe it should be because you updated something in The workflows should be completely unaffected by these files. Btw, Nix is an optimal tool for workflows as well, because we can reproduce perfectly what is happening in the remote machine (but I never wrote yet my first Nix workflow, and the current ones are working, so it is not at all a priority). |
Ok, I just rebased on Nix is coming as a whole Linux distribution (NixOS, managing even your system configurations), but it is a build tool in the first place (just Nix) and a distribution of packages built with it (Nixpkgs), that guarantee reproducibility. On top of Nix, I'm also using devenv, that is kind of a library to write Nix development shells + a CLI to manage them https://devenv.sh/ (and in particular I'm using it with flakes, https://devenv.sh/guides/using-with-flakes/, that is the new "flavor" of Nix, which adoption is debated, and surveys pointed slightly more than half the people answering using flakes). |
I'm stupid, and I forgot to switch to |
Ok, solving the aftermath #247 has been effectively rebased and merged in Sorry for the mess. |
@cschwan I managed to have a consistent configuration, where the Python package is working as well. I thought I would have had to patch the LHAPDF distribution, but people contributing to Nix are making a great job at providing valuable and updated packages (they were up-to-date even with unmerged patches, so the Nix package was less broken than the official one). I'm quite convinced this could be useful, since managing a multilanguage environment could be non-trivial. And it is also handling locally and consistently the LHAPDF dependency. Instructions to testYou don't need a whole NixOS to test, Nix is enough. It is available as a package on major distributions: Once installed, test it with To test, I would use: nix develop . --impure Most likely[*], you should add (If you use [*]: i.e. unless you or your distribution already configured to use experimental features |
I wanted to add However, it is definitely possible, since the Python environment generated is working that way. But I'm not handling it manually, so I'm trying to understand how it works in The drawback is that, for the time being, the installed |
No, especially now that we document what all the files do in this repositories. Can you document them in https://github.com/NNPDF/pineappl/blob/master/docs/maintainers-guide.md? It will take some time to review this, but after Turkey I'm confident I can. |
I fixed the
I didn't notice it, it's definitely a good idea. It takes me nothing to write a few lines to document them (I will link the relevant references to avoid verbose descriptions).
That would be great! There is no special hurry for this, I made it in the first place because it was useful for myself. But now that is there, I believe it could be useful even for other people, so it would be a (tiny) pity to forget it forever. |
- `flake.nix`: Nix [flake], which tracks cross-language dependencies to define a | ||
reproducible build for the PineAPPL packages, and a suitable development shell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description is slightly beyond what is currently provided, since I have no output.packages
in the flake (yet).
However, that is perfectly possible, and I'm also going to do it (sooner or later).
In principle, we could use Nix to build packages even in the CI (those for which we're distributing binaries). But dynamically-linked binaries won't be portable outside Nix (not sure if it's possible to make them such).
In any case, even spelling out the build is already a source distribution on its own, that will make it possible to compile PineAPPL with just:
nix build github:NNPDF/pineappl
and no extra requirement (not regarding build tools installation, nor dependencies).
For my future self:
|
Any chance for this PR to be merged? |
@cschwan I wanted to rebase this branch on ❯ git push --force-with-lease
Enumerating objects: 41, done.
Counting objects: 100% (41/41), done.
Delta compression using up to 20 threads
Compressing objects: 100% (26/26), done.
Writing objects: 100% (37/37), 8.03 KiB | 2.68 MiB/s, done.
Total 37 (delta 29), reused 15 (delta 10), pack-reused 0
remote: Resolving deltas: 100% (29/29), completed with 3 local objects.
remote: error: GH013: Repository rule violations found for refs/heads/nix.
remote: Review all repository rules at http://github.com/NNPDF/pineappl/rules?ref=refs%2Fheads%2Fnix
remote:
remote: - Cannot force-push to this branch
remote:
To github.com:NNPDF/pineappl.git
! [remote rejected] nix -> nix (push declined due to repository rule violations)
error: failed to push some refs to 'github.com:NNPDF/pineappl.git' It is weird, because I rebased even one week ago, and it said nothing... |
I temporarily bypassed the limitation, but it was happening because of a new ruleset |
94bf89a
to
7b64d94
Compare
If taken directly from the environment, it will lose all the additions made by the Nix packages Accessing the value from the configuration will always improve self-consistency
Just run a shell export command right before entering the shell
If not specifically needed, the default should be good enough
These are just a bunch of decoupled files to allow me to have a nix shell defined for PineAPPL.
My current goal with Nix is to have a fully reproducible environment for development (and it is fully reproducible because I'm committing it), and at the same time one I can tune for different needs (e.g. it is an easy way to test multiple Python versions, and maybe even Rust ones).
Eventually, I might even propose to package PineAPPL for Nix, within the same files. But this is not what I'm currently proposing, since the current files only support the dev shell.
FYI:
flake.nix
is the main file, describing the Nix properties (it is a way to declare some attributes, including the shell)flake.lock
is the corresponding lock file.envrc
is there to automatically enable the environment shell.gitignore
is updated to avoid storing the local environment