From 2f0b5cf661842e9b0eecd13c2edbbc929cb72e80 Mon Sep 17 00:00:00 2001 From: DuN0z Date: Thu, 9 Oct 2025 14:27:25 +0200 Subject: [PATCH] Refactor: global.nix --- config/globals.nix | 13 +++++++++++++ hm/common/git.nix | 9 ++++++--- modules/common/smtp.nix | 15 +++++++++------ 3 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 config/globals.nix diff --git a/config/globals.nix b/config/globals.nix new file mode 100644 index 0000000..53ffe13 --- /dev/null +++ b/config/globals.nix @@ -0,0 +1,13 @@ +{ + domain = "porzh.me"; + admin = { + email = "dun0z@porzh.me"; + name = "DuN0z"; + }; + + smtp = { + host = "smtp.protonmail.ch"; + port = 587 ; + user = "contact@porzh.me"; + }; +} diff --git a/hm/common/git.nix b/hm/common/git.nix index ec4c03b..2399f41 100644 --- a/hm/common/git.nix +++ b/hm/common/git.nix @@ -1,8 +1,11 @@ -_: { +_: +let +globals = import ../../config/globals.nix; +in { programs.git = { enable = true; - userName = "DuN0z"; - userEmail = "dun0z@porzh.me"; + userName = globals.admin.name; + userEmail = globals.admin.email; }; } # vim: set ts=2 sw=2 sts=2 et : diff --git a/modules/common/smtp.nix b/modules/common/smtp.nix index 51a3a4d..d185e82 100644 --- a/modules/common/smtp.nix +++ b/modules/common/smtp.nix @@ -1,16 +1,19 @@ -{ config, pkgs, lib, ... }: { +{ config, pkgs, lib, ... }: +let +globals = import ../../config/globals.nix; +in { programs.msmtp = { enable = true; accounts.default = { - host = "smtp.protonmail.ch"; - port = 587; + host = globals.smtp.host; + port = globals.smtp.port; auth = true; tls = true; tls_starttls = true; - user = "contact@porzh.me"; + user = globals.smtp.user; passwordeval = "cat /run/secrets/proton_pass"; - from = "contact@porzh.me"; + from = globals.smtp.user; }; }; @@ -23,4 +26,4 @@ ]; environment.pathsToLink = [ "/etc/alternatives" "/usr/sbin" ]; - } +}