Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions hosts/bastion/profiles/caddy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,8 @@

"pdf.e10.camp" = {
host = hosts.matrix;
port =
hosts.matrix.config.services.stirling-pdf.environment.SERVER_PORT;
inherit (hosts.matrix.config.services.bentopdf) port;
protected = true;
extraConfig = ''
request_body {
max_size 2GiB
}
'';
};

"mazanoke.e10.camp" = {
Expand Down
2 changes: 1 addition & 1 deletion hosts/matrix/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
profiles.networking.printing
profiles.power.tripp-lite-smart1500lcd
profiles.services.attic-watch-store.default
profiles.services.bentopdf
profiles.services.changedetection-io
profiles.services.e10-land
profiles.services.glance.default
profiles.services.mazanoke
profiles.services.miniflux.default
profiles.services.netbox.default
profiles.services.paperless.default
profiles.services.stirling-pdf
profiles.telemetry.prometheus-nut-exporter
profiles.virtualisation.docker
profiles.web-servers.caddy
Expand Down
64 changes: 64 additions & 0 deletions modules/nixos/services/bentopdf/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{ config, lib, pkgs, ... }:

with lib;

let cfg = config.services.bentopdf;
in {
options.services.bentopdf = {
enable = mkEnableOption "Enable bentopdf";

package = mkPackageOption pkgs "bentopdf" {
extraDescription = ''
To use the "simple mode" variant of bentopdf, which removes all socials, marketing and explanatory texts,
set this option to `pkgs.bentopdf.overrideAttrs { SIMPLE_MODE = true; }`
'';
};

host = mkOption {
type = types.str;
default = "0.0.0.0";
description = "The host to listen on.";
};

port = mkOption {
type = types.port;
default = 4152;
description = "The port nginx is listening on for bentopdf.";
};

openFirewall = mkOption {
type = types.bool;
default = false;
description = "Open the port nginx is listening on for bentopdf.";
};
};

config = mkIf cfg.enable {
services.nginx = {
enable = true;

virtualHosts."bentopdf" = {
listen = [{
addr = cfg.host;
inherit (cfg) port;
}];

root = cfg.package;

locations."/".extraConfig = ''
try_files $uri $uri/ /index.html;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
'';

locations."~* .(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$".extraConfig =
''
expires 1y;
add_header Cache-Control "public, immutable";
'';
};
};

networking.firewall.allowedTCPPorts = optional cfg.openFirewall cfg.port;
};
}
3 changes: 2 additions & 1 deletion modules/overlays/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
# This is to pick up bugfix here: https://github.com/thanos-io/thanos/issues/7923
inherit (nixpkgs-master) thanos;

inherit (self'.packages) fileflows mongodb-ce-6_0; # caddy-with-plugins;
inherit (self'.packages)
bentopdf fileflows mongodb-ce-6_0; # caddy-with-plugins;
};
};
}
35 changes: 35 additions & 0 deletions modules/packages/bentopdf/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ lib, buildNpmPackage, fetchFromGitHub, }:

buildNpmPackage (finalAttrs: {
version = "1.11.2";
pname = "bentopdf";

src = fetchFromGitHub {
owner = "alam00000";
repo = "bentopdf";
tag = "v${finalAttrs.version}";
hash = "sha256-br4My0Q4zoA+ZIrXM4o4oQjZ7IpSdwg+iKiAUdc2B/s=";
};
npmDepsHash = "sha256-UNNNYO7e7qdumI0/ka2ieFZzKURPl1V3981vHCPcVfY=";

npmBuildScript = "build";
npmBuildFlags = [ "--" "--mode" "production" ];

installPhase = ''
runHook preInstall

mkdir -p $out
cp -r dist/* $out/

runHook postInstall
'';

meta = {
description = "Privacy-first PDF toolkit";
mainProgram = "bentopdf";
homepage = "https://bentopdf.com";
changelog = "https://github.com/alam00000/bentopdf/releases";
license = lib.licenses.asl20;
maintainers = [ ];
};
})
3 changes: 2 additions & 1 deletion modules/packages/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
_: {
perSystem = { pkgs, ... }: {
packages = {
mongodb-ce-6_0 = pkgs.callPackage ./mongodb-ce-6_0 { };
bentopdf = pkgs.callPackage ./bentopdf { };
fileflows = pkgs.callPackage ./fileflows { };
mongodb-ce-6_0 = pkgs.callPackage ./mongodb-ce-6_0 { };
};
};
}
2 changes: 1 addition & 1 deletion modules/profiles/observability/gatus/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ in { config, lib, ... }: {
group = "Matrix";
})
(mkEndpoint {
name = "Stirling PDF";
name = "BentoPDF";
url = "https://pdf.e10.camp";
group = "Matrix";
protected = true;
Expand Down
7 changes: 7 additions & 0 deletions modules/profiles/services/bentopdf.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ pkgs, ... }: {
services.bentopdf = {
enable = true;
package = pkgs.bentopdf.overrideAttrs { SIMPLE_MODE = true; };
openFirewall = true;
};
}
4 changes: 2 additions & 2 deletions modules/profiles/services/glance/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@
icon = "di:blocky";
}
{
title = "Stirling PDF";
title = "BentoPDF";
url = "https://pdf.e10.camp";
icon = "di:stirling-pdf";
icon = "di:bentopdf";
alt-status-codes = [ 401 ];
}
{
Expand Down
6 changes: 0 additions & 6 deletions modules/profiles/services/stirling-pdf.nix

This file was deleted.

Loading