From d2a7379876196b64fe345f47db2ab91d5315857d Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Wed, 18 Dec 2024 08:58:08 +0100 Subject: refactor: introduce domains.nix --- nixos/domains.nix | 7 +++++++ nixos/parts/tailscale.nix | 5 ++++- nixos/tente-configuration.nix | 7 +++---- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 nixos/domains.nix diff --git a/nixos/domains.nix b/nixos/domains.nix new file mode 100644 index 0000000..95f0a3c --- /dev/null +++ b/nixos/domains.nix @@ -0,0 +1,7 @@ +let + domain = "beta.push-f.com"; +in +{ + personalWebsite = domain; + tailscaleControlServer = "tailscale.${domain}"; +} diff --git a/nixos/parts/tailscale.nix b/nixos/parts/tailscale.nix index bce1564..1cb6dcf 100644 --- a/nixos/parts/tailscale.nix +++ b/nixos/parts/tailscale.nix @@ -1,10 +1,13 @@ +let + domains = import ../domains.nix; +in { config, pkgs, ... }: { services.tailscale = { enable = true; extraUpFlags = [ - "--login-server=https://headscale.push-f.com/" + "--login-server=https://${domains.tailscaleControlServer}/" ]; # Only needed during activation. # authKeyFile = "/tmp/key-file"; diff --git a/nixos/tente-configuration.nix b/nixos/tente-configuration.nix index 3c52332..459fe87 100644 --- a/nixos/tente-configuration.nix +++ b/nixos/tente-configuration.nix @@ -4,7 +4,7 @@ # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). let - domain = "beta.push-f.com"; + domains = import ./domains.nix; acmeEmail = "martin@push-f.com"; in { config, lib, pkgs, ... }: @@ -101,11 +101,10 @@ in group = "www-data"; }; - # My personal website - nginx.virtualHosts.${domain} = { + nginx.virtualHosts.${domains.personalWebsite} = { enableACME = true; forceSSL = true; - root = "/srv/www/${domain}"; + root = "/srv/www/${domains.personalWebsite}"; }; }; -- cgit v1.2.3