test: setting up nas structure

This commit is contained in:
Nick 2025-12-08 22:25:13 -06:00
parent 8cd193ec49
commit 4225970826
747 changed files with 2938 additions and 4347 deletions

View file

@ -1,56 +0,0 @@
{
flake,
...
}:
let
inherit (flake.config.people) user0;
inherit (flake.config.people.users.${user0}) email;
inherit (flake.config.services) instances;
service = instances.acme;
dns0 = instances.web.dns.provider0;
dns1 = instances.web.dns.provider1;
in
{
security.acme = {
acceptTerms = true;
defaults = {
email = email.address0;
server = "https://acme-v02.api.letsencrypt.org/directory";
};
};
sops =
let
dnsList = [
dns0
dns1
];
secretList = [
"pass"
];
sopsPath = secret: dns: {
path = "/var/lib/secrets/${instances.acme.name}/${dns}-${secret}";
owner = "root";
mode = "600";
};
in
{
secrets = builtins.listToAttrs (
builtins.concatLists (
map (
dns:
map (secret: {
name = "dns/${dns}";
value = sopsPath secret dns;
}) secretList
) dnsList
)
);
};
systemd = {
tmpfiles.rules = [
"Z ${service.sops.path0} 755 ${service.name} ${service.name} -"
];
};
}

View file

@ -1,42 +0,0 @@
{ flake, config, ... }:
let
inherit (flake.config.services) instances;
inherit (flake.config.machines.devices) eris;
opencloud = instances.opencloud0;
dns = instances.web.dns.provider0;
opencloudHost = opencloud.domains.url0;
dnsPath = "dns/${dns}";
service = instances.caddy;
in
{
services.caddy = {
enable = true;
virtualHosts = {
"${opencloud.domains.url0}" = {
extraConfig = ''
reverse_proxy ${opencloud.interface.ip}:${toString opencloud.ports.port0} {
header_up X-Real-IP {remote_host}
}
redir /.well-known/carddav /remote.php/dav/ 301
redir /.well-known/caldav /remote.php/dav/ 301
tls ${opencloud.ssl.cert} ${opencloud.ssl.key}
'';
};
};
};
security.acme.certs."${opencloudHost}" = {
dnsProvider = dns;
environmentFile = config.sops.secrets.${dnsPath}.path;
group = "caddy";
};
networking = {
firewall = {
allowedTCPPorts = [
service.ports.port0 # 80
service.ports.port1 # 443
];
};
};
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

View file

@ -1,7 +0,0 @@
{
hide-footer = true;
# logo-url = "/assets/logo.png";
# app-name = "My Dashboard";
# favicon-url = "/assets/logo.png";
# app-icon-url = "/assets/logo.png";
}

View file

@ -1,50 +0,0 @@
{ config, flake, ... }:
let
widgetsPath = ./widgets;
widgets = {
jellyfin = import (widgetsPath + /jelly) { inherit config flake; };
steam = import (widgetsPath + /steam);
podcasts = import (widgetsPath + /podcasts.nix);
calendar = import (widgetsPath + /calendar.nix);
clock = import (widgetsPath + /clock.nix);
weather = import (widgetsPath + /weather.nix);
reddit = import (widgetsPath + /reddit.nix);
videos = import (widgetsPath + /videos.nix);
repos = import (widgetsPath + /repos.nix);
};
in
[
{
columns = [
{
size = "full";
widgets = [
{
type = "group";
widgets = [
widgets.podcasts
widgets.videos
];
}
widgets.reddit
];
}
{
size = "small";
widgets = [
widgets.steam
widgets.repos
];
}
{
size = "small";
widgets = [
widgets.calendar
widgets.weather
widgets.clock
];
}
];
name = "Dashboard";
}
]

View file

@ -1,16 +0,0 @@
{ flake, configHelpers, ... }:
let
inherit (flake.config.people) user0;
inherit (flake.config.machines.devices) ceres;
in
{
assets-path = "/home/${user0}/projects/dotfiles/modules/nixos/services/glance/assets";
# host = configHelpers.host;
# host = configHelpers.localhost;
host = ceres.wireguard.ip0;
port = configHelpers.service.ports.port0;
# auth = {
# secret-key = config.sops.secrets."${service.name}/key".path;
# users.${user0}.password = config.sops.secrets."${service.name}-${user0}-pass".path;
# };
}

View file

@ -1,7 +0,0 @@
{
background-color = "232 23 18";
contrast-multiplier = 1.2;
primary-color = "220 83 75";
positive-color = "105 48 72";
negative-color = "351 74 73";
}

View file

@ -1,5 +0,0 @@
{
type = "calendar";
title = "Calendar";
style = "vertical-cards";
}

View file

@ -1,22 +0,0 @@
{
type = "clock";
hour-format = "12h";
timezones = [
{
timezone = "America/Winnipeg";
label = "Winnipeg, MB";
}
{
timezone = "Europe/Berlin";
label = "Berlin, DE";
}
{
timezone = "Asia/Kolkata";
label = "Kolkata, IN";
}
{
timezone = "Asia/Tokyo";
label = "Tokyo, JP";
}
];
}

View file

@ -1,326 +0,0 @@
''
{{ $mediaServer := .Options.StringOr "media-server" "" }}
{{ $baseURL := .Options.StringOr "base-url" "" }}
{{ $apiKey := .Options.StringOr "api-key" "" }}
{{ $userName := .Options.StringOr "user-name" "" }}
{{ define "errorMsg" }}
<div class="widget-error-header">
<div class="color-negative size-h3">ERROR</div>
<svg class="widget-error-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"></path>
</svg>
</div>
<p class="break-all">{{ . }}</p>
{{ end }}
{{ if or
(eq $mediaServer "")
(eq $baseURL "")
(eq $apiKey "")
(and (eq $mediaServer "jellyfin") (eq $userName ""))
}}
{{ template "errorMsg" "Some required options are not set" }}
{{ else }}
{{ $historyLength := .Options.StringOr "history-length" "10" }}
{{ $mediaTypes := .Options.StringOr "media-types" "" }}
{{ if eq $mediaServer "tautulli" }}
{{ $mediaTypes = .Options.StringOr "media-types" "movie,episode,track" }}
{{ else if or (eq $mediaServer "jellyfin") (eq $mediaServer "emby") }}
{{ $mediaTypes = .Options.StringOr "media-types" "Movie,Episode,Audio" }}
{{ end }}
{{ $isSmallColumn := .Options.BoolOr "small-column" false }}
{{ $isCompact := .Options.BoolOr "compact" true }}
{{ $showThumbnail := .Options.BoolOr "show-thumbnail" false }}
{{ $thumbAspectRatio := .Options.StringOr "thumbnail-aspect-ratio" "" }}
{{ $showUser := .Options.BoolOr "show-user" true }}
{{ $timeAbsolute := .Options.BoolOr "time-absolute" false }}
{{ $timeFormat := .Options.StringOr "time-format" "Jan 02 15:04" }}
{{ $userID := "" }}
{{ $historyRequestURL := "" }}
{{ $usersRequestURL := "" }}
{{ $historyCall := "" }}
{{ $usersCall := "" }}
{{ $history := "" }}
{{ $users := "" }}
{{ if eq $mediaServer "plex" }}
{{ $historyRequestURL = concat $baseURL "/status/sessions/history/all" }}
{{ $historyCall = newRequest $historyRequestURL
| withParameter "limit" $historyLength
| withParameter "sort" "viewedAt:desc"
| withHeader "Accept" "application/json"
| withHeader "X-Plex-Token" $apiKey
| getResponse }}
{{ if $historyCall.JSON.Exists "MediaContainer" }}
{{ $history = $historyCall.JSON.Array "MediaContainer.Metadata" }}
{{ else }}
{{ template "errorMsg" (concat "Could not fetch " $mediaServer " API.") }}
{{ end }}
{{ $usersRequestURL = concat $baseURL "/accounts" }}
{{ $usersCall = newRequest $usersRequestURL
| withHeader "Accept" "application/json"
| withHeader "X-Plex-Token" $apiKey
| getResponse }}
{{ $users = $usersCall.JSON.Array "MediaContainer.Account" }}
{{ else if eq $mediaServer "tautulli" }}
{{ $historyRequestURL = concat $baseURL "/api/v2" }}
{{ $historyCall = newRequest $historyRequestURL
| withParameter "apikey" $apiKey
| withParameter "cmd" "get_history"
| withParameter "length" $historyLength
| withParameter "media_type" $mediaTypes
| withHeader "Accept" "application/json"
| getResponse }}
{{ if eq $historyCall.Response.StatusCode 200 }}
{{ $history = $historyCall.JSON.Array "response.data.data" }}
{{ else }}
{{ template "errorMsg" (concat "Could not fetch " $mediaServer " API.") }}
{{ end }}
{{ else if or (eq $mediaServer "jellyfin") (eq $mediaServer "emby") }}
{{ $usersRequestURL = concat $baseURL "/Users" }}
{{ $usersCall = newRequest $usersRequestURL
| withParameter "api_key" $apiKey
| withHeader "Accept" "application/json"
| getResponse }}
{{ $usersList := $usersCall.JSON.Array "" }}
{{ range $i, $user := $usersList }}
{{ if eq ($user.String "Name") $userName }}
{{ $userID = $user.String "Id" }}
{{ break }}
{{ end }}
{{ end }}
{{ if eq $userID "" }}
{{ template "errorMsg" (concat "User '" $userName "' not found.") }}
{{ end }}
{{ $historyRequestURL = concat $baseURL "/Users/" $userID "/Items" }}
{{ $historyCall = newRequest $historyRequestURL
| withParameter "api_key" $apiKey
| withParameter "Limit" $historyLength
| withParameter "IncludeItemTypes" $mediaTypes
| withParameter "Recursive" "true"
| withParameter "isPlayed" "true"
| withParameter "sortBy" "DatePlayed"
| withParameter "sortOrder" "Descending"
| withParameter "Fields" "UserDataLastPlayedDate"
| withHeader "Accept" "application/json"
| getResponse }}
{{ $history = $historyCall.JSON.Array "Items" }}
{{ end }}
{{ if and (eq $historyCall.Response.StatusCode 200) (eq (len $history) 0) }}
<p>Nothing has been played. Start streaming something!</p>
{{ else }}
<div class="carousel-container show-right-cutoff">
<div class="cards-horizontal carousel-items-container">
{{ range $n, $item := $history }}
{{ $mediaType := "" }}
{{ $isMovie := false }}
{{ $isShows := false }}
{{ $isMusic := false }}
{{ $title := "" }}
{{ $showTitle := "" }}
{{ $showSeason := "" }}
{{ $showEpisode := "" }}
{{ $artist := "" }}
{{ $albumTitle := "" }}
{{ $thumbURL := "" }}
{{ $playedAt := "" }}
{{ if eq $mediaServer "plex" }}
{{ $userID = $item.Int "accountID" }}
{{ range $n, $u := $users }}
{{ if eq $userID ($u.Int "id") }}
{{ $userName = $u.String "name" }}
{{ break }}
{{ end }}
{{ end }}
{{ $mediaType = $item.String "type" }}
{{ $isMovie = eq $mediaType "movie" }}
{{ $isShows = eq $mediaType "episode" }}
{{ $isMusic = eq $mediaType "track" }}
{{ $title = $item.String "title" }}
{{ if $isShows }}
{{ $showTitle = $item.String "grandparentTitle" }}
{{ $showSeason = $item.String "parentIndex" }}
{{ $showEpisode = $item.String "index" }}
{{ else if $isMusic }}
{{ $artist = $item.String "grandparentTitle" }}
{{ $albumTitle = $item.String "parentTitle" }}
{{ end }}
{{ $thumbID := $item.String "thumb" }}
{{ if or $isShows $isMusic}}
{{ $thumbID = $item.String "parentThumb" }}
{{ end }}
{{ $thumbURL = concat $baseURL $thumbID "?X-Plex-Token=" $apiKey }}
{{ $time := $item.String "viewedAt" }}
{{ if $timeAbsolute }}
{{ $playedAt = $time | parseLocalTime "unix" | formatTime $timeFormat }}
{{ else }}
{{ $playedAt = $time | parseRelativeTime "unix" }}
{{ end }}
{{ else if eq $mediaServer "tautulli" }}
{{ $userName = $item.String "user" }}
{{ $mediaType = $item.String "media_type" }}
{{ $isMovie = eq $mediaType "movie" }}
{{ $isShows = eq $mediaType "episode" }}
{{ $isMusic = eq $mediaType "track" }}
{{ $title = $item.String "title" }}
{{ if $isShows }}
{{ $showTitle = $item.String "grandparent_title" }}
{{ $showSeason = $item.String "parent_media_index" }}
{{ $showEpisode = $item.String "media_index" }}
{{ else if $isMusic }}
{{ $artist = $item.String "grandparent_title" }}
{{ $albumTitle = $item.String "parent_title" }}
{{ end }}
{{ $thumbID := $item.String "thumb" }}
{{ $thumbURL = concat $baseURL "/api/v2?apikey=" $apiKey "&cmd=pms_image_proxy&img=" $thumbID }}
{{ $time := $item.String "date" }}
{{ if $timeAbsolute }}
{{ $playedAt = $time | parseLocalTime "unix" | formatTime $timeFormat }}
{{ else }}
{{ $playedAt = $time | parseRelativeTime "unix" }}
{{ end }}
{{ else if or (eq $mediaServer "jellyfin") (eq $mediaServer "emby") }}
{{ $mediaType = $item.String "Type" }}
{{ $isMovie = eq $mediaType "Movie" }}
{{ $isShows = eq $mediaType "Episode" }}
{{ $isMusic = eq $mediaType "Audio" }}
{{ $title = $item.String "Name" }}
{{ if $isShows }}
{{ $showTitle = $item.String "SeriesName" }}
{{ $showSeason = $item.String "ParentIndexNumber" }}
{{ $showEpisode = $item.String "IndexNumber" }}
{{ else if $isMusic }}
{{ $artist = $item.String "AlbumArtist" }}
{{ $albumTitle = $item.String "Album" }}
{{ end }}
{{ $thumbID := $item.String "Id" }}
{{ if $isShows }}
{{ $thumbID = $item.String "SeasonId" }}
{{ end }}
{{ $thumbURL = concat $baseURL "/Items/" $thumbID "/Images/Primary?api_key=" $apiKey }}
{{ $time := $item.String "UserData.LastPlayedDate" }}
{{ if $timeAbsolute }}
{{ $playedAt = $time | parseLocalTime "rfc3339" | formatTime $timeFormat }}
{{ else }}
{{ $playedAt = $time | parseRelativeTime "rfc3339" }}
{{ end }}
{{ end }}
{{ $showInfoFormat := concat "Season " $showSeason " Episode " $showEpisode}}
{{ if $isCompact }}
{{ $showInfoFormat = concat "S" $showSeason "E" $showEpisode}}
{{ end }}
<div class="card widget-content-frame">
{{ if $showThumbnail }}
<img src="{{ $thumbURL | safeURL }}"
alt="{{ $title }} thumbnail"
loading="lazy"
class="media-server-thumbnail shrink-0"
style="
object-fit: cover;
border-radius: var(--border-radius) var(--border-radius) 0 0;
{{ if eq $thumbAspectRatio "square" }}
aspect-ratio: 1;
{{ else if eq $thumbAspectRatio "portrait" }}
aspect-ratio: 3/4;
{{ else if eq $thumbAspectRatio "landscape" }}
aspect-ratio: 4/3;
{{ else }}
aspect-ratio: initial;
{{ end }}
"
/>
{{ end }}
<div class="grow padding-inline-widget margin-top-10 margin-bottom-10">
<ul class="flex flex-column justify-evenly margin-bottom-3 {{if $isSmallColumn}}size-h6{{end}}" style="height: 100%;">
{{ if $isCompact }}
<ul class="list-horizontal-text flex-nowrap">
{{ if $showUser }}
<li class="color-primary text-truncate">{{ $userName }}</li>
{{ end }}
{{ if $timeAbsolute }}
<li class="text-truncate">{{ $playedAt }}</li>
{{ else }}
<li class="shrink-0">
<span {{ $playedAt }}></span>
{{ if not $showUser }}
<span> ago</span>
{{ end }}
</li>
{{ end }}
</ul>
{{ if $isShows }}
<ul class="list-horizontal-text flex-nowrap">
<li class="text-truncate">{{ $showInfoFormat }}</li>
<li class="text-truncate">{{ $showTitle }}</li>
</ul>
{{ else if $isMusic }}
<ul class="list-horizontal-text flex-nowrap">
<li class="text-truncate">{{ $artist }}</li>
<li class="text-truncate">{{ $albumTitle }}</li>
</ul>
{{ end }}
<li class="text-truncate">{{ $title }}</li>
{{ else }}
{{ if $showUser }}
<li class="color-primary text-truncate">{{ $userName }}</li>
{{ end }}
{{ if $timeAbsolute }}
<li class="text-truncate">{{ $playedAt }}</li>
{{ else }}
<li class="text-truncate">
<span {{ $playedAt }}></span>
<span> ago</span>
</li>
{{ end }}
{{ if $isShows }}
<li class="text-truncate">{{ $showTitle }}</li>
<li class="text-truncate">{{ $showInfoFormat }}</li>
{{ else if $isMusic }}
<li class="text-truncate">{{ $artist }}</li>
<li class="text-truncate">{{ $albumTitle }}</li>
{{ end }}
<li class="text-truncate">{{ $title }}</li>
{{ end }}
</ul>
</div>
</div>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
''

View file

@ -1,30 +0,0 @@
{ config, flake, ... }:
let
inherit (flake.config.people) user0;
inherit (flake.config.people.users.${user0}) name;
inherit (flake.config.services.instances) glance jellyfin web;
service = glance;
jellyfinUserName = name;
jellyfinHost = "https://${jellyfin.subdomain}.${web.domains.url0}";
in
{
type = "custom-api";
title = "Jellyfin History";
frameless = true;
cache = "5m";
options = {
media-server = "jellyfin";
base-url = jellyfinHost;
api-key = config.sops.secrets."${service.name}-${jellyfin.name}".path;
user-name = jellyfinUserName;
history-length = "10";
small-column = true;
compact = true;
show-thumbnail = false;
thumbnail-aspect-ratio = "default";
show-user = true;
time-absolute = false;
time-format = "Jan 02 15:04";
};
template = import ./config;
}

View file

@ -1,6 +0,0 @@
{
type = "monitor";
cache = "1m";
title = "Services";
}

View file

@ -1,22 +0,0 @@
let
podcastHelper = url: title: {
url = url;
title = title;
hide-description = true;
hide-categories = true;
};
podcastData = [
(podcastHelper "https://sigmanutrition.libsyn.com/rss/" "Sigma Nutrition Radio")
(podcastHelper "https://wakingup.libsyn.com/rss" "Making Sense with Sam Harris")
(podcastHelper "https://feeds.simplecast.com/uNKL_XD_" "Docs Who Lift")
(podcastHelper "https://feeds.redcircle.com/677da6c9-d33f-49df-95d7-dc8821b797b4" "Mayo Clinic on Nutrition")
];
podcastEntries = builtins.map (podcast: podcast) podcastData;
in
{
type = "rss";
title = "Podcasts";
style = "detailed-list";
collapse-after = 3;
feeds = podcastEntries;
}

View file

@ -1,21 +0,0 @@
let
subList = [
"privacy"
"selfhosted"
"vegan"
];
subredditEntries = builtins.map (sub: {
type = "reddit";
subreddit = sub;
collapse-after = 5;
show-thumbnails = true;
sort-by = "top";
top-period = "day";
}) subList;
in
{
type = "group";
widgets = subredditEntries;
}

View file

@ -1,15 +0,0 @@
{
type = "releases";
show-source-icon = true;
collapse-after = 7;
repositories = [
"jmshrv/finamp"
"futo-org/android-keyboard"
"hyprwm/Hyprland"
"mollyim/mollyim-android"
"jarnedemeulemeester/findroid"
"brandonp2412/Flexify"
"accrescent/accrescent"
"ImranR98/Obtainium"
];
}

View file

@ -1,14 +0,0 @@
''
<ul class="list list-gap-10 collapsible-container" data-collapse-after="5">
{{ range .JSON.Array "specials.items" }}
<li>
<a class="size-h4 color-highlight block text-truncate" href="https://store.steampowered.com/app/{{ .Int "id" }}/">{{ .String "name" }}</a>
<ul class="list-horizontal-text">
<li>{{ .Int "final_price" | toFloat | mul 0.01 | printf "$%.2f" }}</li>
{{ $discount := .Int "discount_percent" }}
<li{{ if ge $discount 1 }} class="color-positive"{{ end }}>{{ $discount }}% off</li>
</ul>
</li>
{{ end }}
</ul>
''

View file

@ -1,7 +0,0 @@
{
type = "custom-api";
title = "Steam Specials";
cache = "12h";
url = "https://store.steampowered.com/api/featuredcategories?cc=ca";
template = import ./config;
}

View file

@ -1,14 +0,0 @@
{
type = "videos";
style = "vertical-list";
collapse-after = 6;
channels = [
"UCfQgsKhHjSyRLOp9mnffqVg"
"UCld68syR8Wi-GY_n4CaoJGA"
"UChIs72whgZI9w6d6FhwGGHA"
"UCes5DW7sk9WU8oqE9HGJdpg"
"UCOksmJqNzaYLhplfs7Sl8cA"
"UCQNmHyGAKqzOT_JsVEs4eag"
"UCd8rTrNRM6DYR4TXgSqNw8g"
];
}

View file

@ -1,7 +0,0 @@
{
type = "weather";
title = "Weather";
units = "metric";
hour-format = "12h";
location = "Winnipeg, Manitoba, Canada";
}

View file

@ -1,82 +0,0 @@
{ config, flake, ... }:
let
inherit (flake.config.services.instances)
glance
jellyfin
web
;
inherit (flake.config.machines.devices) ceres mars deimos;
configHelpers = {
service = glance;
hostname = config.networking.hostName;
localhost = web.localhost.address1;
host = configHelpers.service.domains.url0;
};
configPath = ./config;
configImports = {
server = import (configPath + /server.nix) { inherit flake configHelpers; };
branding = import (configPath + /branding.nix);
theme = import (configPath + /theme.nix);
pages = import (configPath + /pages.nix) { inherit config flake; };
};
in
{
services = {
glance = {
enable = true;
settings = configImports;
};
caddy = {
virtualHosts = {
"${configHelpers.host}" = {
extraConfig = ''
@allowed_ips {
remote_ip ${mars.wireguard.ip0} ${deimos.wireguard.ip0}
}
handle @allowed_ips {
redir /.well-known/carddav /remote.php/dav/ 301
redir /.well-known/caldav /remote.php/dav/ 301
reverse_proxy ${ceres.wireguard.ip0}:${toString configHelpers.service.ports.port0}
}
handle {
respond "Access Denied" 403
}
tls ${configHelpers.service.ssl.cert} ${configHelpers.service.ssl.key}
'';
};
};
};
};
sops =
let
sopsPath = secret: {
path = "/run/secrets/${configHelpers.service.name}-${secret}";
owner = "root";
group = "root";
mode = "644";
};
in
{
secrets = builtins.listToAttrs (
map
(secret: {
name = "${configHelpers.service.name}/${secret}";
value = sopsPath secret;
})
[
# "key"
# "${user0}-pass"
jellyfin.name
]
);
};
networking = {
firewall = {
interfaces.wg0.allowedTCPPorts = [
configHelpers.service.ports.port0
];
};
};
}

View file

@ -1,11 +0,0 @@
let
importList =
let
content = builtins.readDir ./.;
dirContent = builtins.filter (n: content.${n} == "directory") (builtins.attrNames content);
in
map (name: ./. + "/${name}") dirContent;
in
{
imports = importList;
}

View file

@ -1,75 +0,0 @@
{
flake,
...
}:
let
inherit (flake.config.machines.devices)
ceres
;
inherit (flake.config.services.instances)
ollama
web
;
service = ollama;
localhost = web.localhost.address0;
host = service.domains.url0;
in
{
services = {
ollama = {
enable = true;
group = service.name;
host = "http://${localhost}";
user = service.name;
port = service.ports.port1;
acceleration = "cuda";
models = service.paths.path0;
};
open-webui = {
enable = true;
host = localhost;
port = service.ports.port0;
environment = {
ENABLE_OLLAMA_API = "True";
ANONYMIZED_TELEMETRY = "False";
DO_NOT_TRACK = "True";
SCARF_NO_ANALYTICS = "True";
OLLAMA_BASE_URL = "http://${localhost}:${toString service.ports.port1}";
WEBUI_AUTH = "True";
};
};
caddy = {
virtualHosts = {
${host} = {
extraConfig = ''
reverse_proxy ${localhost}:${toString service.ports.port0}
tls ${service.ssl.cert} ${service.ssl.key}
'';
};
};
};
};
systemd.tmpfiles.rules = [
"Z ${service.paths.path0} 0755 ${service.name} ${service.name} -"
];
networking = {
firewall = {
allowedTCPPorts = [
service.ports.port0
service.ports.port1
];
};
};
fileSystems = {
"/var/lib/${service.name}" = {
device = service.paths.path0;
fsType = "none";
options = [
"bind"
];
depends = [
ceres.storage0.mount
];
};
};
}

View file

@ -1,47 +0,0 @@
{
flake,
...
}:
let
inherit (flake.config.services.instances)
ollama
web
;
service = ollama;
localhost = web.localhost.address1;
in
{
services = {
ollama = {
enable = true;
group = service.name;
host = "http://${localhost}";
user = service.name;
acceleration = "rocm";
};
open-webui = {
enable = true;
host = localhost;
port = service.ports.port0;
environment = {
ENABLE_OLLAMA_API = "True";
ANONYMIZED_TELEMETRY = "False";
DO_NOT_TRACK = "True";
SCARF_NO_ANALYTICS = "True";
OLLAMA_BASE_URL = "http://${localhost}:${toString service.ports.port1}";
WEBUI_AUTH = "True";
};
};
};
systemd.tmpfiles.rules = [
"Z ${service.paths.path1} 0777 ${service.name} ${service.name} -"
];
networking = {
firewall = {
allowedTCPPorts = [
service.ports.port0
service.ports.port1
];
};
};
}

View file

@ -1,151 +0,0 @@
{
flake,
config,
pkgs,
...
}:
let
inherit (flake.config.machines.devices)
ceres
;
inherit (flake.config.services.instances)
caddy
peertube
smtp
web
;
service = peertube;
localhost = web.localhost.address0;
host = service.domains.url0;
in
{
services = {
peertube = {
configureNginx = false;
enable = true;
enableWebHttps = true;
group = service.name;
listenWeb = caddy.ports.port1;
listenHttp = service.ports.port0;
localDomain = host;
serviceEnvironmentFile = config.sops.secrets."${service.name}/root".path;
user = service.name;
plugins = {
enable = true;
plugins = builtins.attrValues {
inherit (pkgs)
peertube-plugin-livechat
peertube-plugin-matomo
peertube-plugin-transcoding-custom-quality
peertube-theme-dark
;
};
};
secrets = {
secretsFile = config.sops.secrets."${service.name}/secret".path;
};
settings = {
instance = {
name = "upRootNutrition";
};
log = {
level = "debug";
};
smtp = {
transport = smtp.name;
disable_starttls = false;
from_address = service.email.address1;
hostname = smtp.hostname;
port = smtp.ports.port1;
username = smtp.email.address1;
tls = false;
};
};
database = {
createLocally = true;
passwordFile = config.sops.secrets."${service.name}/database".path;
};
redis = {
enableUnixSocket = true;
createLocally = true;
passwordFile = config.sops.secrets."${service.name}/redis".path;
};
smtp = {
createLocally = true;
passwordFile = config.sops.secrets."${service.name}/smtp".path;
};
};
caddy = {
virtualHosts = {
${host} = {
extraConfig = ''
reverse_proxy ${localhost}:${toString service.ports.port0}
tls ${service.ssl.cert} ${service.ssl.key}
'';
};
};
};
};
sops =
let
sopsPath = secret: {
path = "${service.sops.path0}/${service.name}/${secret}";
owner = service.name;
mode = "600";
};
in
{
secrets = builtins.listToAttrs (
map
(secret: {
name = "${service.name}/${secret}";
value = sopsPath secret;
})
[
"database"
"redis"
"root"
"secret"
"smtp"
]
);
};
fileSystems."/var/lib/${service.name}" = {
device = service.paths.path0;
fsType = "none";
options = [
"bind"
];
depends = [
ceres.storage0.mount
];
};
systemd.tmpfiles.rules = [
"Z ${service.paths.path0} 755 ${service.name} ${service.name} -"
"Z ${service.sops.path0} 755 ${service.name} ${service.name} -"
];
users.users.${service.name}.extraGroups = [
"nginx"
"caddy"
];
networking = {
firewall = {
allowedTCPPorts = [
service.ports.port0
service.ports.port1
service.ports.port2
service.ports.port3
service.ports.port4
];
};
};
}

View file

@ -1,65 +0,0 @@
{
config,
flake,
...
}:
let
inherit (flake.config.services) instances;
inherit (flake.config.people) user0;
envFile = "backblaze/env";
repoFile = "backblaze/repo";
passFile = "restic/pass";
in
{
services.restic = {
backups = {
remote = {
environmentFile = config.sops.secrets.${envFile}.path;
initialize = true;
passwordFile = config.sops.secrets.${passFile}.path;
repositoryFile = config.sops.secrets.${repoFile}.path;
timerConfig = {
OnCalendar = "0/4:00";
Persistent = true;
};
paths =
let
inst = instance: instances.${instance}.mntPaths.path0;
in
[
"/home/${user0}/.ssh"
(inst "firefly-iii")
(inst "forgejo")
(inst "mastodon")
(inst "opencloud1")
(inst "minecraft0")
(inst "minecraft1")
(inst "vaultwarden")
((inst "jellyfin") + "/cache")
((inst "jellyfin") + "/data")
((inst "jellyfin") + "/media/music")
];
};
};
};
sops = {
secrets = builtins.listToAttrs (
map
(secret: {
name = secret;
value = {
path = "/run/secrets/${secret}";
owner = "root";
group = "root";
mode = "0600";
};
})
[
envFile
repoFile
passFile
]
);
};
}

View file

@ -1,11 +0,0 @@
let
importList =
let
content = builtins.readDir ./.;
dirContent = builtins.filter (n: content.${n} == "directory") (builtins.attrNames content);
in
map (name: ./. + "/${name}") dirContent;
in
{
imports = importList;
}

View file

@ -1,57 +0,0 @@
{
flake,
...
}:
let
inherit (flake.config.services) instances;
inherit (flake.config.people) user0;
service = instances.samba;
jellyfin = instances.jellyfin;
in
{
# If you ever need to start fresh, you need to add yourself to the Samba users database:
# sudo smbpasswd -a username
services = {
samba = {
# package = pkgs.samba4Full;
enable = true;
openFirewall = true;
settings = {
"storage" = {
path = "/mnt/storage/${instances.jellyfin.name}/media";
browseable = "yes";
writeable = "yes";
"guest ok" = "no";
"create mask" = "0664";
"directory mask" = "0775";
"force user" = jellyfin.name;
"force group" = jellyfin.name;
"force create mode" = "0664";
"force directory mode" = "0775";
};
"transfer" = {
path = "/mnt/transfer";
browseable = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0664";
"directory mask" = "0775";
"force user" = user0;
"force group" = "users";
};
};
};
};
systemd.tmpfiles.rules = [
"d /mnt/transfer 2775 ${user0} users -"
];
networking = {
firewall = {
allowedTCPPorts = [
service.ports.port0
];
};
};
}

View file

@ -1,38 +0,0 @@
{
flake,
...
}:
let
inherit (flake.config.services) instances;
inherit (flake.config.people) user0;
service = instances.samba;
in
{
# If you ever need to start fresh, you need to add yourself to the Samba users database:
# sudo smbpasswd -a username
services = {
samba = {
enable = true;
openFirewall = true;
settings = {
"storage" = {
path = "/mnt/storage";
writable = "yes";
"valid users" = user0;
"force user" = user0;
"force group" = "users";
"create mask" = "0644";
"directory mask" = "0755";
};
};
};
};
networking = {
firewall = {
allowedTCPPorts = [
service.ports.port0
];
};
};
}

View file

@ -1,65 +0,0 @@
{ lib, ... }:
lib.mapAttrsToList (name: value: { inherit name; } // value) {
"duckduckgo".disabled = false;
"brave".disabled = false;
"bing".disabled = false;
"mojeek".disabled = true;
"mwmbl".disabled = false;
"mwmbl".weight = 0.4;
"qwant".disabled = true;
"crowdview".disabled = false;
"crowdview".weight = 0.5;
"curlie".disabled = true;
"ddg definitions".disabled = false;
"ddg definitions".weight = 2;
"wikibooks".disabled = false;
"wikidata".disabled = false;
"wikiquote".disabled = true;
"wikisource".disabled = true;
"wikispecies".disabled = false;
"wikispecies".weight = 0.5;
"wikiversity".disabled = false;
"wikiversity".weight = 0.5;
"wikivoyage".disabled = false;
"wikivoyage".weight = 0.5;
"currency".disabled = true;
"dictzone".disabled = true;
"lingva".disabled = true;
"bing images".disabled = false;
"brave.images".disabled = false;
"duckduckgo images".disabled = false;
"google images".disabled = false;
"qwant images".disabled = true;
"1x".disabled = true;
"artic".disabled = false;
"deviantart".disabled = false;
"flickr".disabled = true;
"imgur".disabled = false;
"library of congress".disabled = false;
"material icons".disabled = true;
"material icons".weight = 0.2;
"openverse".disabled = false;
"pinterest".disabled = true;
"svgrepo".disabled = false;
"unsplash".disabled = false;
"wallhaven".disabled = false;
"wikicommons.images".disabled = false;
"yacy images".disabled = true;
"bing videos".disabled = false;
"brave.videos".disabled = true;
"duckduckgo videos".disabled = true;
"google videos".disabled = false;
"qwant videos".disabled = false;
"dailymotion".disabled = true;
"google play movies".disabled = true;
"invidious".disabled = true;
"odysee".disabled = true;
"peertube".disabled = true;
"piped".disabled = true;
"rumble".disabled = false;
"sepiasearch".disabled = false;
"vimeo".disabled = true;
"youtube".disabled = false;
"brave.news".disabled = true;
"google news".disabled = true;
}

View file

@ -1,8 +0,0 @@
{
debug = false;
instance_name = "SearXNG Instance";
donation_url = false;
contact_url = false;
privacypolicy_url = false;
enable_metrics = false;
}

View file

@ -1,7 +0,0 @@
{
request_timeout = 5.0;
max_request_timeout = 15.0;
pool_connections = 100;
pool_maxsize = 15;
enable_http2 = true;
}

View file

@ -1,9 +0,0 @@
[
"Basic Calculator"
"Hash plugin"
"Tor check plugin"
"Open Access DOI rewrite"
"Hostnames plugin"
"Unit converter plugin"
"Tracker URL remover"
]

View file

@ -1,7 +0,0 @@
{
safe_search = 0;
autocomplete_min = 2;
autocomplete = "duckduckgo";
ban_time_on_fail = 5;
max_ban_time_on_fail = 120;
}

View file

@ -1,27 +0,0 @@
{
flake,
config,
configHelpers,
...
}:
let
inherit (flake.config.machines.devices) ceres;
in
{
port = configHelpers.service.ports.port0;
bind_address =
if configHelpers.hostname == ceres.name then ceres.wireguard.ip0 else configHelpers.localhost;
secret_key = config.sops.secrets."searx/key".path;
limiter = false;
public_instance = false;
image_proxy = true;
method = "GET";
}
// (
if configHelpers.hostname == ceres.name then
{
base_url = "https://${configHelpers.host}";
}
else
{ }
)

View file

@ -1,11 +0,0 @@
{
static_use_hash = true;
default_locale = "en";
query_in_title = true;
infinite_scroll = true;
center_alignment = true;
default_theme = "simple";
theme_args.simple_style = "auto";
search_on_category_select = true;
hotkeys = "vim";
}

View file

@ -1,101 +0,0 @@
{
flake,
lib,
config,
...
}:
let
inherit (flake.config.machines.devices) ceres mars deimos;
inherit (flake.config.services.instances) searx web;
configHelpers = {
service = searx;
hostname = config.networking.hostName;
localhost = web.localhost.address0;
host = configHelpers.service.domains.url0;
};
configPath = ./config;
configImports = {
general = import (configPath + /general.nix);
ui = import (configPath + /ui.nix);
search = import (configPath + /search.nix);
server = import (configPath + /server.nix) { inherit config flake configHelpers; };
engines = import (configPath + /engines.nix) { inherit lib; };
outgoing = import (configPath + /outgoing.nix);
enabled_plugins = import (configPath + /plugins.nix);
};
in
{
services = {
searx = {
enable = true;
redisCreateLocally = true;
uwsgiConfig = {
socket = "/run/searx/searx.sock";
http = ":${builtins.toString configHelpers.service.ports.port0}";
chmod-socket = "660";
};
settings = configImports;
};
}
// (
if configHelpers.hostname == ceres.name then
{
caddy = {
virtualHosts = {
"${configHelpers.host}" = {
extraConfig = ''
@allowed_ips {
remote_ip ${mars.wireguard.ip0} ${deimos.wireguard.ip0}
}
handle @allowed_ips {
redir /.well-known/carddav /remote.php/dav/ 301
redir /.well-known/caldav /remote.php/dav/ 301
reverse_proxy ${ceres.wireguard.ip0}:${toString configHelpers.service.ports.port0}
}
handle {
respond "Access Denied" 403
}
tls ${configHelpers.service.ssl.cert} ${configHelpers.service.ssl.key}
'';
};
};
};
}
else
{ }
);
users.groups.searx.members = [ "caddy" ];
# systemd.services.caddy.serviceConfig.ProtectHome = false;
sops =
let
sopsPath = secret: {
path = "${configHelpers.service.sops.path0}/${configHelpers.service.name}-${secret}";
owner = configHelpers.service.name;
mode = "600";
};
in
{
secrets = builtins.listToAttrs (
map
(secret: {
name = "${configHelpers.service.name}/${secret}";
value = sopsPath secret;
})
[
"key"
]
);
};
networking = {
firewall = {
interfaces.wg0.allowedTCPPorts = [
configHelpers.service.ports.port0
];
};
};
}