mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 21:01:34 +01:00
Add paperless-ngx container
This commit is contained in:
parent
65bd45bfac
commit
2c347bab77
8 changed files with 125 additions and 15 deletions
15
hosts/stratus/containers/default.nix
Normal file
15
hosts/stratus/containers/default.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
networking.useNetworkd = true;
|
||||
systemd.network = {
|
||||
enable = true;
|
||||
networks."40-eno1" = {
|
||||
matchConfig.Name = "eno1";
|
||||
networkConfig.DHCP = "yes";
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
./nextcloud
|
||||
./paperless
|
||||
];
|
||||
}
|
||||
|
|
@ -7,26 +7,21 @@
|
|||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /var/lib/tailscale-nextcloud - - -"
|
||||
"d /data/nextcloud - - -"
|
||||
"d /var/lib/tailscale-nextcloud - - -"
|
||||
];
|
||||
|
||||
networking.useNetworkd = true;
|
||||
systemd.network = {
|
||||
enable = true;
|
||||
networks."40-eno1" = {
|
||||
matchConfig.Name = "eno1";
|
||||
networkConfig.DHCP = "yes";
|
||||
};
|
||||
};
|
||||
|
||||
containers.nextcloud = {
|
||||
autoStart = true;
|
||||
ephemeral = true;
|
||||
macvlans = [ "eno1" ];
|
||||
|
||||
bindMounts = {
|
||||
# Secrets
|
||||
"/run/secrets/nextcloud".isReadOnly = false;
|
||||
"/run/secrets/tailscale-auth-key" = { };
|
||||
|
||||
# State
|
||||
"/data/nextcloud".isReadOnly = false;
|
||||
"/var/lib/tailscale" = {
|
||||
hostPath = "/var/lib/tailscale-nextcloud";
|
||||
|
|
@ -41,7 +36,7 @@
|
|||
{ domain, ... }:
|
||||
{
|
||||
system.stateVersion = "24.05";
|
||||
|
||||
|
||||
networking = {
|
||||
inherit domain;
|
||||
useNetworkd = true;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
enable = true;
|
||||
authKeyFile = "/run/secrets/tailscale-auth-key";
|
||||
useRoutingFeatures = "server";
|
||||
openFirewall = true;
|
||||
interfaceName = "userspace-networking";
|
||||
extraUpFlags = [ "--ssh" ];
|
||||
};
|
||||
|
|
|
|||
60
hosts/stratus/containers/paperless/default.nix
Normal file
60
hosts/stratus/containers/paperless/default.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
sops.secrets = {
|
||||
"paperless-admin-password" = { };
|
||||
tailscale-auth-key = { };
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /data/paperless - - -"
|
||||
"d /var/lib/tailscale-paperless - - -"
|
||||
];
|
||||
|
||||
containers.paperless = {
|
||||
autoStart = true;
|
||||
ephemeral = true;
|
||||
macvlans = [ "eno1" ];
|
||||
|
||||
bindMounts = {
|
||||
# Secrets
|
||||
"/run/secrets/paperless-admin-password" = { };
|
||||
"/run/secrets/tailscale-auth-key" = { };
|
||||
|
||||
# State
|
||||
"/data/paperless".isReadOnly = false;
|
||||
"/var/lib/tailscale" = {
|
||||
hostPath = "/var/lib/tailscale-paperless";
|
||||
isReadOnly = false;
|
||||
};
|
||||
};
|
||||
|
||||
specialArgs = {
|
||||
inherit (config.networking) domain;
|
||||
};
|
||||
config =
|
||||
{ domain, ... }:
|
||||
{
|
||||
system.stateVersion = "24.05";
|
||||
|
||||
networking = {
|
||||
inherit domain;
|
||||
useNetworkd = true;
|
||||
useHostResolvConf = false;
|
||||
};
|
||||
systemd.network = {
|
||||
enable = true;
|
||||
networks."40-mv-eno1" = {
|
||||
matchConfig.Name = "mv-eno1";
|
||||
address = [ "192.168.2.253/24" ];
|
||||
networkConfig.DHCP = "yes";
|
||||
dhcpV4Config.ClientIdentifier = "mac";
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
./paperless.nix
|
||||
./tailscale.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
8
hosts/stratus/containers/paperless/paperless.nix
Normal file
8
hosts/stratus/containers/paperless/paperless.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
services.paperless = {
|
||||
enable = true;
|
||||
dataDir = "/data/paperless";
|
||||
passwordFile = "/run/secrets/paperless-admin-password";
|
||||
settings.PAPERLESS_OCR_LANGUAGE = "deu+eng";
|
||||
};
|
||||
}
|
||||
31
hosts/stratus/containers/paperless/tailscale.nix
Normal file
31
hosts/stratus/containers/paperless/tailscale.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
services.tailscale = {
|
||||
enable = true;
|
||||
authKeyFile = "/run/secrets/tailscale-auth-key";
|
||||
useRoutingFeatures = "server";
|
||||
openFirewall = true;
|
||||
interfaceName = "userspace-networking";
|
||||
extraUpFlags = [ "--ssh" ];
|
||||
};
|
||||
|
||||
systemd.services.nextcloud-serve = {
|
||||
after = [
|
||||
"tailscaled.service"
|
||||
"tailscaled-autoconnect.service"
|
||||
];
|
||||
wants = [ "tailscaled.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
${lib.getExe pkgs.tailscale} cert ${config.networking.fqdn}
|
||||
${lib.getExe pkgs.tailscale} serve reset
|
||||
${lib.getExe pkgs.tailscale} serve --bg 28981
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue