From 645827b7be801fd1143df54efe269c979890643d Mon Sep 17 00:00:00 2001 From: leon Date: Sat, 24 Sep 2022 02:00:42 +0100 Subject: [PATCH 1/3] update --- hosts/leoncloud/default.nix | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/hosts/leoncloud/default.nix b/hosts/leoncloud/default.nix index a12f9ce1..049f823f 100644 --- a/hosts/leoncloud/default.nix +++ b/hosts/leoncloud/default.nix @@ -10,7 +10,7 @@ let in { microvm = { - mem = 1024; + mem = 4024; writableStoreOverlay = "/nix/.rw-store"; @@ -30,7 +30,7 @@ in }; networking = { - hostName = "leoncloud"; + hostName = "docker-server"; firewall.enable = true; }; @@ -49,7 +49,7 @@ in users.users.leoncloud = { isNormalUser = true; - extraGroups = [ "wheel" ]; + extraGroups = [ "wheel" "docker" ]; createHome = true; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM2zpmWA3Z9zshWaU8k1SWyJnbAyasOu9pV+9BvTY0XE leon@¯\_(ツ)_/¯" @@ -59,7 +59,7 @@ in networking.firewall = { allowedTCPPorts = [ 80 443 22 ]; - allowedUDPPorts = [ ]; + allowedUDPPorts = [ 51820 ]; }; #------------------DOCKER---------------------------- @@ -67,5 +67,25 @@ in #------------------DOCKER---------------------------- + +#------------------Wireguard-client---------------------------- +# Enable WireGuard + networking.wireguard.interfaces = { + wg0 = { + ips = [ "10.10.11.4/24" ]; + listenPort = 51820; + privateKeyFile = "/etc/nixos/wireguard-keys/private-key"; + + peers = [ + { + publicKey = "w3qegSSuqFTFrGk4XJaWBSwGDOiqbnnAIR9MzwjYVA8="; + allowedIPs = [ "10.10.11.0" ]; + endpoint = "81.201.149.152:18800"; + persistentKeepalive = 25; + } + ]; + }; + }; +#------------------End---------------------------- system.stateVersion = "22.05"; } From a89a8e0370a1cfdd2cc09a98535c662468878728 Mon Sep 17 00:00:00 2001 From: leon Date: Sat, 24 Sep 2022 02:02:37 +0100 Subject: [PATCH 2/3] add client --- hosts/leon/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hosts/leon/default.nix b/hosts/leon/default.nix index e63dffd0..1d0dd8fd 100644 --- a/hosts/leon/default.nix +++ b/hosts/leon/default.nix @@ -120,7 +120,12 @@ peers = [ # ------------------leon-------------------------. - { + { + #leoncloud-vm + publicKey = "YhcC/xMYxh7GIyndbgBZ05oE3aTJXK4T7JgZwUDyd08="; + allowedIPs = [ "10.10.11.4" ]; + } + { #My_laptop publicKey = "okZuIQ90J49IJ3s+/dZyLthvo4rR2kclmTL54Ykglio="; allowedIPs = [ "10.10.11.2" ]; From 51db5ae34e1bdf36c199932ff9769bb9b6b952eb Mon Sep 17 00:00:00 2001 From: leon Date: Sat, 24 Sep 2022 02:42:09 +0100 Subject: [PATCH 3/3] add docker-compose --- hosts/leoncloud/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/leoncloud/default.nix b/hosts/leoncloud/default.nix index 049f823f..9dc4906a 100644 --- a/hosts/leoncloud/default.nix +++ b/hosts/leoncloud/default.nix @@ -44,7 +44,7 @@ in # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - wget vim python3Full nmap htop wireguard-tools + wget vim python3Full nmap htop wireguard-tools docker-compose ]; users.users.leoncloud = {