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:
2025-12-23 14:13:47 +00:00
parent 4f93e60f3c
commit 1d8a0c660c
14 changed files with 95 additions and 85 deletions

View File

@@ -53,7 +53,7 @@
};
users.users.${user} = {
name = "${user}";
name = user;
home = "/Users/${user}";
isHidden = false;
shell = pkgs.fish;

View File

@@ -2,6 +2,7 @@
pkgs,
user,
constants,
inputs,
...
}: {
security.sudo.enable = true;
@@ -9,8 +10,12 @@
system.stateVersion = constants.stateVersions.nixos;
time.timeZone = "UTC";
home-manager.sharedModules = [
{_module.args = {inherit user constants inputs;};}
];
nix = {
settings.trusted-users = ["${user}"];
settings.trusted-users = [user];
gc.dates = "weekly";
nixPath = ["nixos-config=/home/${user}/.local/share/src/nixos-config:/etc/nixos"];
};

View File

@@ -41,7 +41,6 @@
'';
};
};
# Antigravity Google models (for opencode-antigravity-auth plugin)
provider = {
google = {
models = {
@@ -128,10 +127,6 @@
};
};
# oh-my-opencode configuration
# - Disables built-in google_auth (using antigravity plugin instead)
# - Oracle uses Zen API (opencode/gpt-5.2) instead of ChatGPT subscription
# - Frontend/document/multimodal agents use Antigravity Gemini models
home.file.".config/opencode/oh-my-opencode.json".text = builtins.toJSON {
"$schema" = "https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json";
google_auth = false;

View File

@@ -1,6 +1,7 @@
{
user,
pkgs,
constants,
...
}: let
isDarwin = pkgs.stdenv.isDarwin;
@@ -12,36 +13,37 @@
if isDarwin
then "staff"
else "users";
deviceIds = constants.syncthingDeviceIds;
in {
services.syncthing = {
enable = true;
openDefaultPorts = !isDarwin;
dataDir = "${homeDir}/.local/share/syncthing";
configDir = "${homeDir}/.config/syncthing";
user = "${user}";
group = group;
user = user;
inherit group;
guiAddress = "0.0.0.0:8384";
overrideFolders = true;
overrideDevices = true;
settings = {
devices = {
"tahani" = {
id = "6B7OZZF-TEAMUGO-FBOELXP-Z4OY7EU-5ZHLB5T-V6Z3UDB-Q2DYR43-QBYW6QM";
tahani = {
id = deviceIds.tahani;
addresses = ["tcp://tahani:22000"];
};
"jason" = {
id = "42II2VO-QYPJG26-ZS3MB2I-AOPVZ67-JJNSE76-U54CO5Y-634A5OG-ECU4YQA";
jason = {
id = deviceIds.jason;
addresses = ["tcp://jason:22000"];
};
"chidi" = {
id = "N7W6SUT-QO6J4BE-T3Y65SM-OFGYGNV-TGYBJPX-JVN4Z72-AENZ247-KWXOQA6";
chidi = {
id = deviceIds.chidi;
addresses = ["tcp://chidi:22000"];
};
};
folders = {
"nixos-config" = {
nixos-config = {
path = "${homeDir}/nixos-config";
devices = ["tahani" "jason" "chidi"];
};