aboutsummaryrefslogtreecommitdiff
path: root/script/jepsen.garage/flake.nix
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-04-18 13:27:22 +0200
committerAlex Auvolat <alex@adnab.me>2023-10-18 12:03:11 +0200
commit17ebb652730f69f53fe7d2b31fbf2db2075b9be7 (patch)
tree9cb701289cb81bfc3eb10da0137bdb56d3942a67 /script/jepsen.garage/flake.nix
parent7011b71fbd782e199417ce9afa44a8c220885b4a (diff)
downloadgarage-17ebb652730f69f53fe7d2b31fbf2db2075b9be7.tar.gz
garage-17ebb652730f69f53fe7d2b31fbf2db2075b9be7.zip
jepsen ssh into containers seem to work ?
Diffstat (limited to 'script/jepsen.garage/flake.nix')
-rw-r--r--script/jepsen.garage/flake.nix45
1 files changed, 41 insertions, 4 deletions
diff --git a/script/jepsen.garage/flake.nix b/script/jepsen.garage/flake.nix
index 76ee8ebf..2afa9ea1 100644
--- a/script/jepsen.garage/flake.nix
+++ b/script/jepsen.garage/flake.nix
@@ -4,19 +4,56 @@
inputs.microvm.url = "github:astro/microvm.nix";
inputs.microvm.inputs.nixpkgs.follows = "nixpkgs";
- outputs = { self, nixpkgs, microvm }: {
- # Example nixosConfigurations entry
- nixosConfigurations.my-microvm = nixpkgs.lib.nixosSystem {
+ outputs = { self, nixpkgs, microvm }:
+ with nixpkgs.lib;
+ let
+ addressMap =
+ {
+ "n1" = { ip = "10.1.0.10"; mac = "02:00:00:00:99:01"; };
+ "n2" = { ip = "10.2.0.10"; mac = "02:00:00:00:99:02"; };
+ "n3" = { ip = "10.3.0.10"; mac = "02:00:00:00:99:03"; };
+ "n4" = { ip = "10.4.0.10"; mac = "02:00:00:00:99:04"; };
+ "n5" = { ip = "10.5.0.10"; mac = "02:00:00:00:99:05"; };
+ };
+ toHostsEntry = name: { ip, ... }: "${ip} ${name}";
+ extraHosts =
+ builtins.concatStringsSep "\n"
+ (attrsets.mapAttrsToList toHostsEntry addressMap);
+
+ nodeConfig = hostName: { ip, mac }: nixosSystem {
system = "x86_64-linux";
modules = [
# Include the microvm module
microvm.nixosModules.microvm
# Add more modules here
{
- networking.hostName = "my-microvm";
+ networking = {
+ inherit hostName extraHosts;
+ };
+
microvm.hypervisor = "cloud-hypervisor";
+ microvm.interfaces = [ {
+ inherit mac;
+ type = "tap";
+ id = "microvm-${hostName}";
+ } ];
+
+ services.openssh = {
+ enable = true;
+ permitRootLogin = "yes";
+ };
+ users.users.root.initialPassword = "root";
+
+ #services.garage = {
+ # enable = true;
+ # logLevel = "debug";
+ # settings.replication_mode = "3";
+ #};
}
];
};
+ in
+ {
+ nixosConfigurations = mapAttrs nodeConfig addressMap;
};
}