From 8e22e05d2b5f52ad93869a92cb981e249a3ad8fa Mon Sep 17 00:00:00 2001 From: Xavier Lagraula Date: Mon, 11 May 2026 12:11:15 +0200 Subject: [PATCH] feat: update sample environment to match nixos-infra structure - Add network/dns.nix, network/time.nix, network/proxy.nix, network/smtp.nix - Add network/default.nix to import all network files - Add hosts/default.nix, hosts/servers/default.nix, hosts/workstations/default.nix - These placeholders match the structure in nixos-infra for consistency The sample environment now reflects the same organization as production, dev, and stage environments, making it easier to use as a reference. --- environments/sample/hosts/default.nix | 14 +++++++++++++ environments/sample/hosts/servers/default.nix | 15 +++++++++++++ .../sample/hosts/workstations/default.nix | 15 +++++++++++++ environments/sample/network/default.nix | 16 ++++++++++++++ environments/sample/network/dns.nix | 21 +++++++++++++++++++ environments/sample/network/proxy.nix | 18 ++++++++++++++++ environments/sample/network/smtp.nix | 12 +++++++++++ environments/sample/network/time.nix | 15 +++++++++++++ 8 files changed, 126 insertions(+) create mode 100644 environments/sample/hosts/default.nix create mode 100644 environments/sample/hosts/servers/default.nix create mode 100644 environments/sample/hosts/workstations/default.nix create mode 100644 environments/sample/network/default.nix create mode 100644 environments/sample/network/dns.nix create mode 100644 environments/sample/network/proxy.nix create mode 100644 environments/sample/network/smtp.nix create mode 100644 environments/sample/network/time.nix diff --git a/environments/sample/hosts/default.nix b/environments/sample/hosts/default.nix new file mode 100644 index 0000000..5c422ec --- /dev/null +++ b/environments/sample/hosts/default.nix @@ -0,0 +1,14 @@ +{ config, pkgs, lib, ... }: + +{ + # Common settings for all hosts in the sample environment + # This file is imported by all host configurations (servers and workstations) + + # TODO: Move common settings here later + # Examples: + # - Common users/groups + # - Common packages + # - Common services + # - Common security policies + # - Common monitoring/alerting +} \ No newline at end of file diff --git a/environments/sample/hosts/servers/default.nix b/environments/sample/hosts/servers/default.nix new file mode 100644 index 0000000..79b31ff --- /dev/null +++ b/environments/sample/hosts/servers/default.nix @@ -0,0 +1,15 @@ +{ config, pkgs, lib, ... }: + +{ + # Common settings for all servers in the sample environment + # This file is imported by all server configurations + + # TODO: Move common server settings here later + # Examples: + # - Server-specific users/groups + # - Server-specific packages + # - Server-specific services + # - Server-specific security policies + # - Server-specific monitoring/alerting + # - Locale: en_US.UTF-8 (for servers) +} \ No newline at end of file diff --git a/environments/sample/hosts/workstations/default.nix b/environments/sample/hosts/workstations/default.nix new file mode 100644 index 0000000..728c73b --- /dev/null +++ b/environments/sample/hosts/workstations/default.nix @@ -0,0 +1,15 @@ +{ config, pkgs, lib, ... }: + +{ + # Common settings for all workstations in the sample environment + # This file is imported by all workstation configurations + + # TODO: Move common workstation settings here later + # Examples: + # - Workstation-specific users/groups + # - Workstation-specific packages + # - Workstation-specific services + # - Workstation-specific security policies + # - Workstation-specific monitoring/alerting + # - Locale: fr_FR.UTF-8 (for workstations) +} \ No newline at end of file diff --git a/environments/sample/network/default.nix b/environments/sample/network/default.nix new file mode 100644 index 0000000..54f3d33 --- /dev/null +++ b/environments/sample/network/default.nix @@ -0,0 +1,16 @@ +# Central network data source for the sample environment. +# +# Usage from a configuration.nix: +# network = import ../../network { }; +# network.dns.domain → "sample.lagraula.fr" +# network.time.timeZone → "Europe/Paris" +# +# Usage from a shell script (via `nix eval`): +# nix eval --json -f network/default.nix dns + +{ + dns = import ./dns.nix; + time = import ./time.nix; + proxy = import ./proxy.nix; + smtp = import ./smtp.nix; +} \ No newline at end of file diff --git a/environments/sample/network/dns.nix b/environments/sample/network/dns.nix new file mode 100644 index 0000000..5f20cb1 --- /dev/null +++ b/environments/sample/network/dns.nix @@ -0,0 +1,21 @@ +{ config, pkgs, lib, ... }: + +{ + # Sample DNS configuration for the sample environment + domain = "sample.lagraula.fr"; + + # Default DNS servers for this environment + defaultNameServers = [ "10.40.128.10" ]; + + # Forwarders for this environment + forwarders = [ "1.1.1.1" "8.8.8.8" ]; + + # Allow zone transfers (none in sample) + allowZoneTransfer = [ ]; + + # Recursion policy + recursion = "AllowOnlyForPrivateNetworks"; + + # Email for Let's Encrypt + letsEncryptEmail = "xavier@lagraula.fr"; +} \ No newline at end of file diff --git a/environments/sample/network/proxy.nix b/environments/sample/network/proxy.nix new file mode 100644 index 0000000..91e1a87 --- /dev/null +++ b/environments/sample/network/proxy.nix @@ -0,0 +1,18 @@ +{ config, pkgs, lib, ... }: + +{ + # Proxy configuration for this environment + # Currently no proxy is used — direct access for all hosts + + workstations = { + httpProxy = ""; + httpsProxy = ""; + noProxy = ""; + }; + + servers = { + httpProxy = ""; + httpsProxy = ""; + noProxy = ""; + }; +} \ No newline at end of file diff --git a/environments/sample/network/smtp.nix b/environments/sample/network/smtp.nix new file mode 100644 index 0000000..7075698 --- /dev/null +++ b/environments/sample/network/smtp.nix @@ -0,0 +1,12 @@ +{ config, pkgs, lib, ... }: + +{ + # SMTP relay configuration for this environment + relayHost = "smtp.lagraula.fr"; + relayPort = 587; + + useTLS = true; + useSTARTTLS = true; + + fromAddress = "noreply@sample.lagraula.fr"; +} \ No newline at end of file diff --git a/environments/sample/network/time.nix b/environments/sample/network/time.nix new file mode 100644 index 0000000..8a534e0 --- /dev/null +++ b/environments/sample/network/time.nix @@ -0,0 +1,15 @@ +{ config, pkgs, lib, ... }: + +{ + # NTP servers for this environment + ntpServers = [ + "10.10.128.1" # IPv4 gateway + "fd00::1" # IPv6 gateway + ]; + + # Time zone + timeZone = "Europe/Paris"; + + # Hardware clock setting + hardwareClock = "UTC"; +} \ No newline at end of file