mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-13 10:00:52 -06:00
feat: updated abstractions
This commit is contained in:
parent
4512d7a5d9
commit
9aab8c6444
31 changed files with 70 additions and 97 deletions
0
modules/config/instances/config/photoprism.nix
Normal file → Executable file
0
modules/config/instances/config/photoprism.nix
Normal file → Executable file
|
|
@ -3,46 +3,63 @@ let
|
||||||
inherit (flake.config.machines.devices) mars;
|
inherit (flake.config.machines.devices) mars;
|
||||||
inherit (flake.config.services) instances;
|
inherit (flake.config.services) instances;
|
||||||
|
|
||||||
|
svc = service: interface: { inherit service interface; };
|
||||||
|
|
||||||
makeBookmarks =
|
makeBookmarks =
|
||||||
{
|
{
|
||||||
suffix,
|
suffix,
|
||||||
urlTemplate,
|
urlTemplate,
|
||||||
services,
|
services,
|
||||||
}:
|
}:
|
||||||
builtins.map (name: {
|
builtins.map (
|
||||||
name = "${instances.${name}.label} ${suffix}";
|
{ service, interface }:
|
||||||
url = urlTemplate name;
|
let
|
||||||
tags = instances.${name}.tags;
|
name = instances.${service}.name;
|
||||||
keyword = instances.${name}.short;
|
interfaceData = instances.${name}.interfaces.${interface};
|
||||||
}) (builtins.map (service: instances.${service}.name) services);
|
in
|
||||||
|
{
|
||||||
|
name = "${instances.${name}.label} ${suffix}";
|
||||||
|
url = urlTemplate name interfaceData;
|
||||||
|
tags = instances.${name}.tags;
|
||||||
|
keyword = instances.${name}.short;
|
||||||
|
}
|
||||||
|
) services;
|
||||||
|
|
||||||
instanceList = [
|
|
||||||
instances.firefly-iii.name
|
|
||||||
instances.forgejo.name
|
|
||||||
instances.jellyfin.name
|
|
||||||
instances.mastodon.name
|
|
||||||
instances.ollama.name
|
|
||||||
instances.qbittorrent.name
|
|
||||||
instances.vaultwarden.name
|
|
||||||
];
|
|
||||||
bookmarkConfigs = [
|
bookmarkConfigs = [
|
||||||
{
|
{
|
||||||
suffix = "(Remote)";
|
suffix = "(Remote)";
|
||||||
urlTemplate = name: "https://${instances.${name}.domains.url0}";
|
urlTemplate = name: iface: "https://${iface.domain}";
|
||||||
services = instanceList;
|
services = [
|
||||||
|
(svc instances.firefly-iii.name "interface0")
|
||||||
|
(svc instances.forgejo.name "interface0")
|
||||||
|
(svc instances.jellyfin.name "interface0")
|
||||||
|
(svc instances.mastodon.name "interface0")
|
||||||
|
(svc instances.ollama.name "interface0")
|
||||||
|
(svc instances.qbittorrent.name "interface0")
|
||||||
|
(svc instances.vaultwarden.name "interface0")
|
||||||
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
suffix = "(Server)";
|
suffix = "(Server)";
|
||||||
urlTemplate =
|
urlTemplate =
|
||||||
name: "http://${instances.${name}.interface.ip}:${builtins.toString instances.${name}.ports.port0}";
|
name: iface: "http://${iface.microvm.ip}:${builtins.toString instances.${name}.ports.port0}";
|
||||||
services = instanceList;
|
services = [
|
||||||
|
(svc instances.firefly-iii.name "interface0")
|
||||||
|
(svc instances.forgejo.name "interface0")
|
||||||
|
(svc instances.jellyfin.name "interface0")
|
||||||
|
(svc instances.mastodon.name "interface0")
|
||||||
|
(svc instances.ollama.name "interface0")
|
||||||
|
(svc instances.qbittorrent.name "interface0")
|
||||||
|
(svc instances.vaultwarden.name "interface0")
|
||||||
|
];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
suffix = "(Desktop)";
|
suffix = "(Desktop)";
|
||||||
urlTemplate = name: "http://${mars.ip.address0}:${builtins.toString instances.${name}.ports.port0}";
|
urlTemplate =
|
||||||
|
name: iface: "http://${mars.ip.address0}:${builtins.toString instances.${name}.ports.port0}";
|
||||||
services = [
|
services = [
|
||||||
instances.ollama.name
|
(svc instances.ollama.name "interface0")
|
||||||
instances.syncthing.name
|
(svc instances.syncthing.name "interface0")
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
@ -52,7 +69,7 @@ let
|
||||||
flatBookmarks = [
|
flatBookmarks = [
|
||||||
{
|
{
|
||||||
name = instances.web.label;
|
name = instances.web.label;
|
||||||
url = "http://${instances.web.localhost.address2}";
|
url = "http://${instances.web.addresses.address2}";
|
||||||
tags = instances.web.tags;
|
tags = instances.web.tags;
|
||||||
keyword = instances.web.label;
|
keyword = instances.web.label;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
{ flake, osConfig, ... }:
|
{ flake, ... }:
|
||||||
let
|
let
|
||||||
inherit (flake.config.services) instances;
|
inherit (flake.config.services) instances;
|
||||||
inherit (flake.config.machines) devices;
|
|
||||||
localhost = instances.web.localhost.address0;
|
|
||||||
hostname = osConfig.networking.hostName;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
"${instances.jellyfin.label}" = {
|
"${instances.jellyfin.label}" = {
|
||||||
|
|
@ -13,26 +10,26 @@ in
|
||||||
icon = ./icons/jf.png;
|
icon = ./icons/jf.png;
|
||||||
urls = [
|
urls = [
|
||||||
{
|
{
|
||||||
template = "https://${instances.jellyfin.subdomain}.${instances.web.domains.url0}/web/#/search.html?query={searchTerms}";
|
template = "https://${instances.jellyfin.interfaces.interface0.domain}/web/#/search.html?query={searchTerms}";
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
"${instances.searx.label}" = {
|
|
||||||
definedAliases = [
|
|
||||||
"@sx"
|
|
||||||
];
|
|
||||||
icon = ./icons/sx.png;
|
|
||||||
urls = [
|
|
||||||
{
|
|
||||||
template =
|
|
||||||
(
|
|
||||||
if hostname == devices.mars.name then
|
|
||||||
"http://${localhost}:${toString instances.searx.ports.port0}"
|
|
||||||
else
|
|
||||||
"https://${instances.searx.subdomain}.${instances.web.domains.url0}"
|
|
||||||
)
|
|
||||||
+ "/search?q={searchTerms}";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
# "${instances.searx.label}" = {
|
||||||
|
# definedAliases = [
|
||||||
|
# "@sx"
|
||||||
|
# ];
|
||||||
|
# icon = ./icons/sx.png;
|
||||||
|
# urls = [
|
||||||
|
# {
|
||||||
|
# template =
|
||||||
|
# (
|
||||||
|
# if hostname == devices.mars.name then
|
||||||
|
# "http://${localhost}:${toString instances.searx.ports.port0}"
|
||||||
|
# else
|
||||||
|
# "https://${instances.searx.subdomain}.${instances.web.domains.url0}"
|
||||||
|
# )
|
||||||
|
# + "/search?q={searchTerms}";
|
||||||
|
# }
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ let
|
||||||
web
|
web
|
||||||
;
|
;
|
||||||
service = ollama;
|
service = ollama;
|
||||||
localhost = web.localhost.address0;
|
localhost = web.addresses.address0;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
agent = {
|
agent = {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
{ flake, matchHelper, ... }:
|
{ flake, matchHelper, ... }:
|
||||||
let
|
let
|
||||||
inherit (flake.config.services.instances) forgejo mastodon web;
|
inherit (flake.config.services) instances;
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
(matchHelper ":dotfiles" "https://gitlab.com/upRootNutrition/dotfiles")
|
(matchHelper ":dotfiles" "https://gitlab.com/upRootNutrition/dotfiles")
|
||||||
(matchHelper ":website" "https://${web.domains.url1}")
|
(matchHelper ":website" "https://${instances.jellyfin.interfaces.interface0.domain}")
|
||||||
(matchHelper ":forgejo" "https://${forgejo.domains.url0}")
|
(matchHelper ":forgejo" "https://${instances.forgejo.interfaces.interface0.domain}")
|
||||||
(matchHelper ":mastodon" "https://${mastodon.domains.url0}")
|
(matchHelper ":mastodon" "https://${instances.mastodon.interfaces.interface0.domain}")
|
||||||
]
|
]
|
||||||
|
|
|
||||||
0
modules/nixos/homelab/caddy/config/forgejo/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/forgejo/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/jellyfin/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/jellyfin/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/mastodon/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/mastodon/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/photoprism/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/photoprism/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/qbittorrent/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/qbittorrent/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/syncthing/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/syncthing/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/website/default.nix
Normal file → Executable file
0
modules/nixos/homelab/caddy/config/website/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/firefly-iii/fireflyEris/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/firefly-iii/fireflyEris/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/forgejo/forgejoCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/forgejo/forgejoCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/jellyfin/jellyfinCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/jellyfin/jellyfinCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/linkpage/linkpageCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/linkpage/linkpageCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/mastodon/mastodonCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/mastodon/mastodonCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/opencloud/opencloudCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/opencloud/opencloudCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/opencloud/opencloudEris/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/opencloud/opencloudEris/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/qbittorrent/qbittorrentCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/qbittorrent/qbittorrentCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/vaultwarden/vaultwardenCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/vaultwarden/vaultwardenCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/website/websiteCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/website/websiteCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/zookeeper/zookeeperCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/guests/zookeeper/zookeeperCeres/default.nix
Normal file → Executable file
0
modules/nixos/homelab/helpers.nix
Normal file → Executable file
0
modules/nixos/homelab/helpers.nix
Normal file → Executable file
0
modules/nixos/homelab/nasDirs/default.nix
Normal file → Executable file
0
modules/nixos/homelab/nasDirs/default.nix
Normal file → Executable file
|
|
@ -8,19 +8,4 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = importList;
|
imports = importList;
|
||||||
|
|
||||||
services = {
|
|
||||||
samba = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
networking = {
|
|
||||||
firewall = {
|
|
||||||
allowedTCPPorts = [
|
|
||||||
445
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ in
|
||||||
# sudo smbpasswd -a username
|
# sudo smbpasswd -a username
|
||||||
services = {
|
services = {
|
||||||
samba = {
|
samba = {
|
||||||
|
enable = true;
|
||||||
# package = pkgs.samba4Full;
|
# package = pkgs.samba4Full;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ in
|
||||||
# sudo smbpasswd -a username
|
# sudo smbpasswd -a username
|
||||||
services = {
|
services = {
|
||||||
samba = {
|
samba = {
|
||||||
|
enable = true;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
settings = {
|
settings = {
|
||||||
"storage" = {
|
"storage" = {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (flake.config.machines) devices;
|
inherit (flake.config.machines) devices;
|
||||||
inherit (flake.config.services) instances;
|
|
||||||
hostname = config.networking.hostName;
|
hostname = config.networking.hostName;
|
||||||
dotPath = "~/projects/dotfiles";
|
dotPath = "~/projects/dotfiles";
|
||||||
mkLocalRebuild = ''
|
mkLocalRebuild = ''
|
||||||
|
|
@ -21,18 +20,6 @@ let
|
||||||
${name}:
|
${name}:
|
||||||
ssh ${ip}
|
ssh ${ip}
|
||||||
'';
|
'';
|
||||||
mkMicrVMSshCommands = name: ssh: ''
|
|
||||||
${name}:
|
|
||||||
ssh -p ${builtins.toString ssh} root@localhost
|
|
||||||
'';
|
|
||||||
balanceHosts = lib.concatStringsSep ", " [
|
|
||||||
''{name: "${devices.ceres.name}", ssh: "${devices.ceres.ip.address0}"}''
|
|
||||||
''{name: "${devices.eris.name}", ssh: "${devices.eris.ip.address0}"}''
|
|
||||||
''{name: "${devices.mars.name}", ssh: "${devices.mars.ip.address0}"}''
|
|
||||||
''{name: "${devices.deimos.name}", ssh: "${devices.deimos.ip.address0}"}''
|
|
||||||
''{name: "${devices.phobos.name}", ssh: "${devices.phobos.ip.address0}"}''
|
|
||||||
''{name: "${devices.lamdagibson.short}", ssh: "-o StrictHostKeyChecking=no denise@${devices.lamdagibson.ip.address0}"}''
|
|
||||||
];
|
|
||||||
systemRecords =
|
systemRecords =
|
||||||
command:
|
command:
|
||||||
lib.concatStrings [
|
lib.concatStrings [
|
||||||
|
|
@ -43,31 +30,14 @@ let
|
||||||
(command devices.phobos.name devices.phobos.ip.address0)
|
(command devices.phobos.name devices.phobos.ip.address0)
|
||||||
(command "lamba" "-o StrictHostKeyChecking=no denise@192.168.50.131")
|
(command "lamba" "-o StrictHostKeyChecking=no denise@192.168.50.131")
|
||||||
];
|
];
|
||||||
instanceRecords =
|
|
||||||
command:
|
|
||||||
lib.concatStrings [
|
|
||||||
(command instances.vaultwarden.name instances.vaultwarden.interface.ssh)
|
|
||||||
(command instances.jellyfin.name instances.jellyfin.interface.ssh)
|
|
||||||
(command instances.forgejo.name instances.forgejo.interface.ssh)
|
|
||||||
(command instances.firefly-iii.name instances.firefly-iii.interface.ssh)
|
|
||||||
(command instances.mastodon.name instances.mastodon.interface.ssh)
|
|
||||||
];
|
|
||||||
localRebuild = mkLocalRebuild;
|
localRebuild = mkLocalRebuild;
|
||||||
remoteRebuild = systemRecords mkRemoteRebuild;
|
remoteRebuild = systemRecords mkRemoteRebuild;
|
||||||
sshCommand = systemRecords mkSshCommands;
|
sshCommand = systemRecords mkSshCommands;
|
||||||
microVMSshCommand = instanceRecords mkMicrVMSshCommands;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
text = ''
|
text = ''
|
||||||
${localRebuild}
|
${localRebuild}
|
||||||
${remoteRebuild}
|
${remoteRebuild}
|
||||||
${sshCommand}
|
${sshCommand}
|
||||||
${microVMSshCommand}
|
|
||||||
balance:
|
|
||||||
#!/usr/bin/env nu
|
|
||||||
let results = [${balanceHosts}] | each { |h| let val = (^ssh ...($h.ssh | split row " ") 'nu -c "open /var/lib/defenseio-data/MidnightMiner/balances.json | get snapshots | last | get balance"' | into float); print $"($h.name):"; print $val; $val }
|
|
||||||
print "---"
|
|
||||||
print "total:"
|
|
||||||
$results | math sum
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,13 @@ in
|
||||||
22 # SSH
|
22 # SSH
|
||||||
25 # SMTP
|
25 # SMTP
|
||||||
139 # SMTP
|
139 # SMTP
|
||||||
|
445 # Samba
|
||||||
587 # SMTP
|
587 # SMTP
|
||||||
2525 # SMTP
|
2525 # SMTP
|
||||||
9999 # NC
|
9999 # NC
|
||||||
wireguardService.ports.port0 # WireGuard
|
wireguardService.ports.port0 # WireGuard
|
||||||
];
|
];
|
||||||
|
|
||||||
allowedUDPPorts = [
|
allowedUDPPorts = [
|
||||||
wireguardService.ports.port0 # WireGuard
|
wireguardService.ports.port0 # WireGuard
|
||||||
wireguardService.ports.port1 # WireGuard
|
wireguardService.ports.port1 # WireGuard
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ in
|
||||||
sops =
|
sops =
|
||||||
let
|
let
|
||||||
sopsPath = secret: {
|
sopsPath = secret: {
|
||||||
path = "${service.sops.path0}/${service.name}-${secret}";
|
# path = "${service.sops.path0}/${service.name}-${secret}";
|
||||||
owner = "root";
|
owner = "root";
|
||||||
mode = "600";
|
mode = "600";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue