refactor: move email to global variable

This commit is contained in:
2024-10-27 16:40:34 +05:30
parent 1a59094c57
commit f5e87d9be2
10 changed files with 33 additions and 21 deletions

View File

@ -41,6 +41,7 @@
"x86_64-linux" "x86_64-linux"
]; ];
username = "tux"; username = "tux";
email = "t@tux.rs";
in { in {
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
@ -52,42 +53,42 @@
# 'nixos-rebuild switch --flake .#your-hostname' # 'nixos-rebuild switch --flake .#your-hostname'
nixosConfigurations = { nixosConfigurations = {
arcturus = nixpkgs.lib.nixosSystem { arcturus = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs username;}; specialArgs = {inherit inputs outputs username email;};
modules = [./hosts/arcturus]; modules = [./hosts/arcturus];
}; };
canopus = nixpkgs.lib.nixosSystem { canopus = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs username;}; specialArgs = {inherit inputs outputs username email;};
modules = [./hosts/canopus]; modules = [./hosts/canopus];
}; };
alpha = nixpkgs.lib.nixosSystem { alpha = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs username;}; specialArgs = {inherit inputs outputs username email;};
modules = [./hosts/alpha]; modules = [./hosts/alpha];
}; };
sirius = nixpkgs.lib.nixosSystem { sirius = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs username;}; specialArgs = {inherit inputs outputs username email;};
modules = [./hosts/sirius]; modules = [./hosts/sirius];
}; };
vega = nixpkgs.lib.nixosSystem { vega = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs username;}; specialArgs = {inherit inputs outputs username email;};
modules = [./hosts/vega]; modules = [./hosts/vega];
}; };
capella = nixpkgs.lib.nixosSystem { capella = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs username;}; specialArgs = {inherit inputs outputs username email;};
modules = [./hosts/capella]; modules = [./hosts/capella];
}; };
vps = nixpkgs.lib.nixosSystem { vps = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs username;}; specialArgs = {inherit inputs outputs username email;};
modules = [./hosts/vps]; modules = [./hosts/vps];
}; };
isoImage = nixpkgs.lib.nixosSystem { isoImage = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs username;}; specialArgs = {inherit inputs outputs username email;};
modules = [./hosts/isoImage]; modules = [./hosts/isoImage];
}; };
}; };
@ -97,7 +98,7 @@
homeConfigurations = { homeConfigurations = {
"${username}@canopus" = home-manager.lib.homeManagerConfiguration { "${username}@canopus" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs username;}; extraSpecialArgs = {inherit inputs outputs username email;};
modules = [ modules = [
./modules/home-manager ./modules/home-manager
]; ];

View File

@ -2,6 +2,7 @@
pkgs, pkgs,
username, username,
config, config,
email,
... ...
}: { }: {
imports = [ imports = [
@ -48,7 +49,7 @@
acme = { acme = {
acceptTerms = true; acceptTerms = true;
defaults.email = "0xtux@pm.me"; defaults.email = "${email}";
certs = { certs = {
"tux.rs" = { "tux.rs" = {
domain = "*.tux.rs"; domain = "*.tux.rs";

View File

@ -2,6 +2,7 @@
pkgs, pkgs,
username, username,
config, config,
email,
... ...
}: { }: {
imports = [ imports = [
@ -84,7 +85,7 @@
acme = { acme = {
acceptTerms = true; acceptTerms = true;
defaults.email = "0xtux@pm.me"; defaults.email = "${email}";
certs = { certs = {
"tux.rs" = { "tux.rs" = {
domain = "*.tux.rs"; domain = "*.tux.rs";

View File

@ -5,6 +5,7 @@
config, config,
lib, lib,
inputs, inputs,
email,
... ...
}: let }: let
# Sops needs acess to the keys before the persist dirs are even mounted; so # Sops needs acess to the keys before the persist dirs are even mounted; so
@ -118,7 +119,7 @@ in {
isNormalUser = true; isNormalUser = true;
extraGroups = ["networkmanager" "wheel" "storage"]; extraGroups = ["networkmanager" "wheel" "storage"];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D 0xtux@pm.me'' ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${email}''
]; ];
}; };
}; };
@ -126,7 +127,7 @@ in {
home-manager = { home-manager = {
backupFileExtension = "backup"; backupFileExtension = "backup";
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = {inherit inputs outputs username;}; extraSpecialArgs = {inherit inputs outputs username email;};
users.${username} = { users.${username} = {
imports = [ imports = [
./home.nix ./home.nix

View File

@ -4,6 +4,7 @@
outputs, outputs,
pkgs, pkgs,
username, username,
email,
... ...
}: { }: {
imports = [ imports = [
@ -110,7 +111,7 @@
isNormalUser = true; isNormalUser = true;
extraGroups = ["networkmanager" "wheel" "storage"]; extraGroups = ["networkmanager" "wheel" "storage"];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D 0xtux@pm.me'' ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${email}''
]; ];
}; };
}; };

View File

@ -1,9 +1,13 @@
{pkgs, ...}: { {
pkgs,
email,
...
}: {
programs.rbw = { programs.rbw = {
enable = true; enable = true;
settings = { settings = {
base_url = "https://bw.tux.rs"; base_url = "https://bw.tux.rs";
email = "0xtux@pm.me"; email = "${email}";
}; };
}; };

View File

@ -1,8 +1,8 @@
{...}: { {email, ...}: {
programs.git = { programs.git = {
enable = true; enable = true;
userName = "tuxdotrs"; userName = "tuxdotrs";
userEmail = "t@tux.rs"; userEmail = "${email}";
signing = { signing = {
key = "~/.ssh/id_ed25519.pub"; key = "~/.ssh/id_ed25519.pub";
signByDefault = true; signByDefault = true;

View File

@ -2,11 +2,12 @@
config, config,
pkgs, pkgs,
lib, lib,
email,
... ...
}: { }: {
security = { security = {
acme = { acme = {
defaults.email = "0xtux@pm.me"; defaults.email = "${email}";
acceptTerms = true; acceptTerms = true;
}; };
}; };

View File

@ -1,6 +1,7 @@
{ {
lib, lib,
username, username,
email,
... ...
}: { }: {
services = { services = {
@ -10,7 +11,7 @@
server.http_port = 8888; server.http_port = 8888;
security = { security = {
admin_user = "${username}"; admin_user = "${username}";
admin_email = "0xtux@pm.me"; admin_email = "${email}";
}; };
}; };
}; };

View File

@ -1,6 +1,7 @@
{ {
config, config,
lib, lib,
email,
... ...
}: { }: {
services = { services = {
@ -16,8 +17,8 @@
adminUser = { adminUser = {
activate = true; activate = true;
email = "${email}";
name = "tux"; name = "tux";
email = "0xtux@pm.me";
passwordFile = config.sops.secrets.plausible_password.path; passwordFile = config.sops.secrets.plausible_password.path;
}; };