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:
- Create a new file under
tests/<test-directory>/default.nix
using the following template:
default.nix 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" ];
}
- Add a new attribute to the bottom-most block in
/tests/default.nix
, e.g.
{
# <snip>
test-name = callPackage ./<test-directory> {};
}
- Make sure the test works by running it on a NixOS machine:
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.
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
(changedevelop
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
.