Modules, packages and profiles that drive Holo, Holochain, and HoloPortOS
initial implementation for infrastructure 4
Modules, packages and profiles that drive Holo hosting, Holochain, and HoloPortOS.
holo-nixpkgs
provides a set of NixOS tests found under /tests
.
To run all the tests, run the following command from repository root:
nix-build tests
To run a specific test, add -A <test-directory>
, e.g.
nix-build tests -A hpos-holochain-api
NixOS manual has a comprehensive entry on test syntax and available functions.
To add a new test:
tests/<test-directory>/default.nix
using the following template:{ makeTest, lib, hpos, /* additional packages */ ... }:
makeTest {
name = "<test-name>";
machine = {
imports = [ (import "${hpos.logical}/sandbox") ];
documentation.enable = false;
environment.systemPackages = [
# additional packages
];
# Any test-specific NixOS configuration goes here
# e.g. services.<name>.enable = true;
virtualisation.memorySize = 3072;
};
testScript = ''
start_all()
# Your test script goes here
# For syntax, consult NixOS manual on writing tests and other tests in /tests directory, e.g.
# machine.succeed("command-to-test --foo bar")
'';
meta.platforms = [ "x86_64-linux" ];
}
/tests/default.nix
, e.g.{
# <snip>
test-name = callPackage ./<test-directory> {};
}
nix-build tests -A <test-name>
On NixOS, add the following to /etc/nixos/configuration.nix
and rebuild:
{
nix.binaryCaches = [
"https://cache.holo.host/"
];
nix.binaryCachePublicKeys = [
"cache.holo.host-1:lNXIXtJgS9Iuw4Cu6X0HINLu9sTfcjEntnrgwMQIMcE="
"cache.holo.host-2:ZJCkX3AUYZ8soxTLfTb60g+F3MkWD7hkH9y8CgqwhDQ="
];
}
Otherwise, add or adjust the following configuration settings to the Nix config file:
extra-substituters = https://cache.holo.host/
trusted-public-keys = cache.holo.host-1:lNXIXtJgS9Iuw4Cu6X0HINLu9sTfcjEntnrgwMQIMcE= cache.holo.host-2:ZJCkX3AUYZ8soxTLfTb60g+F3MkWD7hkH9y8CgqwhDQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
For single-user installs (nix-shell -p nix-info --run nix-info
prints
multi-user: no
), Nix config file is in ~/.config/nix/nix.conf
.
Otherwise, for multi-user installs, Nix config file is in /etc/nix/nix.conf
and changing it requires root access.
HoloportOS is an operating system based on NixOS that supports running Holochain applications.
develop
vs. master
On your HoloPort or HPOS VM, the following command will alter your subscribed nix channel.
To track develop
:
nix-channel --add https://hydra.holo.host/channel/custom/holo-nixpkgs/develop/holo-nixpkgs
nix-channel --update
(change develop
above to appropriate repo branch... e.g. master
,
staging
)Your HoloPort or HPOS VM should now upgrade to your desired channel at the next auto-upgrade interval.
To begin the upgrade immediately, use the following command:
systemctl start holo-nixpkgs-auto-upgrade.service
If you have Nix installed, checkout the repo, enter nix-shell
and then
hpos-shell
is available to you. Usage:
hpos-shell <attr>
starts HPOS VM against local checkout of given profile.
where <attr>
is one of the attributes of hpos
from overlays. If no value given defaults to qemu
. For example hpos-shell tests
will start HPOS VM with the profile defined as in holo-nixpkgs.hpos.test
.
Very useful for iterative local development.
Download the latest HoloPortOS VirtualBox OVA: https://hydra.holo.host/job/holo-nixpkgs/master/holoportos.targets.virtualbox.x86_64-linux/latest/download-by-type/file/ova
Refer to VirtualBox manual, chapter 1, section 1.15.2.
There's a number of profiles you can activate on your HPOS that alter behavior of your machine. Instructions, list of profiles and their features can be found in profiles/logical/hpos/README.md
.
When you create a PR for your change you will notice that one of the checks will not run automatically. To run nightly tests for you PR do the following:
develop
branchMembrane proof is requested on devNet
when a new agent pub key is created.
If an already existing agent pub key is used the above mentioned step will be skipped. This means the membrane proof might not be correct. To resolve this you can either remove your agent pub key to generate a new one or update the UID causing a new membrane proof to be fetched.