refactor: reduce duplication and improve consistency across hosts
- Centralize home-manager _module.args in profiles/nixos.nix via sharedModules - Add lib/secrets.nix with mkSyncthingSecrets helper for DRY secret definitions - Move syncthing device IDs to lib/constants.nix - Standardize hostname handling (Darwin hosts now use hostname arg) - Add missing networking.hostName to tahani - Fix redundant string interpolations
This commit is contained in:
25
lib/secrets.nix
Normal file
25
lib/secrets.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
mkSyncthingSecrets = {
|
||||
hostname,
|
||||
user,
|
||||
isDarwin,
|
||||
}: let
|
||||
homeDir =
|
||||
if isDarwin
|
||||
then "/Users/${user}"
|
||||
else "/home/${user}";
|
||||
in {
|
||||
"${hostname}-syncthing-cert" = {
|
||||
sopsFile = ../secrets/${hostname}-syncthing-cert;
|
||||
format = "binary";
|
||||
owner = user;
|
||||
path = "${homeDir}/.config/syncthing/cert.pem";
|
||||
};
|
||||
"${hostname}-syncthing-key" = {
|
||||
sopsFile = ../secrets/${hostname}-syncthing-key;
|
||||
format = "binary";
|
||||
owner = user;
|
||||
path = "${homeDir}/.config/syncthing/key.pem";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user