diff --git a/flake.nix b/flake.nix index 19302ad5..bd6a3b3e 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,7 @@ outputs = { self, nixpkgs, haskell-flake-utils, ... }@inputs: packageNames = [ "hbs2" + "hbs2-peer" "hbs2-core" "hbs2-storage-simple" "hbs2-tests" diff --git a/hbs2-core/lib/HBS2/Net/Proto/Peer.hs b/hbs2-core/lib/HBS2/Net/Proto/Peer.hs index b990d919..a301eeb9 100644 --- a/hbs2-core/lib/HBS2/Net/Proto/Peer.hs +++ b/hbs2-core/lib/HBS2/Net/Proto/Peer.hs @@ -51,7 +51,6 @@ newtype instance SessionKey e (PeerHandshake e) = type instance SessionData e (PeerHandshake e) = PingNonce - sendPing :: forall e m . ( MonadIO m , Request e (PeerHandshake e) m , Sessions e (PeerHandshake e) m diff --git a/nix/peer/flake.lock b/nix/peer/flake.lock new file mode 100644 index 00000000..da9b6b14 --- /dev/null +++ b/nix/peer/flake.lock @@ -0,0 +1,209 @@ +{ + "nodes": { + "extra-container": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1673201375, + "narHash": "sha256-qlDIl1j6m3hrwbp993/1ncxyKfFRjt32zc3IHq6CeIk=", + "owner": "erikarvstedt", + "repo": "extra-container", + "rev": "8448f0d65bb436550c2a6eece0dd1b43c8b33462", + "type": "github" + }, + "original": { + "owner": "erikarvstedt", + "repo": "extra-container", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "haskell-flake-utils": { + "inputs": { + "flake-utils": "flake-utils_2" + }, + "locked": { + "lastModified": 1672412555, + "narHash": "sha256-Kaa8F7nQFR3KuS6Y9WRUxeJeZlp6CCubyrRfmiEsW4k=", + "owner": "ivanovs-4", + "repo": "haskell-flake-utils", + "rev": "896219e5bde6efac72198550454e9dd9b5ed9ac9", + "type": "github" + }, + "original": { + "owner": "ivanovs-4", + "ref": "master", + "repo": "haskell-flake-utils", + "type": "github" + } + }, + "haskell-flake-utils_2": { + "inputs": { + "flake-utils": "flake-utils_3" + }, + "locked": { + "lastModified": 1672412555, + "narHash": "sha256-Kaa8F7nQFR3KuS6Y9WRUxeJeZlp6CCubyrRfmiEsW4k=", + "owner": "ivanovs-4", + "repo": "haskell-flake-utils", + "rev": "896219e5bde6efac72198550454e9dd9b5ed9ac9", + "type": "github" + }, + "original": { + "owner": "ivanovs-4", + "repo": "haskell-flake-utils", + "rev": "896219e5bde6efac72198550454e9dd9b5ed9ac9", + "type": "github" + } + }, + "hbs2": { + "inputs": { + "haskell-flake-utils": "haskell-flake-utils", + "hspup": "hspup", + "nixpkgs": [ + "nixpkgs" + ], + "saltine": "saltine" + }, + "locked": { + "lastModified": 1675594702, + "narHash": "sha256-2kxcZZx31qAwDpbB45bFcIPwO5SWx1VtlHZnmKxZPdc=", + "owner": "voidlizard", + "repo": "hbs2", + "rev": "0a194b2e7c50f79712b11315383c8b510ae41fc8", + "type": "github" + }, + "original": { + "owner": "voidlizard", + "repo": "hbs2", + "type": "github" + } + }, + "hspup": { + "inputs": { + "haskell-flake-utils": "haskell-flake-utils_2", + "nixpkgs": [ + "hbs2", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1672641093, + "narHash": "sha256-v0Uj3gkDWPdnXZUKpJGD7RxIOncTexhN0csIop36yug=", + "owner": "voidlizard", + "repo": "hspup", + "rev": "031d27dea1505fd68cd603da7e72eb5eefd348fd", + "type": "github" + }, + "original": { + "owner": "voidlizard", + "repo": "hspup", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1669833724, + "narHash": "sha256-/HEZNyGbnQecrgJnfE8d0WC5c1xuPSD2LUpB6YXlg4c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4d2b37a84fad1091b9de401eb450aae66f1a741e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1675512093, + "narHash": "sha256-u1CY4feK14B57E6T+0Bhkuoj8dpBxCPrWO+SP87UVP8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "8e8240194eda25b61449f29bb5131e02b28a5486", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "extra-container": "extra-container", + "hbs2": "hbs2", + "nixpkgs": "nixpkgs_2" + } + }, + "saltine": { + "flake": false, + "locked": { + "lastModified": 1651348885, + "narHash": "sha256-0guvfkdOrofElDildQWE8QDwh+T/u2WY3HVYmOu4g3w=", + "owner": "tel", + "repo": "saltine", + "rev": "3d3a54cf46f78b71b4b55653482fb6f4cee6b77d", + "type": "github" + }, + "original": { + "owner": "tel", + "repo": "saltine", + "rev": "3d3a54cf46f78b71b4b55653482fb6f4cee6b77d", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix/peer/flake.nix b/nix/peer/flake.nix new file mode 100644 index 00000000..5cc4e2f6 --- /dev/null +++ b/nix/peer/flake.nix @@ -0,0 +1,60 @@ +# See how this flake is used in ./usage.sh +{ + description = "hbs2-container"; + + inputs = { + extra-container.url = "github:erikarvstedt/extra-container"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + hbs2.url = "github:voidlizard/hbs2"; + hbs2.inputs.nixpkgs.follows = "nixpkgs"; + }; + + + outputs = { extra-container, ... }@inputs: + extra-container.inputs.flake-utils.lib.eachSystem extra-container.lib.supportedSystems (system: { + packages.default = extra-container.lib.buildContainers { + # The system of the container host + inherit system; + + # Only set this if the `system.stateVersion` of your container + # host is < 22.05 + # legacyInstallDirs = true; + + # Optional: Set nixpkgs. + # If unset, the nixpkgs input of extra-container flake is used + nixpkgs = inputs.nixpkgs; + + # Set this to disable `nix run` support + # addRunner = false; + + config = { + containers.hbs2-test = { + extra.addressPrefix = "10.250.0"; + + config = { pkgs, ... }: { + systemd.services.hello = { + wantedBy = [ "multi-user.target" ]; + script = '' + while true; do + echo hello | ${pkgs.netcat}/bin/nc -lN 50 + done + ''; + }; + + networking.firewall.enable = false; + + environment.systemPackages = with pkgs; [ + inputs.hbs2.packages.${pkgs.system}.hbs2-peer + ]; + + # modules = [ + # inputs.hbs2.packages.${pkgs.system}.default + # ]; + + + }; + }; + }; + }; + }); +}