Skip to content

Commit

Permalink
add nix build instructions and README section TREX-CoE#173
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepforce committed Dec 10, 2024
1 parent d88358f commit c776eb4
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 1 deletion.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ programming languages.
* [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 @@ -82,6 +83,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

0 comments on commit c776eb4

Please sign in to comment.