summaryrefslogtreecommitdiff
path: root/content/theses/self-sufficiency/photos.md
diff options
context:
space:
mode:
authoraethrvmn <me@aethrvmn.gr>2025-08-30 13:18:29 +0000
committeraethrvmn <me@aethrvmn.gr>2025-08-30 13:18:29 +0000
commit29a570918721fd5d73bb140a9fb3bfa3e5647b9f (patch)
treecfa54b3b7c1515ac6ae41d56f9b5e15ada4092b1 /content/theses/self-sufficiency/photos.md
parentadded non-content (diff)
added content
Diffstat (limited to '')
-rw-r--r--content/theses/self-sufficiency/photos.md122
1 files changed, 122 insertions, 0 deletions
diff --git a/content/theses/self-sufficiency/photos.md b/content/theses/self-sufficiency/photos.md
new file mode 100644
index 0000000..ca3dfe6
--- /dev/null
+++ b/content/theses/self-sufficiency/photos.md
@@ -0,0 +1,122 @@
+---
+title: photos
+weight: 15
+---
+
+One main purpose for using cloud services is keeping photos and videos, and other such media backed up in a server that is searchable, and that allows you to create albums to share with friends.
+
+For this purpose, in order to replace Google Photos/iCloud Photos, and to retain our ownership of said photos (both those services have restrictive ToS which gives them rights over *your* photos), we will use [`immich`](https://immich.app), which is a self-hosted free and open-source software photo and video management solution, with many features like duplicate detection and contextual search using machine learning, running locally.
+
+{{% hint danger %}}
+As of writing this, immich is still in early/active development. There may be breaking changes between versions, so be wary and ***always keep a backup***, like an old drive, and store a copy of your photos there, just in case.
+{{% /hint %}}
+
+## specs
+The machine learning models run locally, which might make it more difficult to run on small or old hardware, but you can disable it.
+
+When the machine learning stack is not running, immich takes 285M of RAM on my system.
+
+## installation
+
+Create a `immich` folder and a `default.nix` file inside it, at the place where you have the rest of your nixos configuration
+```sh
+$ mkdir immich && touch immich/default.nix
+```
+(or use the file explorer of your choice)
+
+### nix declaration
+
+Open `immich/default.nix` in any text editor, and copy the following
+
+```nix
+{ config, lib, ... }:
+{
+ services = {
+ # Immich setup
+ immich = {
+ enable = true;
+
+ host = "127.0.0.1";
+ port = 3010;
+ machine-learning.enable = true;
+ };
+
+ nginx = {
+ virtualHosts."photos.<YOUR-DOMAIN>" = {
+ enableACME = true;
+ forceSSL = true;
+
+ locations."/" = {
+ proxyPass = "http://127.0.0.1:3010";
+ proxyWebsockets = true;
+ };
+ };
+ };
+ };
+
+ hardware.graphics.enable = lib.mkForce true;
+
+ users.users.immich = {
+ extraGroups = [ "video" "render" ];
+ };
+}
+```
+Then to enable it, just include it in the server config file:
+
+```nix
+ imports = [
+ # ... other services
+ ./immich
+ # ... other services
+ ];
+```
+and you're done. Download the app for your phone, and connect through `https://photos.<YOUR-DOMAIN>`
+
+Let's break the config file down.
+
+### explanation
+1) First of all we declare the `immich` service as enabled.
+2) We define the host and port, so that the service only speaks to the outside world via a reverse proxy (via `nginx`)
+3) We explcitly enable machine learning functionality, like face and object detection.
+4) We set up nginx to serve a reverse proxy at `photos.<YOUR-DOMAIN>` pointing at the immich service.
+5) We explicitly force the use of graphics drivers
+6) Finally, we declare some information for the user that will run the `immich` service, `immich`. (we add `immich` to the `video` and `render` groups.)
+
+{{% hint info %}}
+To disable any machine-learning functionality, simply set `machine-learning.enable = false;`
+{{% /hint %}}
+
+{{% hint info %}}
+More information can be found at the [wiki](https://wiki.nixos.org/wiki/immich), but it can be opaque.
+More options can be found [here](https://mynixos.com/nixpkgs/options/services.immich).
+{{% /hint %}}
+
+{{% hint info %}}
+If you want to declare more settings and/or environment variables for `immich`, you can declare them:
+```nix
+services = {
+ immich = {
+ settings = {
+ # ...
+ };
+ environment = {
+ # ...
+ };
+ };
+};
+```
+- `services.immich.settings`, declares [settings found here](https://immich.app/docs/install/config-file/) and expects JSON syntax
+You can find these settings and change them from the admin panel in your running instance of `immich`
+
+- `services.immich.environment`, declares [envarionment variables found here](https://immich.app/docs/install/environment-variables), and expects
+`ENV_VAR_NAME = ENV_VAR_VALUE;`
+Only for env vars tagged `server`, `api`, or `microservices`.
+{{% /hint %}}
+### further setup
+Once the service is up and running, go to `localhost:3010`, or `photos.<YOUR-DOMAIN>`, or whatever domain you set it to.
+
+You must set up an administrator account. This can either be a completely seperate account to your own, or it could be your own account.
+
+## service backups
+By default, all media will be stored somewhere in `/var/lib/immich`. Automatic database backups are being kept inside `/var/lib/immich/backups` as `###.sql.gz` files, so you can store these alongside your media.
+If you want you can simply make a copy of the entire `/var/lib/immich` folder at regular intervals.
Directive (EU) 2019/790, Article 4(3); all rights regarding Text and Data Mining (TDM) are reserved.