Pixelfed

ActivityPub-driven decentralised photo sharing platform

Declared in: projects/Pixelfed/default.nix

Demo

Implement missing demo

Options

services.pixelfed
services.pixelfed.dataDir

State directory of the pixelfed user which holds the application's state and data.

Type:
string
Default:
"/var/lib/pixelfed"
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.database.automaticMigrations

Whether to enable automatic migrations for database schema and data.

Type:
boolean
Default:
true
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.database.createLocally

Whether to enable a local database using UNIX socket authentication.

Type:
boolean
Default:
true
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.database.name

Database name.

Type:
string
Default:
"pixelfed"
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.database.type

Database engine to use. Note that PGSQL is not well supported: https://github.com/pixelfed/pixelfed/issues/2727

Type:
one of "mysql", "pgsql"
Default:
"mysql"
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.domain

FQDN for the Pixelfed instance.

Type:
string
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.enable

Whether to enable a Pixelfed instance.

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.group

Group account under which pixelfed runs.

::: {.note} If left as the default value this group will automatically be created on system activation, otherwise you are responsible for ensuring the group exists before the pixelfed application starts. :::

Type:
string
Default:
"pixelfed"
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.maxUploadSize

Max upload size with units.

Type:
string
Default:
"8M"
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx

With this option, you can customize an nginx virtual host which already has sensible defaults for Pixelfed. Set to {} if you do not need any customization to the virtual host. If enabled, then by default, the {option}serverName is ${domain}, If this is set to null (the default), no nginx virtualHost will be configured.

Type:
null or (submodule)
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.acmeFallbackHost

Host which to proxy requests to if ACME challenge is not found. Useful if you want multiple hosts to be able to verify the same domain name.

With this option, you could request certificates for the present domain with an ACME client that is running on another host, which you would specify here.

Type:
null or string
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.acmeRoot

Directory for the ACME challenge, which is public. Don't put certs or keys in here. Set to null to inherit from config.security.acme.

Type:
null or string
Default:
"/var/lib/acme/acme-challenge"
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.addSSL

Whether to enable HTTPS in addition to plain HTTP. This will set defaults for listen to listen on all interfaces on the respective default ports (80, 443).

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.basicAuth

Basic Auth protection for a vhost.

WARNING: This is implemented to store the password in plain text in the Nix store.

Type:
attribute set of string
Default:
{ }
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.basicAuthFile

Basic Auth password file for a vhost. Can be created by running {command}nix-shell --packages apacheHttpd --run 'htpasswd -B -c FILENAME USERNAME'.

Type:
null or absolute path
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.default

Makes this vhost the default.

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.enableACME

Whether to ask Let's Encrypt to sign a certificate for this vhost. Alternately, you can use an existing certificate through {option}useACMEHost.

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.extraConfig

These lines go to the end of the vhost verbatim.

Type:
strings concatenated with "\n"
Default:
""
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.forceSSL

Whether to add a separate nginx server block that redirects (defaults to 301, configurable with redirectCode) all plain HTTP traffic to HTTPS. This will set defaults for listen to listen on all interfaces on the respective default ports (80, 443), where the non-SSL listens are used for the redirect vhosts.

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.globalRedirect

If set, all requests for this host are redirected (defaults to 301, configurable with redirectCode) to the given hostname.

Type:
null or string
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.http2

Whether to enable the HTTP/2 protocol. Note that (as of writing) due to nginx's implementation, to disable HTTP/2 you have to disable it on all vhosts that use a given IP address / port. If there is one server block configured to enable http2, then it is enabled for all server blocks on this IP. See https://stackoverflow.com/a/39466948/263061.

Type:
boolean
Default:
true
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.http3

Whether to enable the HTTP/3 protocol. This requires using pkgs.nginxQuic package which can be achieved by setting services.nginx.package = pkgs.nginxQuic; and activate the QUIC transport protocol services.nginx.virtualHosts.<name>.quic = true;. Note that HTTP/3 support is experimental and not yet recommended for production. Read more at https://quic.nginx.org/ HTTP/3 availability must be manually advertised, preferably in each location block.

Type:
boolean
Default:
true
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.http3_hq

Whether to enable the HTTP/0.9 protocol negotiation used in QUIC interoperability tests. This requires using pkgs.nginxQuic package which can be achieved by setting services.nginx.package = pkgs.nginxQuic; and activate the QUIC transport protocol services.nginx.virtualHosts.<name>.quic = true;. Note that special application protocol support is experimental and not yet recommended for production. Read more at https://quic.nginx.org/

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.kTLS

Whether to enable kTLS support. Implementing TLS in the kernel (kTLS) improves performance by significantly reducing the need for copying operations between user space and the kernel. Required Nginx version 1.21.4 or later.

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.listen

Listen addresses and ports for this virtual host. IPv6 addresses must be enclosed in square brackets. Note: this option overrides addSSL and onlySSL.

If you only want to set the addresses manually and not the ports, take a look at listenAddresses.

Type:
list of (submodule)
Default:
[ ]
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.listen.*.addr

Listen address.

Type:
string
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.listen.*.extraParameters

Extra parameters of this listen directive.

Type:
list of string
Default:
[ ]
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.listen.*.port

Port number to listen on. If unset and the listen address is not a socket then nginx defaults to 80.

Type:
null or 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.listen.*.proxyProtocol

Enable PROXY protocol.

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.listen.*.ssl

Enable SSL.

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.listenAddresses

Listen addresses for this virtual host. Compared to listen this only sets the addresses and the ports are chosen automatically.

Note: This option overrides enableIPv6

Type:
list of string
Default:
[ ]
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations

Declarative location config

Type:
attribute set of (submodule)
Default:
{ }
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..alias

Alias directory for requests.

Type:
null or absolute path
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..basicAuth

Basic Auth protection for a vhost.

WARNING: This is implemented to store the password in plain text in the Nix store.

Type:
attribute set of string
Default:
{ }
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..basicAuthFile

Basic Auth password file for a vhost. Can be created by running {command}nix-shell --packages apacheHttpd --run 'htpasswd -B -c FILENAME USERNAME'.

Type:
null or absolute path
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..extraConfig

These lines go to the end of the location verbatim.

Type:
strings concatenated with "\n"
Default:
""
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..fastcgiParams

FastCGI parameters to override. Unlike in the Nginx configuration file, overriding only some default parameters won't unset the default values for other parameters.

Type:
attribute set of (string or absolute path)
Default:
{ }
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..index

Adds index directive.

Type:
null or string
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..priority

Order of this location block in relation to the others in the vhost. The semantics are the same as with lib.mkOrder. Smaller values have a greater priority.

Type:
signed integer
Default:
1000
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..proxyPass

Adds proxy_pass directive and sets recommended proxy headers if recommendedProxySettings is enabled.

Type:
null or string
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..proxyWebsockets

Whether to support proxying websocket connections with HTTP/1.1.

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..recommendedProxySettings

Enable recommended proxy settings.

Type:
boolean
Default:
config.services.nginx.recommendedProxySettings
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..recommendedUwsgiSettings

Enable recommended uwsgi settings.

Type:
boolean
Default:
config.services.nginx.recommendedUwsgiSettings
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..return

Adds a return directive, for e.g. redirections.

Type:
null or string or signed integer
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..root

Root directory for requests.

Type:
null or absolute path
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..tryFiles

Adds try_files directive.

Type:
null or string
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.locations..uwsgiPass

Adds uwsgi_pass directive and sets recommended proxy headers if recommendedUwsgiSettings is enabled.

Type:
null or string
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.onlySSL

Whether to enable HTTPS and reject plain HTTP connections. This will set defaults for listen to listen on all interfaces on port 443.

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.quic

Whether to enable the QUIC transport protocol. This requires using pkgs.nginxQuic package which can be achieved by setting services.nginx.package = pkgs.nginxQuic;. Note that QUIC support is experimental and not yet recommended for production. Read more at https://quic.nginx.org/

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.redirectCode

HTTP status used by globalRedirect and forceSSL. Possible usecases include temporary (302, 307) redirects, keeping the request method and body (307, 308), or explicitly resetting the method to GET (303). See https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections.

Type:
integer between 300 and 399 (both inclusive)
Default:
301
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.rejectSSL

Whether to listen for and reject all HTTPS connections to this vhost. Useful in default server blocks to avoid serving the certificate for another vhost. Uses the ssl_reject_handshake directive available in nginx versions 1.19.4 and above.

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.reuseport

Create an individual listening socket . It is required to specify only once on one of the hosts.

Type:
boolean
Default:
false
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.root

The path of the web root directory.

Type:
null or absolute path
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.serverAliases

Additional names of virtual hosts served by this virtual host configuration.

Type:
list of string
Default:
[ ]
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.serverName

Name of this virtual host. Defaults to attribute name in virtualHosts.

Type:
null or string
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.sslCertificate

Path to server SSL certificate.

Type:
absolute path
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.sslCertificateKey

Path to server SSL certificate key.

Type:
absolute path
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.sslTrustedCertificate

Path to root SSL certificate for stapling and client certificates.

Type:
null or absolute path
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.nginx.useACMEHost

A host of an existing Let's Encrypt certificate to use. This is useful if you have many subdomains and want to avoid hitting the rate limit. Alternately, you can generate a certificate through {option}enableACME. Note that this option does not create any certificates, nor it does add subdomains to existing ones – you will need to create them manually using .

Type:
null or string
Default:
null
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.package

The pixelfed package to use.

Type:
package
Default:
pkgs.pixelfed
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.phpPackage

The php83 package to use.

Type:
package
Default:
pkgs.php83
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.poolConfig

Options for Pixelfed's PHP-FPM pool.

Type:
attribute set of (signed integer or string or boolean)
Default:
{ }
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.redis.createLocally

Whether to enable a local Redis database using UNIX socket authentication.

Type:
boolean
Default:
true
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.runtimeDir

Ruutime directory of the pixelfed user which holds the application's caches and temporary files.

Type:
string
Default:
"/run/pixelfed"
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.schedulerInterval

How often the Pixelfed cron task should run

Type:
string
Default:
"1d"
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.secretFile

A secret file to be sourced for the .env settings. Place APP_KEY and other settings that should not end up in the Nix store here.

Type:
absolute path
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.settings

.env settings for Pixelfed. Secrets should use secretFile option instead.

Type:
attribute set of (boolean or signed integer or string)
Declared in:
nixos/modules/services/web-apps/pixelfed.nix
services.pixelfed.user

User account under which pixelfed runs.

::: {.note} If left as the default value this user will automatically be created on system activation, otherwise you are responsible for ensuring the user exists before the pixelfed application starts. :::

Type:
string
Default:
"pixelfed"
Declared in:
nixos/modules/services/web-apps/pixelfed.nix

Examples

basic
{ pkgs, ... }:
{
  services.pixelfed = {
    enable = true;
    domain = "pixelfed.local";

    # Configure NGINX.
    nginx = { };
    secretFile = (
      pkgs.writeText "secrets.env" ''
        # Snakeoil secret, can be any random 32-chars secret via CSPRNG.
        APP_KEY=adKK9EcY8Hcj3PLU7rzG9rJ6KKTOtYfA
      ''
    );
    settings."FORCE_HTTPS_URLS" = false;
  };
}

Declared in: projects/Pixelfed/example.nix

This project is funded by NLnet through these subgrants:

Related links: