nixfiles/nixos/boxes/kelder/containers/spoder/default.nix

113 lines
3.0 KiB
Nix
Raw Normal View History

{ lib, ... }:
let
inherit (lib) mkForce mkMerge;
inherit (lib.my) net;
2023-11-02 13:41:50 +00:00
inherit (lib.my.c.kelder) domain prefixes;
in
{
nixos.systems.kelder-spoder = { config, ... }: {
system = "x86_64-linux";
nixpkgs = "mine";
rendered = config.configuration.config.my.asContainer;
assignments = {
internal = {
name = "spoder-ctr";
inherit domain;
ipv4.address = net.cidr.host 3 prefixes.ctrs.v4;
};
};
configuration = { lib, pkgs, config, assignments, ... }:
let
inherit (lib.my) networkdAssignment;
in
{
imports = [ ./nginx.nix ];
config = {
my = {
deploy.enable = false;
server.enable = true;
user.config.name = "kontent";
secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBdYyebQv/bBLbat1Csnr1/VMPKsi99PiLOXyKeQb7oX";
files = {
"kelder/cloudflare-credentials.conf" = {
owner = "acme";
group = "acme";
};
2023-05-28 00:14:04 +01:00
"kelder/nextcloud-root.txt" = {
owner = "nextcloud";
group = "nextcloud";
};
};
};
};
security.acme = {
acceptTerms = true;
defaults = {
email = "dev@nul.ie";
server = "https://acme-v02.api.letsencrypt.org/directory";
reloadServices = [ "nginx" ];
dnsResolver = "8.8.8.8";
};
certs = {
2023-11-02 13:41:50 +00:00
"${domain}" = {
extraDomainNames = [
2023-11-02 13:41:50 +00:00
"*.${domain}"
];
dnsProvider = "cloudflare";
credentialsFile = config.age.secrets."kelder/cloudflare-credentials.conf".path;
};
};
};
users = {
2023-11-02 13:41:50 +00:00
groups.storage.gid = lib.my.c.kelder.groups.storage;
users = {
nginx.extraGroups = [ "acme" ];
"${config.my.user.config.name}".extraGroups = [ "storage" ];
};
};
systemd = {
network.networks."80-container-host0" = mkMerge [
(networkdAssignment "host0" assignments.internal)
{
linkConfig.MTUBytes = "1420";
}
];
services = {
radarr.serviceConfig.UMask = "0002";
sonarr.serviceConfig.UMask = "0002";
};
};
services = {
resolved.extraConfig = mkForce "";
2023-05-28 00:14:04 +01:00
nextcloud = {
enable = true;
package = pkgs.nextcloud27;
2023-05-28 00:14:04 +01:00
datadir = "/mnt/storage/nextcloud";
2023-11-02 13:41:50 +00:00
hostName = "cloud.${domain}";
2023-05-28 00:14:04 +01:00
https = true;
config = {
2023-11-02 13:41:50 +00:00
extraTrustedDomains = [ "cloud-local.${domain}" ];
2023-05-28 00:14:04 +01:00
adminpassFile = config.age.secrets."kelder/nextcloud-root.txt".path;
defaultPhoneRegion = "IE";
};
extraOptions = {
updatechecker = false;
};
2023-05-28 00:14:04 +01:00
};
};
};
};
};
}