about summary refs log tree commit diff
path: root/nix/hosts/corrino/www/miniflux.emile.space.nix
blob: f5b98171eb09aa2114fbbe44a4cc8ffe052709db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{ config, pkgs, ... }:

{
	services.nginx.virtualHosts."miniflux.emile.space" = {
		forceSSL = true;
		enableACME = true;
		locations = {
			"/" = {
				proxyPass = "http://${config.services.miniflux.config.LISTEN_ADDR}";
			};
		};
	};

  # auth via authelia
  services.authelia.instances.main.settings.identity_providers.oidc.clients = [
    {
      id = "miniflux";

      # ; nix run nixpkgs#authelia -- crypto hash generate pbkdf2 --variant sha512 --random --random.length 72 --random.charset rfc3986
      secret = "$pbkdf2-sha512$310000$rlOuqUDGc/kl3bw7JgcSpg$4COyNudsu/7L8qhnxfcQld5Fy.ru/JUp7RCI7dCHZMtzxRnhckW8A7uz3Xeuc7.BjCIwc4GdWusPt6.TiH6Kpw";
      public = false;
      authorization_policy = "two_factor";
      redirect_uris = [ "https://miniflux.emile.space/oauth2/oidc/callback" ];
      scopes = [
        "openid"
        "email"
        "profile"
      ];
      grant_types = [
        "refresh_token"
        "authorization_code"
      ];
      response_types = [ "code" ];
      response_modes = [
        "form_post"
        "query"
        "fragment"
      ];
      token_endpoint_auth_method = "client_secret_post";
    }
  ];

	services.miniflux = {
		enable = true;
		package = pkgs.miniflux;
		config = {
			BASE_URL = "https://miniflux.emile.space";

			# Cleanup job frequency to remove old sessions and archive entries.
		  CLEANUP_FREQUENCY = 48;

			# Set to 1 to enable maintenance mode. Maintenance mode disables the web ui and show a text message to the users.
			# MAINTENANCE_MODE = 1;
			# MAINTENANCE_MESSAGE = "updating foo";
			
			OAUTH2_CLIENT_ID = "miniflux";
			OAUTH2_CLIENT_SECRET_FILE = config.age.secrets.miniflux_oidc_secret.path;
			OAUTH2_OIDC_DISCOVERY_ENDPOINT = "sso.emile.space";
			OAUTH2_OIDC_PROVIDER_NAME = "authelia";
			OAUTH2_PROVIDER = "oidc";
			OAUTH2_REDIRECT_URL = "https://miniflux.emile.space/oauth2/oidc/callback";
			
		  LISTEN_ADDR = "[::1]:${toString config.emile.ports.miniflux}";
		};
		createDatabaseLocally = true;

		# File containing the ADMIN_USERNAME and ADMIN_PASSWORD (length >= 6) in the format of an EnvironmentFile=, as described by systemd.exec(5).
		adminCredentialsFile = config.age.secrets.miniflux_admin_file.path;
	};
	


}