PdfDing
Web-based selfhosted PDF manager, viewer and editor
Declared in: projects/PdfDing/default.nix
Try the service in a VM
-
Install Nix
- Bash
-
$ apt install --yes curl git jq nix
- Bash
-
$ apt install --yes curl git jq nix
- Bash
-
$ pacman --sync --refresh --noconfirm curl git jq nix
-
Download a configuration file
# default.nix { ngipkgs ? import (fetchTarball "https://github.com/ngi-nix/ngipkgs/tarball/main") { }, }: ngipkgs.demo-vm ( { pkgs, ... }: { services.pdfding = { enable = true; openFirewall = true; # NOTE: this is just for demo purposes # you shoud not use this in production, use a secret management tool like sops-nix instead. # see https://wiki.nixos.org/wiki/Comparison_of_secret_managing_schemes for other alternatives. secretKeyFile = pkgs.writeText "django_secret" "foobarbaz"; consume.enable = true; # allows bulk importing pdf files consume.schedule = "*/1 * * * *"; # once every minute }; } )
-
Enable binary substituters
- Bash
-
$ export NIX_CONFIG='substituters = https://cache.nixos.org/ https://ngi.cachix.org/ trusted-public-keys = cache.nixos.org-1:6nchdd59x431o0gwypbmraurkbj16zpmqfgspcdshjy= ngi.cachix.org-1:n+cal72roc3qqulxihpv+tw5t42whxmmhpragkrsrow='
-
Build and run a virtual machine
- Bash
-
$ nix-build ./default.nix && ./result
- Bash
-
$ nix-build ./default.nix && ./result
- Bash
-
$ rev=$(nix-instantiate --eval --attr sources.nixpkgs.rev https://github.com/ngi-nix/ngipkgs/archive/master.tar.gz | jq --raw-output)$ nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/$rev.tar.gz --packages nix --run "nix-build ./default.nix && ./result"
- Bash
-
$ nix-build ./default.nix && ./result
-
Usage Instructions
-
Visit http://127.0.0.1:8000 in your browser
-
An admin account has already been created inside the demo, so you can sign in with the following credentials:
- email:
admin@localhost - password:
admin
- email:
-
An example file will be available inside the demo, but it might take a minute for it to appear. You can upload more PDFs, click ➕ icon (top right corner).
For example:
-
Examples
basic
{ config, ... }: { services.pdfding = { enable = true; secretKeyFile = config.sops.secrets."pdfding/django/secret_key".path; }; # Secrets management # See <https://github.com/Mic92/sops-nix> sops = { age.keyFile = "/dev/null"; # For a production configuration, set this option. defaultSopsFile = "/dev/null"; # For a production configuration, set this option. validateSopsFiles = false; # For a production configuration, remove this line. secrets."pdfding/django/secret_key" = { owner = config.services.pdfding.user; group = config.services.pdfding.group; }; }; }
Declared in: projects/PdfDing/services/pdfding/examples/basic.nix
minio
{ config, ... }: { services.pdfding = { enable = true; secretKeyFile = config.sops.secrets."pdfding/django/secret_key".path; backup.enable = true; backup.schedule = "*/1 * * * *"; backup.endpoint = "127.0.0.1:9000"; envFiles = [ config.sops.templates."pdfding-minio-keys".path ]; # adds pdfding-manage django admin executable to path installWrapper = true; }; # Setup a local minio service for the backup feature services.minio = { enable = true; rootCredentialsFile = config.sops.templates."minio-creds".path; listenAddress = "127.0.0.1:9000"; consoleAddress = "127.0.0.1:9001"; }; # Secrets management # See <https://github.com/Mic92/sops-nix> sops = { age.keyFile = "/dev/null"; # For a production configuration, set this option. defaultSopsFile = "/dev/null"; # For a production configuration, set this option. validateSopsFiles = false; # For a production configuration, remove this line. secrets."pdfding/minio/user" = { }; secrets."pdfding/minio/password" = { }; templates."minio-creds" = { content = '' MINIO_ROOT_USER=${config.sops.placeholder."pdfding/minio/user"} MINIO_ROOT_PASSWORD=${config.sops.placeholder."pdfding/minio/password"} ''; owner = "minio"; group = "minio"; }; templates."pdfding-minio-keys" = { content = '' BACKUP_ACCESS_KEY=${config.sops.placeholder."pdfding/minio/user"} BACKUP_SECRET_KEY=${config.sops.placeholder."pdfding/minio/password"} ''; owner = config.services.pdfding.user; group = config.services.pdfding.group; }; secrets."pdfding/django/secret_key" = { owner = config.services.pdfding.user; group = config.services.pdfding.group; }; }; }
Declared in: projects/PdfDing/services/pdfding/examples/minio.nix
postgres
{ config, ... }: { services.pdfding = { enable = true; secretKeyFile = config.sops.secrets."pdfding/django/secret_key".path; database.createLocally = true; database.type = "postgres"; consume.enable = true; # allows bulk importing pdf files from the backend consume.schedule = "*/1 * * * *"; # once every minute }; # Secrets management # See <https://github.com/Mic92/sops-nix> sops = { age.keyFile = "/dev/null"; # For a production configuration, set this option. defaultSopsFile = "/dev/null"; # For a production configuration, set this option. validateSopsFiles = false; # For a production configuration, remove this line. secrets."pdfding/django/secret_key" = { owner = config.services.pdfding.user; group = config.services.pdfding.group; }; }; }
Declared in: projects/PdfDing/services/pdfding/examples/postgres.nix
This project is funded by NLnet through these subgrants:
- Commons
- PdfDing
Related links: