secrets: add wireguard peers

This commit is contained in:
Bruno BELANYI 2021-02-17 12:03:41 +00:00
parent 8b069ab820
commit 2523b764bd
9 changed files with 34 additions and 1 deletions

View file

@ -1,4 +1,4 @@
{ lib, ... }: { lib, pkgs, ... }:
with lib; with lib;
let let
@ -42,5 +42,7 @@ else {
ambroisie.hashedPassword = fileContents ./users/ambroisie/password.txt; ambroisie.hashedPassword = fileContents ./users/ambroisie/password.txt;
root.hashedPassword = fileContents ./users/root/password.txt; root.hashedPassword = fileContents ./users/root/password.txt;
}; };
wireguard = pkgs.callPackage ./wireguard { };
}; };
} }

1
secrets/wireguard/.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
/default.nix filter diff

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,30 @@
{ lib, ... }:
let
peerSpec = {
# "Server"
porthos = {
clientNum = 1;
externalIp = "91.121.177.163";
};
# "Clients"
aramis = {
clientNum = 2;
};
richelieu = {
clientNum = 3;
};
};
makePeer = name: attrs: with lib; {
inherit (attrs) clientNum;
publicKey = fileContents (./. + "/${name}/public.key");
privateKey = fileContents (./. + "/${name}/secret.key");
} // optionalAttrs (attrs ? externalIp) {
inherit (attrs) externalIp;
};
in
{
peers = builtins.mapAttrs makePeer peerSpec;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.