(feat): reformatted code for flakes usage

This commit is contained in:
chloe 2024-08-16 15:28:32 +02:00
parent d29d6f0133
commit c3956d6fa4
40 changed files with 130 additions and 76 deletions

View file

@ -0,0 +1,12 @@
{config, ...}:
{
imports = [
./homelab-dashboard.nix
./nextcloud.nix
./photoprism.nix
./grafana.nix
./forgejo.nix
./synapse-matrix.nix
./uptime-kuma.nix
];
}

View file

@ -0,0 +1,5 @@
U2FsdGVkX18oY3efQYeXqacnpNaOkre/hn/Ck1shbtZiKPQbD7G+tdQBjxPdZxIL
7oZi2qay/Z6ZKgjmd5zMW+jFejxl9/PSbDFbydn3nADkOCgPO5QSjN2QX+cswV/T
MlSQovYhJzhBgy37cPNU4oZBM8u5ZyRKLgBdUcbaKOJShyzirwKaKdn4abN0QC9B
nPIRIY5INzJPDHJEi/hgOfp4PLeiJTOvrGjvKF2N65f4Uyi8BOW3NSDK+qp6VcUI
tfF/C6r6XQF4w3p9GD2Zxw==

View file

@ -0,0 +1,32 @@
{ config, ... }:
{
imports = [ ./forgejo-smtp.nix ];
sops.secrets.smtp_address = { };
sops.secrets.smtp_password = {
owner = "forgejo";
};
services.forgejo = {
enable = true;
lfs.enable = true;
database = {
type = "postgres";
};
settings = {
server = {
DOMAIN = "git.hypervirtual.world";
ROOT_URL = "https://hypervirtual.world";
HTTP_PORT = 3333;
};
actions = {
ENABLED = true;
DEFAULT_ACTIONS_URL = "github";
};
mailer = {
ENABLED = true;
};
service.DISABLE_REGISTRATION = true;
};
mailerPasswordFile = config.sops.secrets.smtp_password.path;
};
}

View file

@ -0,0 +1,36 @@
{ config, lib, ... }:
with lib;
let
cfg = config.freshrss;
in
{
options = {
freshrss.url = mkOption {
type = types.str;
default = "http://192.168.1.177:3005";
};
};
config = {
sops.secrets = {
freshrss_username = {
sopsFile = ../../secrets/freshrss.yaml;
};
freshrss_password = {
sopsFile = ../../secrets/freshrss.yaml;
};
};
services.freshrss = {
enable = true;
language = "fr";
defaultUser = config.sops.secrets.freshrss_username;
baseUrl = cfg.url;
passwordFile = config.sops.secrets.freshrss_password.path;
database = {
type = "sqlite";
};
};
};
}

View file

@ -0,0 +1,12 @@
{ config, ... }:
{
services.grafana = {
enable = true;
settings = {
server = {
http_addr = "0.0.0.0";
http_port = 3000;
};
};
};
}

View file

@ -0,0 +1,314 @@
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.homepage-dashboard;
ip = cfg.baseURL;
in
{
options = {
homepage-dashboard.baseURL = mkOption {
type = types.str;
default = "192.168.1.177";
};
homepage-dashboard.proxmoxVEIp = mkOption {
type = types.str;
default = "192.168.1.10";
};
homepage-dashboard.proxmoxBSIp = mkOption {
type = types.str;
default = "";
};
homepage-dashboard.piholeURL = mkOption {
type = types.str;
default = "192.168.1.25";
};
};
#TODO: add Radarr/Sonarr/... api key support
config = {
sops.secrets."homepage" = {
sopsFile = ../../secrets/homepage.env;
format = "dotenv";
};
services.homepage-dashboard = {
enable = true;
environmentFile = config.sops.secrets."homepage".path;
settings = {
headerStyle = "boxed";
language = "fr";
title = "sillybox home !!";
layout = [
{
"Vidéos & Séries" = {
style = "row";
columns = 4;
};
}
{
"Administration" = {
style = "row";
columns = 4;
};
}
];
};
widgets = [
{
resources = {
cpu = true;
disk = "/";
memory = true;
};
}
{
search = {
provider = "duckduckgo";
target = "_blank";
};
}
];
bookmarks = [ { code = [ { "Github" = [ { href = "https://github.com"; } ]; } ]; } ];
services = [
{
"Divertissement" = [
{
"Serveur Minecraft poulet" = {
icon = "minecraft";
description = "serveur des trois poulets";
widget = {
type = "minecraft";
url = "udp://${ip}:25565";
};
};
}
{
"Crafty-controller" = {
description = "Gestionnaire de serveur Minecraft";
href = "https://192.168.1.177:8443";
};
}
];
}
{
"Lecture" = [
{
"Calibre-web" = {
icon = "calibre";
description = "Serveur de livres";
href = "http://${ip}:5050";
};
}
{
"Freshrss" = {
icon = "freshrss";
description = "Récupère les articles";
};
}
];
}
{
"Vidéos & Séries" = [
{
"Jellyfin" = {
icon = "jellyfin";
description = "Permet de regarder ou écouter du contenu.";
href = "http://${ip}:8096";
widget = {
type = "jellyfin";
url = "http://${ip}:8096";
enableBlocks = true;
key = "{{HOMEPAGE_VAR_JELLYFIN}}";
};
};
}
{
"Jellyseerr" = {
icon = "jellyseerr";
description = "Moteur de recherche de films/séries";
href = "http://${ip}:5055";
widget = {
type = "jellyseerr";
url = "http://${ip}:5055";
key = "{{HOMEPAGE_VAR_JELLYSEERR}}";
};
};
}
{
"slskd" = {
icon = "slskd";
description = "Pour télécharger/partager de la musique";
href = "http://${ip}:5030";
};
}
{
"Prowlarr" = {
icon = "prowlarr";
description = "Indexe les différents sites de téléchargement";
href = "http://${ip}:9696/";
widget = {
type = "prowlarr";
key = "{{HOMEPAGE_VAR_PROWLARR}}";
url = "http://${ip}:9696";
};
};
}
{
"Sonarr" = {
icon = "sonarr";
description = "Moteur de recherche pour les séries";
href = "http://${ip}:8989/";
widget = {
type = "sonarr";
url = "http://${ip}:8989";
key = "{{HOMEPAGE_VAR_SONARR}}";
};
};
}
{
"Radarr" = {
icon = "radarr";
description = "Moteur de recherche pour les films";
href = "http://${ip}:7878";
widget = {
type = "radarr";
key = "{{HOMEPAGE_VAR_RADARR}}";
url = "http://${ip}:7878";
};
};
}
{
"Bazarr" = {
icon = "bazarr";
description = "Vérifie les sous titres des films/séries.";
href = "http://${ip}:6767";
widget = {
type = "bazarr";
key = "{{HOMEPAGE_VAR_BAZARR}}";
url = "http://${ip}:6767";
};
};
}
{
"Transmission" = {
icon = "transmission";
description = "s'occupe du téléchargement des fichiers";
href = "http://${ip}:9091";
widget = {
type = "transmission";
url = "http://${ip}:9091";
username = "{{HOMEPAGE_VAR_TRANSMISSIONUSERNAME}}";
password = "{{HOMEPAGE_VAR_TRANSMISSIONPASSWORD}}";
};
};
}
];
}
{
"Utilitaires" = [
{
"Photoprism" = {
icon = "photoprism";
description = "Sauvegarde de photos";
href = "http://${ip}:2342";
};
}
{
"4get" = {
icon = "searx";
description = "Moteur de recherche privé pour remplacer Google.";
href = "https://4get.hypervirtual.world";
};
}
];
}
{
"Administration" = [
/*
{
"Proxmox Backup Server" = {
icon = "proxmox-light";
description = "Permet de sauvegarder le serveur.";
href = "https://${cfg.proxmoxBSIp}:8007";
};
}
*/
{
"Proxmox VE" = {
icon = "proxmox";
description = "Panneau de controle des machines virtuelles";
href = "https://${cfg.proxmoxVEIp}:8006";
widget = {
type = "proxmox";
username = "{{HOMEPAGE_VAR_PROXMOXUSERNAME}}";
password = "{{HOMEPAGE_VAR_PROXMOXPASSWORD}}";
url = "https://${cfg.proxmoxVEIp}:8006";
node = "pve";
};
};
}
{
"Pi.hole" = {
icon = "pi-hole";
description = "Bloqueur de pubs DNS/DHCP";
href = "http://${cfg.piholeURL}/admin";
widget = {
type = "pihole";
key = "{{HOMEPAGE_VAR_PIHOLE}}";
url = "http://${cfg.piholeURL}";
};
};
}
{
"Grafana" = {
icon = "grafana";
description = "Visualiseur de graphiques";
href = "http://${ip}:3001";
};
}
{
"InfluxDB" = {
icon = "influxdb";
description = "Traite les statistiques du serveur Proxmox";
href = "http://192.168.1.157:8086";
};
}
{
"Uptime Kuma" = {
icon = "uptime-kuma";
description = "Surveille l'état des différents services";
href = "http://${ip}:4001";
};
}
{
"Uptime Robot" = {
icon = "uptime-kuma";
description = "Surveille l'état des sites (hors réseau maison)";
widget = {
type = "uptimerobot";
url = "https://api.uptimerobot.com";
key = "{{HOMEPAGE_VAR_UPTIMEROBOT}}";
};
};
}
];
}
];
};
};
}

View file

@ -0,0 +1,7 @@
{ config, pkgs, ... }:
{
services.i2pd = {
enable = true;
upnp.enable = true;
};
}

View file

@ -0,0 +1,40 @@
{ config, ... }:
{
imports = [
"${
fetchTarball {
url = "https://github.com/onny/nixos-nextcloud-testumgebung/archive/fa6f062830b4bc3cedb9694c1dbf01d5fdf775ac.tar.gz";
sha256 = "0gzd0276b8da3ykapgqks2zhsqdv4jjvbv97dsxg0hgrhb74z0fs";
}
}/nextcloud-extras.nix"
]; # adding caddy support
sops.secrets.adminNextcloudPass = {
owner = "nextcloud";
};
services.nextcloud = {
enable = true;
hostName = "cloud.hypervirtual.world";
database.createLocally = true;
webserver = "caddy";
configureRedis = true;
config = {
dbtype = "pgsql";
adminpassFile = config.sops.secrets.adminNextcloudPass.path;
};
settings.enabledPreviewProviders = [
"OC\\Preview\\BMP"
"OC\\Preview\\GIF"
"OC\\Preview\\JPEG"
"OC\\Preview\\Krita"
"OC\\Preview\\MarkDown"
"OC\\Preview\\MP3"
"OC\\Preview\\OpenDocument"
"OC\\Preview\\PNG"
"OC\\Preview\\TXT"
"OC\\Preview\\XBitmap"
"OC\\Preview\\HEIC"
];
};
}

View file

@ -0,0 +1,22 @@
{ pkgs, config, ... }:
{
sops.secrets.photoprismAdmin = { };
sops.secrets.photoprismPassword = { };
services.photoprism = {
enable = true;
port = 2342;
originalsPath = "/srv/cloud/photoprism/originals";
settings = {
PHOTOPRISM_ADMIN_USER = "admin";
PHOTOPRISM_DEFAULT_LOCALE = "fr";
PHOTOPRISM_DATABASE_DRIVER = "mysql";
PHOTOPRISM_DATABASE_NAME = "photoprism";
PHOTOPRISM_DATABASE_SERVER = "/run/mysqld/mysqld.sock";
PHOTOPRISM_DATABASE_USER = "photoprism";
PHOTOPRISM_SITE_URL = "http://photos.hypervirtual.world";
PHOTOPRISM_SITE_TITLE = "hyperreal photoprism???";
};
passwordFile = config.sops.secrets.photoprismPassword.path;
};
}

View file

@ -0,0 +1,93 @@
{
pkgs,
config,
lib,
...
}:
let
baseUrl = "https://talk.hypervirtual.world";
in
{
networking.domain = "hypervirtual.world";
sops.secrets.matrix_data = {
format = "yaml";
owner = "matrix-synapse";
};
services.matrix-synapse = {
enable = true;
settings = {
server_name = "hypervirtual.world";
public_baseurl = baseUrl;
enable_registration = false;
listeners = [
{
port = 8008;
bind_addresses = [
"::1"
"0.0.0.0"
];
type = "http";
tls = false;
x_forwarded = true;
resources = [
{
names = [
"client"
"federation"
"metrics"
];
compress = true;
}
];
}
{
port = 9000;
type = "metrics";
tls = false;
bind_addresses = [
"::1"
"0.0.0.0"
];
resources = [ ];
}
];
};
extras = [
"systemd"
"postgres"
"url-preview"
"user-search"
];
extraConfigFiles = [ "/run/secrets/matrix_data" ];
};
/*
services.mautrix-discord = {
enable = true;
environmentFile = "";
settings = {
homeserver = {
address = "http://localhost:8008";
domain = "hypervirtual.world";
};
appservice = {
provisioning.enabled = false;
id = "discord";
public = {
};
database = "";
};
};
};
*/
}

View file

@ -0,0 +1,11 @@
{ ... }:
{
#TODO: implement uptime-kama
services.uptime-kuma = {
enable = true;
settings = {
HOST = "0.0.0.0";
PORT = "4000";
};
};
}