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

Nix shell #245

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
11 changes: 11 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi

watch_file devenv.nix
watch_file devenv.lock
watch_file devenv.yaml
if ! use flake . --impure
then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/target
test-data/*

# Devenv files, to handle the development shell defined by the flake
.devenv/
7 changes: 7 additions & 0 deletions docs/maintainers-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- `pineappl_py`: the crate that builds PineAPPL's Python interface,
documentation at <https://pineappl.readthedocs.io>
- `xtask`: crate for [cargo-xtask] commands
- `.envrc`: [direnv] hooks (mainly enable Nix shell)
- `.gitignore`: PineAPPL's Git ignore rules
- `.readthedocs.yml`: configuration for PineAPPL's [Read-the-Docs] Python
interface documentation
Expand All @@ -46,6 +47,9 @@
- `README.md`: PineAPPL's repository README file. This file also serves as the
homepage of [PineAPPL's website]
- `_config.yml`: configuration file for PineAPPL's Github-pages website
- `flake.lock`: Nix [flake lock file]
- `flake.nix`: Nix [flake], which tracks cross-language dependencies to define a
reproducible build for the PineAPPL packages, and a suitable development shell
Comment on lines +51 to +52
Copy link
Member Author

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).

- `install-capi.sh`: POSIX-compliant shell script to download and install
PineAPPL's pre-built CAPI

Expand All @@ -59,6 +63,9 @@
[lock file]: https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
[license v3]: https://www.gnu.org/licenses/gpl-3.0.en.html
[PineAPPL's website]: https://nnpdf.github.io/pineappl/
[flake]: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-format
[flake lock file]: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#lock-files
[direnv]: https://direnv.net/

## Abbreviations and terminology

Expand Down
291 changes: 291 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading