WireGuard: Difference between revisions

imported>BarrettTom
imported>Arosl
Client setup: linting of code
Line 285: Line 285:


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
{ config, pkgs, lib, ... }: {
{
   boot.extraModulePackages = [ config.boot.kernelPackages.wireguard ];
  config,
  pkgs,
  lib,
  ...
}: {
   boot.extraModulePackages = [config.boot.kernelPackages.wireguard];
   systemd.network = {
   systemd.network = {
     enable = true;
     enable = true;
Line 299: Line 304:
         wireguardConfig = {
         wireguardConfig = {
           # Don't use a file from the Nix store as these are world readable.
           # Don't use a file from the Nix store as these are world readable.
           PrivateKeyFile = "/run/keys/wireguard-privkey";
           PrivateKeyFile f= "/run/keys/wireguard-privkey";
           ListenPort = 9918;
           ListenPort = 9918;
         };
         };
         wireguardPeers = [{
         wireguardPeers = [
          wireguardPeerConfig = {
          {
            PublicKey = "OhApdFoOYnKesRVpnYRqwk3pdM247j8PPVH5K7aIKX0=";
            wireguardPeerConfig = {
            AllowedIPs = [ "fc00::1/64" "10.100.0.1" ];
              PublicKey = "OhApdFoOYnKesRVpnYRqwk3pdM247j8PPVH5K7aIKX0=";
            Endpoint = "{set this to the server ip}:51820";
              AllowedIPs = ["fc00::1/64" "10.100.0.1"];
              Endpoint = "{set this to the server ip}:51820";
            };
           }
           }
         }];
         ];
       };
       };
     };
     };
Line 321: Line 328:
       ];
       ];
       DHCP = "no";
       DHCP = "no";
       dns = [ "fc00::53" ];
       dns = ["fc00::53"];
       ntp = [ "fc00::123" ];
       ntp = ["fc00::123"];
       gateway = [
       gateway = [
         "fc00::1"
         "fc00::1"
Line 332: Line 339:
     };
     };
   };
   };
};
}
 
</syntaxHighlight>
</syntaxHighlight>