firefox sync

This commit is contained in:
Henri Dohmen 2025-07-15 20:58:17 +02:00
parent 7bc095fcea
commit 42ff53de0f
Signed by: hd
GPG key ID: AB79213B044674AE
8 changed files with 54 additions and 38 deletions

View file

@ -49,6 +49,7 @@ in
enable = true; enable = true;
settings = { settings = {
"identity.fxaccounts.enabled" = true; "identity.fxaccounts.enabled" = true;
"identity.sync.tokenserver.uri" = "http://fx-sync.lan/1.0/sync/1.5";
"webgl.disabled" = false; "webgl.disabled" = false;
"privacy.resistFingerprinting" = false; "privacy.resistFingerprinting" = false;
"privacy.clearOnShutdown.history" = false; "privacy.clearOnShutdown.history" = false;

View file

@ -1,5 +1,4 @@
{ lib', ... }: _: {
{
networking.hostName = "roam"; networking.hostName = "roam";
age.identityPaths = [ age.identityPaths = [
@ -8,6 +7,7 @@
imports = [ imports = [
./backup.nix ./backup.nix
./firefox-sync.nix
./git.nix ./git.nix
./hardware-configuration.nix ./hardware-configuration.nix
./networking.nix ./networking.nix

View file

@ -0,0 +1,32 @@
{
pkgs,
config,
secrets,
...
}:
{
services.mysql.package = pkgs.mariadb;
age.secrets.roam-firefox-sync-secret = {
file = secrets.roam."firefox-sync-secret.age";
mode = "440";
owner = "root";
group = "root";
};
services.firefox-syncserver = {
enable = true;
secrets = config.age.secrets.roam-firefox-sync-secret.path;
singleNode = {
enable = true;
hostname = "fx-sync.lan";
enableTLS = false;
};
};
services.nginx.virtualHostsPriv."fx-sync.lan" = {
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.firefox-syncserver.settings.port}";
recommendedProxySettings = true;
};
};
}

View file

@ -6,16 +6,16 @@
services = { services = {
nginx = { nginx = {
enable = true; enable = true;
defaultListen = [ virtualHosts.default = {
{ serverName = "_";
addr = var.wg.ips.roam; default = true;
ssl = true; rejectSSL = true;
} locations."/".return = "444";
]; };
virtualHosts."roam.lan" = { virtualHostsPriv."roam.lan" = {
locations."/" = { }; locations."/" = { };
}; };
virtualHostsPub."roam.hdohmen.de" = { virtualHosts."roam.hdohmen.de" = {
enableACME = true; enableACME = true;
locations."/" = { }; locations."/" = { };
}; };

View file

@ -2,14 +2,15 @@
lib, lib,
options, options,
config, config,
var,
... ...
}: }:
with lib; with lib;
{ {
options.services.nginx.virtualHostsPub = mkOption { options.services.nginx.virtualHostsPriv = mkOption {
type = options.services.nginx.virtualHosts.type; type = options.services.nginx.virtualHosts.type;
default = { }; default = { };
description = "Declarative vhost config listening to ::0 and 0.0.0.0"; description = "Declarative vhost config listening on onet";
}; };
config = { config = {
@ -17,28 +18,13 @@ with lib;
_: v: _: v:
v v
// { // {
addSSL = true;
listen = [ listen = [
{ {
addr = "0.0.0.0"; addr = var.wg.ips.roam;
port = 443;
ssl = true;
}
{
addr = "0.0.0.0";
port = 80;
}
{
addr = "[::0]";
port = 443;
ssl = true;
}
{
addr = "[::0]";
port = 80; port = 80;
} }
]; ];
} }
) config.services.nginx.virtualHostsPub; ) config.services.nginx.virtualHostsPriv;
}; };
} }

View file

@ -4,6 +4,7 @@ let
keys = (import ./var { inherit lib; }).ssh-keys.root; keys = (import ./var { inherit lib; }).ssh-keys.root;
secrets = [ secrets = [
"roam/rclone-conf" "roam/rclone-conf"
"roam/firefox-sync-secret"
"hd-password" "hd-password"
]; ];
in in

Binary file not shown.

View file

@ -1,18 +1,14 @@
{ lib, var, ... }: { lib, var, ... }:
let let
lan-tld = ".lan";
lan-base-domain = ".hdohmen.de";
lan-hosts = lib.mapAttrs' (name: value: { lan-hosts = lib.mapAttrs' (name: value: {
name = "${name}${lan-tld}"; name = "${name}.lan";
inherit value; inherit value;
}) var.wg.ips; }) var.wg.ips;
custom-hosts = {
"fx-sync.lan" = var.wg.ips.roam;
};
in in
rec { rec {
hostsFile = lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "${v}\t${n}") hosts); hostsFile = lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "${v}\t${n}") hosts);
hosts = hosts = lan-hosts // custom-hosts;
lan-hosts
// lib.mapAttrs' (name: value: {
name = "${name}${lan-base-domain}";
inherit value;
}) lan-hosts;
} }