Compare commits

...

19 commits

Author SHA1 Message Date
e54ef96b2a
fix(photo01): fmt
Some checks failed
Check meta / check_meta (pull_request) Failing after 38s
lint / check (pull_request) Successful in 43s
build configuration / build_krz01 (pull_request) Failing after 13m55s
2024-11-21 19:44:43 +01:00
b391255aa9
fix(photo01): fix immich port 2024-11-21 19:43:51 +01:00
dc2842a807
fix(photo01): reenable nginx 2024-11-21 19:38:29 +01:00
055fdb9fcf
feat(photo01): secrets and disk config 2024-11-21 19:08:49 +01:00
375eae9f4d
feat(photo01): add empty secrets db 2024-11-21 19:04:20 +01:00
f35d495073
fix(photo01): nginx invocation 2024-11-21 19:02:40 +01:00
f6fcdf21a7
fix(photo01): unbound variable name 2024-11-21 18:59:56 +01:00
b19fba8f0b
fix(photo01): module name missmatch 2024-11-21 18:59:21 +01:00
73741a3f91
feat(photo01): switch to unstable nixpkgs 2024-11-21 18:55:16 +01:00
91eea5d171
feat(photo01): add to meta 2024-11-21 18:52:45 +01:00
e1f1054d67
style(photo01): remove lambda instance 2024-11-21 18:49:13 +01:00
b478879fe8
style(photo01): "" -> "_" 2024-11-21 18:48:02 +01:00
2aa758ae94
style(photo01): "..." -> "" in module inputs 2024-11-21 18:47:17 +01:00
abf9f2d2f5
fix: fmt 2024-11-21 18:46:03 +01:00
a81b8de9cc
fix(photo01): split services into modules 2024-11-21 18:44:54 +01:00
c2875a70f8
fix: fmt 2024-11-21 18:43:16 +01:00
997e0e71db
fix: fmt 2024-11-21 18:41:54 +01:00
271fa9ec35
fix: fmt 2024-11-21 18:40:50 +01:00
a5c1974e86
feat(photo01): init 2024-11-21 18:39:34 +01:00
9 changed files with 198 additions and 1 deletions

View file

@ -0,0 +1,56 @@
# TODO: revamp to use the same framework as the other VMs
{ pkgs, ... }:
let
address = "129.199.146.101";
in
{
imports = [
./_hardware-configuration.nix
# NOTE: For now, only deploy the bare minimum
./immich.nix
./nginx.nix
./photoprism.nix
];
deployment.targetHost = address;
networking = {
firewall.allowedTCPPorts = [
22
80
443
8007
];
firewall.allowedUDPPorts = [ ];
useNetworkd = true;
};
time.timeZone = "Europe/Paris";
environment.systemPackages = with pkgs; [ neovim ];
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDMBW7rTtfZL9wtrpCVgariKdpN60/VeAzXkh9w3MwbO julien@enigma"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKrijwPlb7KQkYPLznMPVzPPT69cLzhEsJzZi9tmxzTh cst1@x270"
];
security.acme.acceptTerms = true;
systemd.network = {
config.routeTables = {
he = 100;
mwan = 110;
};
networks = {
"10-ens18" = {
name = "ens18";
networkConfig = {
Description = "ENS uplink";
Address = [ "129.199.146.101/24" ];
Gateway = "129.199.146.254";
LLDP = true;
};
};
};
};
}

View file

@ -0,0 +1,35 @@
{ lib, modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot = {
loader.systemd-boot.enable = true;
initrd.kernelModules = [ ];
kernelModules = [ ];
extraModulePackages = [ ];
initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"virtio_scsi"
"sd_mod"
"sr_mod"
];
};
fileSystems."/" = {
device = "/dev/disk/by-partlabel/disk-sda-root";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-partlabel/disk-sda-ESP";
fsType = "vfat";
};
networking.useDHCP = lib.mkDefault false;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -0,0 +1,16 @@
{
services.immich = {
enable = true;
# NOTE: default port changes in a later version
port = 3001;
machine-learning.enable = true;
host = "localhost";
};
services.nginx.virtualHosts."immich.cgiga.fr" = {
enableACME = true;
forceSSL = true;
serverAliases = [ ];
locations."/".proxyPass = "http://localhost:3001/";
};
}

View file

@ -0,0 +1,10 @@
{
services.nginx = {
enable = true;
recommendedTlsSettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
clientMaxBodySize = "500m";
};
}

View file

@ -0,0 +1,8 @@
{
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
};
};
}

View file

@ -0,0 +1,54 @@
{ pkgs, ... }:
{
services = {
photoprism = {
enable = true;
port = 2342;
settings = {
PHOTOPRISM_DEFAULT_LOCALE = "fr";
PHOTOPRISM_ADMIN_USERNAME = "admin";
PHOHOPRISM_SITE_URL = "https://photoprism.cgiga.fr";
PHOTOPRISM_SITE_CAPTION = "PhotoPrism";
# DB access config
PHOTOPRISM_DATABASE_DRIVER = "mysql";
PHOTOPRISM_DATABASE_NAME = "photoprism";
PHOTOPRISM_DATABASE_SERVER = "/run/mysqld/mysqld.sock";
PHOTOPRISM_DATABASE_USER = "photoprism";
};
originalsPath = "/data/photos";
address = "localhost";
#importPath = "/photoprism/imports";
passwordFile = "/passwords/photoprism";
};
mysql = {
enable = true;
dataDir = "/data/mysql";
package = pkgs.mariadb;
ensureDatabases = [ "photoprism" ];
ensureUsers = [
{
name = "photoprism";
ensurePermissions = {
"photoprism.*" = "ALL PRIVILEGES";
};
}
];
};
nginx.virtualHosts."photoprism.cgiga.fr" = {
enableACME = true;
forceSSL = true;
serverAliases = [ ];
locations."/" = {
proxyPass = "http://localhost:2342/";
proxyWebsockets = true;
};
};
};
}

View file

@ -0,0 +1,3 @@
(import ../../../keys).mkSecrets [ "photo01" ] [
# List of secrets for router02
]

View file

@ -49,4 +49,11 @@
hostId = "144d0f7a"; hostId = "144d0f7a";
}; };
photo01 = {
interfaces = { };
addresses.ipv4 = [ "129.199.146.101" ];
hostId = "bcf8ff03";
};
} }

View file

@ -19,7 +19,6 @@
- luj01 -> VM de Luj - luj01 -> VM de Luj
*/ */
{ {
krz01 = { krz01 = {
site = "pav01"; site = "pav01";
@ -36,6 +35,15 @@
stateVersion = "24.05"; stateVersion = "24.05";
nixpkgs = "24.05"; nixpkgs = "24.05";
}; };
photo01 = {
site = "pav01";
# TODO
hashedPassword = "$y$j9T$aFhOWa05W7VKeKt3Nc.nA1$uBOvG4wf7/yWjwOxO8NLf9ipCsAkS1.5cD2EJpLx57A";
stateVersion = "24.05";
nixpkgs = "unstable";
};
router02 = { router02 = {
site = "pav01"; site = "pav01";