feat: changed config module names

This commit is contained in:
Nick 2024-11-04 20:49:43 -06:00
parent 95346caae6
commit 7a6685cbc2
34 changed files with 123 additions and 123 deletions

View file

@ -34,7 +34,7 @@ in let
] ]
) )
// { // {
user = lib.mkOption { users = lib.mkOption {
type = lib.types.attrsOf userSubmodule; type = lib.types.attrsOf userSubmodule;
}; };
}; };
@ -79,7 +79,7 @@ in let
"writefreely" "writefreely"
]) ])
// { // {
instance = lib.mkOption { instances = lib.mkOption {
type = lib.types.attrsOf instanceSubmodule; type = lib.types.attrsOf instanceSubmodule;
}; };
}; };
@ -102,7 +102,7 @@ in let
}; };
}; };
}; };
systemSubmodule = lib.types.submodule { machineSubmodule = lib.types.submodule {
options = options =
builtins.listToAttrs (map (name: { builtins.listToAttrs (map (name: {
inherit name; inherit name;
@ -119,7 +119,7 @@ in let
"tablet" "tablet"
]) ])
// { // {
device = lib.mkOption { devices = lib.mkOption {
type = lib.types.attrsOf deviceSubmodule; type = lib.types.attrsOf deviceSubmodule;
}; };
}; };
@ -146,11 +146,11 @@ in let
}; };
in { in {
options = { options = {
service = lib.mkOption { services = lib.mkOption {
type = serviceSubmodule; type = serviceSubmodule;
}; };
system = lib.mkOption { machines = lib.mkOption {
type = systemSubmodule; type = machineSubmodule;
}; };
people = lib.mkOption { people = lib.mkOption {
type = peopleSubmodule; type = peopleSubmodule;
@ -158,8 +158,8 @@ in {
}; };
config = { config = {
people = import ./user.nix; people = import ./users.nix;
service = import ./instance.nix; services = import ./instances.nix;
system = import ./device.nix; machines = import ./devices.nix;
}; };
} }

View file

@ -7,7 +7,7 @@ let
userIdForUser0 = ["uid=1000"]; userIdForUser0 = ["uid=1000"];
userIdForUser1 = ["uid=1001"]; userIdForUser1 = ["uid=1001"];
in { in {
device = { devices = {
# Desktop # Desktop
desktop = { desktop = {
label = "Desktop"; label = "Desktop";

View file

@ -14,7 +14,7 @@ let
varLib = "/var/lib"; varLib = "/var/lib";
in { in {
instance = { instances = {
web = { web = {
domains = { domains = {
url0 = domain0; url0 = domain0;

View file

@ -6,7 +6,7 @@ in {
user0 user0
user1 user1
; ;
user = { users = {
"${user0}" = { "${user0}" = {
name = "Nick"; name = "Nick";
aliases = { aliases = {

View file

@ -1,14 +1,14 @@
{flake, ...}: let {flake, ...}: let
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
inherit (flake.config.people.user.${user0}) aliases; inherit (flake.config.people.users.${user0}) aliases;
inherit (flake.config.system.device) nas server; inherit (flake.config.machines.devices) nas server;
inherit (flake.config.service) instance; inherit (flake.config.services) instances;
gitlabTags = ["git" "gitlab"]; gitlabTags = ["git" "gitlab"];
youtubeTags = ["youtube" "you" "tube" "yt"]; youtubeTags = ["youtube" "you" "tube" "yt"];
jellyfinTags = ["jelly" "video" "streaming" "movies" "shows" "music"]; jellyfinTags = ["jelly" "video" "streaming" "movies" "shows" "music"];
ollamaTags = [instance.ollama.name "chat" "ai"]; ollamaTags = [instances.ollama.name "chat" "ai"];
owncastTags = [instance.owncast.name "own" "cast" "stream"]; owncastTags = [instances.owncast.name "own" "cast" "stream"];
syncthingTags = [instance.syncthing.name "sync" "thing" instance.synology.name]; syncthingTags = [instances.syncthing.name "sync" "thing" instances.synology.name];
in { in {
programs.firefox.profiles = { programs.firefox.profiles = {
${user0} = { ${user0} = {
@ -224,28 +224,28 @@ in {
toolbar = false; toolbar = false;
bookmarks = [ bookmarks = [
{ {
name = instance.forgejo.label; name = instances.forgejo.label;
url = "https://${instance.forgejo.subdomain}.${instance.web.domains.url0}"; url = "https://${instances.forgejo.subdomain}.${instances.web.domains.url0}";
tags = [instance.forgejo.name "forge" "git"]; tags = [instances.forgejo.name "forge" "git"];
keyword = instance.forgejo.label; keyword = instances.forgejo.label;
} }
{ {
name = "${instance.jellyfin.label} (Internet)"; name = "${instances.jellyfin.label} (Internet)";
url = "https://${instance.jellyfin.name}.${instance.web.domains.url0}"; url = "https://${instances.jellyfin.name}.${instances.web.domains.url0}";
tags = jellyfinTags; tags = jellyfinTags;
keyword = instance.jellyfin.label; keyword = instances.jellyfin.label;
} }
{ {
name = "${instance.jellyfin.label} (Local)"; name = "${instances.jellyfin.label} (Local)";
url = "http://${server.ip.address0}:${toString instance.jellyfin.ports.port1}"; url = "http://${server.ip.address0}:${toString instances.jellyfin.ports.port1}";
tags = jellyfinTags; tags = jellyfinTags;
keyword = instance.jellyfin.label; keyword = instances.jellyfin.label;
} }
{ {
name = instance.mastodon.label; name = instances.mastodon.label;
url = "https://${instance.web.domains.url1}"; url = "https://${instances.web.domains.url1}";
tags = [instance.mastodon.name "mast" "md"]; tags = [instances.mastodon.name "mast" "md"];
keyword = instance.mastodon.label; keyword = instances.mastodon.label;
} }
{ {
name = "Namecheap"; name = "Namecheap";
@ -254,86 +254,86 @@ in {
keyword = "Name"; keyword = "Name";
} }
{ {
name = instance.nextcloud.label; name = instances.nextcloud.label;
url = "https://${instance.nextcloud.subdomain}.${instance.web.domains.url1}"; url = "https://${instances.nextcloud.subdomain}.${instances.web.domains.url1}";
tags = [instance.nextcloud.name "next" "cloud" "calendar"]; tags = [instances.nextcloud.name "next" "cloud" "calendar"];
keyword = instance.nextcloud.label; keyword = instances.nextcloud.label;
} }
{ {
name = aliases.name2; name = aliases.name2;
url = instance.web.domains.url2; url = instances.web.domains.url2;
tags = [aliases.name3 "blog"]; tags = [aliases.name3 "blog"];
keyword = aliases.name2; keyword = aliases.name2;
} }
{ {
name = "${instance.ollama.label} (Server)"; name = "${instances.ollama.label} (Server)";
url = "https://${instance.ollama.subdomain}.${instance.web.domains.url1}"; url = "https://${instances.ollama.subdomain}.${instances.web.domains.url1}";
tags = ollamaTags; tags = ollamaTags;
keyword = instance.ollama.label; keyword = instances.ollama.label;
} }
{ {
name = "${instance.ollama.label} (Desktop)"; name = "${instances.ollama.label} (Desktop)";
url = "http://localhost:${toString instance.ollama.ports.port0}"; url = "http://localhost:${toString instances.ollama.ports.port0}";
tags = ollamaTags; tags = ollamaTags;
keyword = instance.ollama.label; keyword = instances.ollama.label;
} }
{ {
name = "${instance.owncast.label} (Admin)"; name = "${instances.owncast.label} (Admin)";
url = "http://${server.ip.address0}:${toString instance.owncast.ports.port0}/admin"; url = "http://${server.ip.address0}:${toString instances.owncast.ports.port0}/admin";
tags = owncastTags; tags = owncastTags;
keyword = instance.owncast.label; keyword = instances.owncast.label;
} }
{ {
name = "${instance.owncast.label} (Server)"; name = "${instances.owncast.label} (Server)";
url = "http://${instance.owncast.subdomain}.${instance.web.domains.url1}"; url = "http://${instances.owncast.subdomain}.${instances.web.domains.url1}";
tags = owncastTags; tags = owncastTags;
keyword = instance.owncast.label; keyword = instances.owncast.label;
} }
{ {
name = instance.peertube.label; name = instances.peertube.label;
url = "https://${instance.peertube.subdomain}.${instance.web.domains.url1}"; url = "https://${instances.peertube.subdomain}.${instances.web.domains.url1}";
tags = [instance.peertube.name "peer" "tube" "nutrivore"]; tags = [instances.peertube.name "peer" "tube" "nutrivore"];
keyword = instance.peertube.label; keyword = instances.peertube.label;
} }
{ {
name = "Router"; name = "Router";
url = "http://${instance.web.localhost.address2}"; url = "http://${instances.web.localhost.address2}";
tags = ["router" "asus"]; tags = ["router" "asus"];
keyword = "Router"; keyword = "Router";
} }
{ {
name = "${instance.syncthing.label} (${instance.synology.label})"; name = "${instances.syncthing.label} (${instances.synology.label})";
url = "http://${nas.ip.address0}:${toString instance.syncthing.ports.port0}"; url = "http://${nas.ip.address0}:${toString instances.syncthing.ports.port0}";
tags = tags =
["synology"] ["synology"]
++ syncthingTags; ++ syncthingTags;
keyword = instance.syncthing.label; keyword = instances.syncthing.label;
} }
{ {
name = "${instance.syncthing.label} (Desktop)"; name = "${instances.syncthing.label} (Desktop)";
url = "http://localhost:${toString instance.syncthing.ports.port0}"; url = "http://localhost:${toString instances.syncthing.ports.port0}";
tags = tags =
["desktop"] ["desktop"]
++ syncthingTags; ++ syncthingTags;
keyword = instance.syncthing.label; keyword = instances.syncthing.label;
} }
{ {
name = instance.synology.label; name = instances.synology.label;
url = "https://${nas.ip.address0}:${toString instance.synology.ports.port0}"; url = "https://${nas.ip.address0}:${toString instances.synology.ports.port0}";
tags = [instance.synology.name "dsm" "cloud"]; tags = [instances.synology.name "dsm" "cloud"];
keyword = instance.synology.label; keyword = instances.synology.label;
} }
{ {
name = instance.vaultwarden.label; name = instances.vaultwarden.label;
url = "https://${instance.vaultwarden.subdomain}.${instance.web.domains.url0}"; url = "https://${instances.vaultwarden.subdomain}.${instances.web.domains.url0}";
tags = [instance.vaultwarden.name "bitwarden" "vault" "bit" "warden"]; tags = [instances.vaultwarden.name "bitwarden" "vault" "bit" "warden"];
keyword = instance.vaultwarden.label; keyword = instances.vaultwarden.label;
} }
{ {
name = instance.wiki.label; name = instances.wiki.label;
url = "https://${instance.wiki.subdomain}.${instance.web.domains.url1}"; url = "https://${instances.wiki.subdomain}.${instances.web.domains.url1}";
tags = [instance.wiki.name "vault"]; tags = [instances.wiki.name "vault"];
keyword = instance.wiki.label; keyword = instances.wiki.label;
} }
]; ];
} }

View file

@ -4,7 +4,7 @@
... ...
}: let }: let
user = config.home.username; user = config.home.username;
userConfig = flake.config.people.user.${user}; userConfig = flake.config.people.users.${user};
in { in {
programs.git = { programs.git = {
enable = true; enable = true;

View file

@ -1,5 +1,5 @@
{flake, ...}: let {flake, ...}: let
inherit (flake.config.service.instance) ollama web; inherit (flake.config.services.instances) ollama web;
service = ollama; service = ollama;
localhost = web.localhost.address0; localhost = web.localhost.address0;
in { in {

View file

@ -1,5 +1,5 @@
{flake, ...}: let {flake, ...}: let
inherit (flake.config.system.device) printer0 printer1; inherit (flake.config.machines.devices) printer0 printer1;
genericPPD = "drv:///sample.drv/generic.ppd"; genericPPD = "drv:///sample.drv/generic.ppd";
pageSize = "Letter"; pageSize = "Letter";
in { in {

View file

@ -4,18 +4,18 @@
... ...
}: let }: let
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
inherit (flake.config.people.user.${user0}) email; inherit (flake.config.people.users.${user0}) email;
inherit (flake.config.service) instance; inherit (flake.config.services) instances;
domain0 = instance.web.domains.url0; domain0 = instances.web.domains.url0;
domain1 = instance.web.domains.url1; domain1 = instances.web.domains.url1;
dns = instance.web.dns.provider0; dns = instances.web.dns.provider0;
instanceName = service: (instance.${service}.subdomain); instanceName = service: (instances.${service}.subdomain);
dnsConfig = { dnsConfig = {
dnsProvider = dns; dnsProvider = dns;
directory = instance.acme.paths.path0; directory = instances.acme.paths.path0;
environmentFile = config.sops.secrets."dns/namecheap".path; environmentFile = config.sops.secrets."dns/namecheap".path;
}; };
in { in {
@ -68,7 +68,7 @@ in {
sops = let sops = let
sopsSecrets = ["pass"]; sopsSecrets = ["pass"];
sopsPath = secret: { sopsPath = secret: {
path = "/var/lib/secrets/${instance.acme.name}/${dns}-${secret}"; path = "/var/lib/secrets/${instances.acme.name}/${dns}-${secret}";
owner = "root"; owner = "root";
mode = "600"; mode = "600";
}; };

View file

@ -1,5 +1,5 @@
{flake, ...}: let {flake, ...}: let
inherit (flake.config.service.instance) caddy web; inherit (flake.config.services.instances) caddy web;
domain0 = web.domains.url0; domain0 = web.domains.url0;

View file

@ -3,8 +3,8 @@
config, config,
... ...
}: let }: let
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
inherit (flake.config.service.instance) castopod nginx web; inherit (flake.config.services.instances) castopod nginx web;
service = castopod; service = castopod;
localhost = web.localhost.address0; localhost = web.localhost.address0;
host = "${service.subdomain}.${web.domains.url1}"; host = "${service.subdomain}.${web.domains.url1}";

View file

@ -3,8 +3,8 @@
config, config,
... ...
}: let }: let
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
inherit (flake.config.service.instance) forgejo web; inherit (flake.config.services.instances) forgejo web;
service = forgejo; service = forgejo;
localhost = web.localhost.address0; localhost = web.localhost.address0;
host = "${service.subdomain}.${web.domains.url1}"; host = "${service.subdomain}.${web.domains.url1}";

View file

@ -1,7 +1,7 @@
{flake, ...}: let {flake, ...}: let
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
inherit (flake.config.service.instance) jellyfin web; inherit (flake.config.services.instances) jellyfin web;
service = jellyfin; service = jellyfin;
localhost = web.localhost.address0; localhost = web.localhost.address0;
host = "${service.subdomain}.${web.domains.url0}"; host = "${service.subdomain}.${web.domains.url0}";

View file

@ -5,8 +5,8 @@
lib, lib,
... ...
}: let }: let
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
inherit (flake.config.service.instance) mastodon web; inherit (flake.config.services.instances) mastodon web;
service = mastodon; service = mastodon;
host = web.domains.url1; host = web.domains.url1;
localhost = web.localhost.address0; localhost = web.localhost.address0;

View file

@ -3,8 +3,8 @@
flake, flake,
... ...
}: let }: let
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
inherit (flake.config.service.instance) minecraft; inherit (flake.config.services.instances) minecraft;
service = minecraft; service = minecraft;
in { in {
services = { services = {

View file

@ -5,9 +5,9 @@
... ...
}: let }: let
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
inherit (flake.config.people.user.${user0}) name; inherit (flake.config.people.users.${user0}) name;
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
inherit (flake.config.service.instance) nextcloud nginx web; inherit (flake.config.services.instances) nextcloud nginx web;
service = nextcloud; service = nextcloud;
localhost = web.localhost.address0; localhost = web.localhost.address0;
host = "${service.subdomain}.${web.domains.url1}"; host = "${service.subdomain}.${web.domains.url1}";

View file

@ -1,6 +1,6 @@
{flake, ...}: let {flake, ...}: let
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
inherit (flake.config.service.instance) ollama web; inherit (flake.config.services.instances) ollama web;
service = ollama; service = ollama;
localhost = web.localhost.address0; localhost = web.localhost.address0;
host = "${service.subdomain}.${web.domains.url0}"; host = "${service.subdomain}.${web.domains.url0}";

View file

@ -1,5 +1,5 @@
{flake, ...}: let {flake, ...}: let
inherit (flake.config.service.instance) owncast web; inherit (flake.config.services.instances) owncast web;
service = owncast; service = owncast;
localhost = web.localhost.address1; localhost = web.localhost.address1;
host = "${service.subdomain}.${web.domains.url1}"; host = "${service.subdomain}.${web.domains.url1}";

View file

@ -4,8 +4,8 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
inherit (flake.config.service.instance) caddy peertube web; inherit (flake.config.services.instances) caddy peertube web;
service = peertube; service = peertube;
localhost = web.localhost.address0; localhost = web.localhost.address0;
host = "${service.subdomain}.${web.domains.url1}"; host = "${service.subdomain}.${web.domains.url1}";

View file

@ -1,6 +1,6 @@
{flake, ...}: let {flake, ...}: let
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
inherit (flake.config.service.instance) postgresql; inherit (flake.config.services.instances) postgresql;
service = postgresql; service = postgresql;
in { in {

View file

@ -3,7 +3,7 @@
flake, flake,
... ...
}: let }: let
inherit (flake.config.service.instance) samba jellyfin; inherit (flake.config.services.instances) samba jellyfin;
service = samba; service = samba;
in { in {
# If you ever need to start fresh, you need to add yourself to the Samba users database: # If you ever need to start fresh, you need to add yourself to the Samba users database:

View file

@ -3,7 +3,7 @@
config, config,
... ...
}: let }: let
inherit (flake.config.service.instance) vaultwarden web; inherit (flake.config.services.instances) vaultwarden web;
service = vaultwarden; service = vaultwarden;
localhost = web.localhost.address0; localhost = web.localhost.address0;
host = "${service.subdomain}.${web.domains.url0}"; host = "${service.subdomain}.${web.domains.url0}";

View file

@ -3,8 +3,8 @@
config, config,
... ...
}: let }: let
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
inherit (flake.config.service.instance) web wiki; inherit (flake.config.services.instances) web wiki;
service = wiki; service = wiki;
localhost = web.localhost.address1; localhost = web.localhost.address1;
host = "${service.subdomain}.${web.domains.url1}"; host = "${service.subdomain}.${web.domains.url1}";

View file

@ -1,6 +1,6 @@
{flake, ...}: let {flake, ...}: let
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
inherit (flake.config.people.user.${user0}) sshKeys; inherit (flake.config.people.users.${user0}) sshKeys;
in { in {
users.users.${user0} = { users.users.${user0} = {
openssh.authorizedKeys.keys = sshKeys; openssh.authorizedKeys.keys = sshKeys;

View file

@ -1,6 +1,6 @@
{flake, ...}: let {flake, ...}: let
inherit (flake.config.system.device) nas phone tablet; inherit (flake.config.machines.devices) nas phone tablet;
inherit (flake.config.service.instance) syncthing web; inherit (flake.config.services.instances) syncthing web;
service = syncthing; service = syncthing;
localhost = web.localhost.address0; localhost = web.localhost.address0;
in { in {

View file

@ -5,7 +5,7 @@
... ...
}: let }: let
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
inherit (flake.config.people.user.${user0}) name paths; inherit (flake.config.people.users.${user0}) name paths;
hostname = config.networking.hostName; hostname = config.networking.hostName;
in { in {

View file

@ -6,7 +6,7 @@
}: let }: let
hostname = config.networking.hostName; hostname = config.networking.hostName;
inherit (flake.config.people) user1; inherit (flake.config.people) user1;
inherit (flake.config.people.user.${user1}) name; inherit (flake.config.people.users.${user1}) name;
in { in {
users = { users = {
users.${user1} = { users.${user1} = {

View file

@ -4,8 +4,8 @@
... ...
}: let }: let
inherit (flake.config.people) user0 user1; inherit (flake.config.people) user0 user1;
inherit (flake.config.system.device) desktop server nas; inherit (flake.config.machines.devices) desktop server nas;
inherit (flake.config.service.instance) samba; inherit (flake.config.services.instances) samba;
synologySecrets = config.sops.secrets."network/synology".path; synologySecrets = config.sops.secrets."network/synology".path;
serverSecrets = config.sops.secrets."network/server".path; serverSecrets = config.sops.secrets."network/server".path;

View file

@ -3,7 +3,7 @@
flake, flake,
... ...
}: let }: let
inherit (flake.config.system.device) desktop; inherit (flake.config.machines.devices) desktop;
in { in {
networking = { networking = {
hostName = desktop.name; hostName = desktop.name;

View file

@ -1,6 +1,6 @@
{flake, ...}: let {flake, ...}: let
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
inherit (flake.config.people.user.${user0}) paths; inherit (flake.config.people.users.${user0}) paths;
in { in {
sops = { sops = {
secrets = { secrets = {

View file

@ -4,8 +4,8 @@
... ...
}: let }: let
inherit (flake.config.people) user0 user1; inherit (flake.config.people) user0 user1;
inherit (flake.config.system.device) laptop nas server; inherit (flake.config.machines.devices) laptop nas server;
inherit (flake.config.service.instance) samba; inherit (flake.config.services.instances) samba;
synologySecrets = config.sops.secrets."network/synology".path; synologySecrets = config.sops.secrets."network/synology".path;
serverSecrets = config.sops.secrets."network/server".path; serverSecrets = config.sops.secrets."network/server".path;

View file

@ -3,7 +3,7 @@
flake, flake,
... ...
}: let }: let
inherit (flake.config.system.device) laptop; inherit (flake.config.machines.devices) laptop;
in { in {
networking = { networking = {
hostName = laptop.name; hostName = laptop.name;

View file

@ -4,7 +4,7 @@
... ...
}: let }: let
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
in { in {
fileSystems = let fileSystems = let
storageDrives = [ storageDrives = [

View file

@ -3,7 +3,7 @@
flake, flake,
... ...
}: let }: let
inherit (flake.config.system.device) server; inherit (flake.config.machines.devices) server;
in { in {
networking = { networking = {
hostName = server.name; hostName = server.name;