Add e2e script to the repo, Dockerfile, and a Nix flake with a NixOS module
- scripts/e2e.sh (+ scripts/e2e/*.ts): the two-node end-to-end test, now self-contained and cleaning up after itself; `make e2e`, part of `make check` - Dockerfile/.dockerignore: static Go build in a non-root alpine image, data in /data, defaults to region u1j; `make docker` - flake.nix, nix/: package (buildGoModule), dev shell, NixOS module services.allmende (hardened systemd unit that waits for `allmende-admin init`), and a NixOS VM test run by `nix flake check` - README: running a node with Docker and NixOS Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
{
|
||||
description = "Allmende: a free, distributed marketplace for homes";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
let
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
forAll = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
|
||||
version = "0.1.0-${self.shortRev or self.dirtyShortRev or "dev"}";
|
||||
in
|
||||
{
|
||||
# nix build -> ./result/bin/allmende
|
||||
# nix run . -- run --region u1j
|
||||
packages = forAll (pkgs: rec {
|
||||
allmende = pkgs.callPackage ./nix/package.nix { inherit version; };
|
||||
default = allmende;
|
||||
});
|
||||
|
||||
# nix develop: everything `make check` needs.
|
||||
devShells = forAll (pkgs: {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
go
|
||||
gopls
|
||||
nodejs
|
||||
gnumake
|
||||
curl
|
||||
python3
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
# imports = [ allmende.nixosModules.default ]; services.allmende.enable = true;
|
||||
nixosModules.default = import ./nix/module.nix self;
|
||||
|
||||
# nix flake check: builds the package and boots a VM running the module.
|
||||
checks.x86_64-linux = {
|
||||
package = self.packages.x86_64-linux.default;
|
||||
vm = import ./nix/test.nix {
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
module = self.nixosModules.default;
|
||||
};
|
||||
};
|
||||
|
||||
formatter = forAll (pkgs: pkgs.nixfmt);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user