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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ single- and/or multi-reference wave functions:
* [Conda](#conda)
* [Spack](#spack)
* [Guix](#guix)
* [Nix](#nix)
* [Debian/Ubuntu](#debianubuntu)
* [Installation from source](#installation-from-source)
* [Minimal requirements (for users):](#minimal-requirements-for-users)
Expand Down Expand Up @@ -100,6 +101,23 @@ It can be installed as follows:
guix package --cores=`getconf _NPROCESSORS_ONLN` --install-from-file=trexio.scm
```

#### Nix

The official releases of TREXIO `>=2.5.` can be used and installed via [Nix](https://nixos.org/).
This repository provides a [Nix Flake](https://nixos.wiki/wiki/Flakes), where [tools/nix/trexio.nix](https://github.com/TREX-CoE/trexio/blob/master/tools/nix/trexio.nix) provides the build specification.
You can inspect the flake or build the package with

```
nix flake show github:TREX-CoE/trexio
nix build github:TREX-CoE/trexio
```

TREXIO is also part of [NixPkgs](https://github.com/NixOS/nixpkgs) and can be used via that channel.

```
nix build nixpkgs#trexio
```

#### Debian/Ubuntu

The official release of TREXIO `2.2.0` is available as a Debian (`.deb`) package thanks to the [Debichem Team](https://wiki.debian.org/Debichem).
Expand Down
60 changes: 60 additions & 0 deletions flake.lock

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

24 changes: 24 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
description = "TREX I/O library";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
let overlay = import ./tools/nix/overlay.nix;
in flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ overlay ];
};
in
{
packages.default = pkgs.trexio;
}
) // {
overlays.default = overlay;
};
}
11 changes: 11 additions & 0 deletions tools/nix/overlay.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
final: prev: {
trexio = final.callPackage ./trexio.nix { };

haskell = prev.haskell // {
packageOverrides = hfinal: hprev: {
trexio-hs = hfinal.callCabal2nix "trexio" ../haskell {
inherit (final) trexio;
};
};
};
}
55 changes: 55 additions & 0 deletions tools/nix/trexio.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{ stdenv
, lib
, fetchFromGitHub
, cmake
, gfortran
, hdf5
, python3
, emacs
, swig
}:

stdenv.mkDerivation rec {
pname = "trexio";
version = "2.5.0";

src = lib.cleanSourceWith {
src = ../../.;
filter = path: type: ! (builtins.elem (builtins.baseNameOf path) [
"haskell"
"docker"
"helpers-debian"
"ocaml"
"rust"
"python"
] && type == "directory" );
};

postPatch = ''
patchShebangs tools/*
'';

nativeBuildInputs = [
cmake
gfortran
emacs
swig
python3
];

buildInputs = [
hdf5
];

outputs = [ "out" "dev" ];

doCheck = true;

meta = with lib; {
description = "File format and library for the storage of quantum chemical wave functions";
homepage = "https://trex-coe.github.io/trexio/";
downloadPage = "https://github.com/TREX-CoE/trexio";
license = licenses.bsd3;
maintainers = [ maintainers.sheepforce ];
};
}
2 changes: 1 addition & 1 deletion version_memo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ To update the version, change:
- ocaml/trexio/trexio.opam
- python/pytrexio/_version.py
- rust/trexio/Cargo.toml

- tools/nix/trexio.nix
Loading