test nix container for a hbs2-peer

This commit is contained in:
Dmitry Zuikov 2023-02-05 16:31:50 +03:00
parent 4ab83f0517
commit d437d67133
3 changed files with 36 additions and 4 deletions

View File

@ -112,11 +112,11 @@
"saltine": "saltine" "saltine": "saltine"
}, },
"locked": { "locked": {
"lastModified": 1675594702, "lastModified": 1675599025,
"narHash": "sha256-2kxcZZx31qAwDpbB45bFcIPwO5SWx1VtlHZnmKxZPdc=", "narHash": "sha256-ZVOkBwFMpUHyhsdBg8ubv/h43N7phoLqR1lYbgZEeH0=",
"owner": "voidlizard", "owner": "voidlizard",
"repo": "hbs2", "repo": "hbs2",
"rev": "0a194b2e7c50f79712b11315383c8b510ae41fc8", "rev": "4ab83f0517c0ab465634a15607d3f0dddeaba3e7",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -44,7 +44,9 @@
networking.firewall.enable = false; networking.firewall.enable = false;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
inputs.hbs2.packages.${pkgs.system}.hbs2-peer inputs.hbs2.packages.${pkgs.system}.default
screen
tshark
]; ];
# modules = [ # modules = [

30
nix/peer/usage.sh Normal file
View File

@ -0,0 +1,30 @@
## Usage via `nix run`
# Create container defined by ./flake.nix
nix run . -- create
# The arguments after `--` are passed to the `extra-container` binary in PATH,
# while the flake is used for the container definitions.
# Destroy container
nix run . -- destroy
# Start an interactive shell in the container
nix run . -- shell
nix run . # equivalent, because `shell` is used as the default command
# Run a single command in the container.
# The container is destroyed afterwards.
nix run . -- --run c hostname
nix run . -- shell --run c hostname # equivalent
nix run . -- --run bash -c 'curl --http0.9 $ip:50'
## Usage via `nix build`
# 1. Build container
nix build . --out-link /tmp/container
# 2. Run container
extra-container shell /tmp/container
## Inspect container configs
nix eval . --apply 'sys: sys.containers.demo.config.networking.hostName'