A collection of WIP Nix Package Manager build expressions for opencog packages.
cd <package-name> # e.g. cogutil
nix-shell # --run 'zsh'
This will build the expression dependencies, place you in that shell and run code under shellHook
.
To update all packages run nix-shell auto-update.nix
from packages
folder. To update only some, open auto-update.nix
and pass package names as parameters to update_opencog_repos
, then run the above.
This will fetch the latest master revision and its sha256 and update packages/*.nix
files. You can then try to build them.
Open packages/<package>.nix
and update rev
with a commit hash, as well as sha256
. If sha256
is not changed, nix will use the old build version if any without throwing an error.
To get the sha256
quickly, I change one numerical value from sha256
, start the build and copy-paste the expected sha256
output from the error message.
To add a package, take a similar structure to one of the existing packages.
Read the README.md
of the package and add all required dependencies to buildInputs
.
Search for dependencies package attribute names on NixOS packages
There might be more dependencies, you will know if the build fails.
Patching the source will most likely be required for overridings of GUILE_LOAD_PATH
and PYTHONPATH
in CmakeLists.txt
files, any hardcoded path like /usr/local/share/...
, hardcoded binary names that differ on nixos
or some other exceptions. See helpers/common-patch.nix
.
Calling nix-shell
builds the expression dependencies and places you in a shell that has them.
If nix-shell <package>/default.nix
fails you can debug the failing package directly with its expression, located in packages/<package>.nix
, something like:
rm -rf ./source # cleanup previous build
nix-shell ../path/to/packages/<package>.nix --pure # --pure is almost pure, still loads .bashrc and stuff
If the patchPhase requires writting to $out
which is read-only and possible only with nixbld
instead of nix-shell, a custom $out
and $prefix
can be set: export out=$(mktemp -d); export prefix=$out; genericBuild
After changing the
Once inside the shell:
source
directory will be created, with build
directory inside.genericBuild
. Call type genericBuild
to see its code.cd
back to the appropriate folder like build
or other folders might be created nested..cxxtest
or .cpp
tests and call checkPhase
from build
folder.source/build/tests
and call ctest --verbose # -V
.ctest --tests-regex # -R
logger().set_level(Logger::DEBUG); logger().set_print_to_stdout_flag(true);
to target code.GNU Affero General Public License v3.0