Skip to content

Commit

Permalink
WIP: added QC flake
Browse files Browse the repository at this point in the history
  • Loading branch information
markuskowa committed Oct 27, 2024
1 parent ef45509 commit bfb9157
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 4 deletions.
9 changes: 5 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,18 @@
};

templates.default = {
path = ./template;
description = "NixOS-QChem template flake with reasonable defaults and editable configuration";
path = ./template/qc;
description = "Quantum Chemistry flake";
welcomeText = ''
Welcome to the NixOS-QChem template flake with optimised packages for computational chemistry!
If you use this flake and/or packages from NixOS-QChem, please cite https://doi.org/10.1002/qua.26872 in your work!
The flake aims for reasonable defaults but can be customised to your needs.
Look for "EDITME" tokens in the flake.nix to find places where you can customise the flake,
e.g. by adding or removing unfree packages, changing CPU architecture specific optimisations,
or constructing a Python environment suiting your requirements.
Note, the "nix" and "calcs" subdirectories: to avoid flooding the Nix storen with large files,
run your calculations in the "calcs" directory and refer to the "flake" in the "nix" directory.
'';
};
};
Expand Down
5 changes: 5 additions & 0 deletions lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@
lib.mapAttrs (pkg: _: callPackage (dir + "/${pkg}/package.nix") {})
(lib.filterAttrs (_: type: type == "directory") (builtins.readDir dir));

buildEnvMpi = symlinkJoin: input:
symlinkJoin {
inherit (input) name;
paths = lib.flatten (map(x: if x ? passthru.mpi then [ x x.passthru.mpi ] else x) input.paths);
};
}
1 change: 1 addition & 0 deletions overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ let

inherit callPackage;
inherit aggressiveStdenv;
inherit qlib;

#
# Upstream overrides
Expand Down
86 changes: 86 additions & 0 deletions template/qc/nix/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
description = "A flake for computational chemistry, based on NixOS-QChem";

inputs = {
qchem.url = "github:nix-qchem/nixos-qchem";
};

nixConfig = {
extra-substituters = [ "https://nix-qchem.cachix.org" ];
extra-trusted-public-keys = [ "nix-qchem.cachix.org-1:ZjRh1PosWRj7qf3eukj4IxjhyXx6ZwJbXvvFk3o3Eos=" ];
allow-import-from-derivation = "true";
};

outputs = { self, qchem }:
let
# EDITME
# Disables unfree packages by default to avoid non-building packages, that
# use unfree ones as dependencies, e.g. Pysisyphus or SHARC.
# Comment out lines to enable the respective package.
filterUnfree = final: prev: {
qchem = prev.qchem // {
turbomole = null;
cefine = null;
cfour = null;
gamess-us = null;
gaussian = null;
gaussview = null;
mrcc = null;
orca = null;
vmd = null;
mesa-qc = null;
mcdth = null;
nixGL = null;
};
};

system = "x86_64-linux";
pkgs = import qchem.inputs.nixpkgs {
inherit system;
overlays = [ qchem.overlays.default filterUnfree ];
config = {
allowUnfree = true;

# EDITME
qchem-config = {
# Set to false if node does not support AVX2
optAVX = true;

# Set to an installation path of Gaussian outside the Nix
# store if you have one. Should have a directory structure like this:
# "${optpath}/gaussian/g16/"
#optpath = "/opt";

# Set and uncomment if you have a MolPro license key.
#licMolpro = "XXXX-XXXX-XXXX-XXXX";

# Set and uncomment if you have a Q-Chem license key file.
#licQChem = "/path/to/qchem.lic";

# Uncomment if you have a server from which non-redistributable
# software can be downloaded
#srcurl = "http://myserver/nix-src/";
};
};
};

filterDrvs = pkgSet:
pkgs.lib.filterAttrs (_: val: pkgs.lib.isDerivation val)
pkgSet;
in
{
# EDITME
# Add packages to the default package as you wish
packages."${system}" = (filterDrvs pkgs.qchem) // {
default = pkgs.qchem.qlib.buildEnvMpi pkgs.symlinkJoin {
name = "quantum-chemistry";
paths = [
# put a list of packages here. e.g.:
#pkgs.qchem.orca
#pkgs.qchem.psi4
#pkgs.gnuplot
];
};
};
};
}

0 comments on commit bfb9157

Please sign in to comment.