From 64e476798d7bb4a93813a3f2ceed77668275fff0 Mon Sep 17 00:00:00 2001 From: Zhongheng Liu Date: Tue, 17 Dec 2024 00:53:10 +0200 Subject: [PATCH] feat: experimenting with custom local hosts --- nixos/custom-hosts.nix | 13 +++++++++++++ nixos/services/nginx.service.nix | 11 ++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 nixos/custom-hosts.nix diff --git a/nixos/custom-hosts.nix b/nixos/custom-hosts.nix new file mode 100644 index 0000000..942bc4f --- /dev/null +++ b/nixos/custom-hosts.nix @@ -0,0 +1,13 @@ +{ + config, + lib, + pkgs, + ... +}: { + networking.extraHosts = '' + # home IP mapping + + 192.168.2.1 router.home + 192.168.2.2 server.home + ''; +} diff --git a/nixos/services/nginx.service.nix b/nixos/services/nginx.service.nix index 798f078..bd8b2ef 100644 --- a/nixos/services/nginx.service.nix +++ b/nixos/services/nginx.service.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + pkgs, + config, + ... +}: { services.nginx = { enable = true; virtualHosts."localhost" = { @@ -11,10 +15,7 @@ ''; }; }; - listenAddresses = [ - "127.0.0.1" - "[::1]" - ]; + listenAddresses = ["127.0.0.1" "[::1]"]; }; }; networking.firewall.allowedTCPPorts = [80];