diff --git a/nix/peer/flake.lock b/nix/peer/flake.lock index da9b6b14..dd973d09 100644 --- a/nix/peer/flake.lock +++ b/nix/peer/flake.lock @@ -112,11 +112,11 @@ "saltine": "saltine" }, "locked": { - "lastModified": 1675594702, - "narHash": "sha256-2kxcZZx31qAwDpbB45bFcIPwO5SWx1VtlHZnmKxZPdc=", + "lastModified": 1675599025, + "narHash": "sha256-ZVOkBwFMpUHyhsdBg8ubv/h43N7phoLqR1lYbgZEeH0=", "owner": "voidlizard", "repo": "hbs2", - "rev": "0a194b2e7c50f79712b11315383c8b510ae41fc8", + "rev": "4ab83f0517c0ab465634a15607d3f0dddeaba3e7", "type": "github" }, "original": { diff --git a/nix/peer/flake.nix b/nix/peer/flake.nix index 5cc4e2f6..df5c7041 100644 --- a/nix/peer/flake.nix +++ b/nix/peer/flake.nix @@ -44,7 +44,9 @@ networking.firewall.enable = false; environment.systemPackages = with pkgs; [ - inputs.hbs2.packages.${pkgs.system}.hbs2-peer + inputs.hbs2.packages.${pkgs.system}.default + screen + tshark ]; # modules = [ diff --git a/nix/peer/usage.sh b/nix/peer/usage.sh new file mode 100644 index 00000000..52bdc1e7 --- /dev/null +++ b/nix/peer/usage.sh @@ -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'