Compare commits

..

3 commits

Author SHA1 Message Date
f03cb23109 modules: services: matrix: add sliding sync
Some checks failed
ci/woodpecker/push/check Pipeline failed
2023-09-28 15:57:14 +00:00
ec6fb2efa7 hosts: nixos: porthos: secrets: add matrix sync 2023-09-28 15:57:14 +00:00
57cf518ca2 modules: services: matrix: refactor vhost 2023-09-28 15:57:14 +00:00
12 changed files with 49 additions and 62 deletions

12
.envrc
View file

@ -1,8 +1,10 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.4.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.4.0/direnvrc" "sha256-XQzUAvL6pysIJnRJyR7uVpmUSZfc7LSgWQwq/4mBr1U="
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
nix_direnv_watch_file ./flake/checks.nix
nix_direnv_watch_file ./flake/dev-shells.nix
use flake
watch_file ./flake/checks.nix
watch_file ./flake/dev-shells.nix
eval "$shellHooks"

View file

@ -5,11 +5,25 @@ in
{
options.my.home.comma = with lib; {
enable = my.mkDisableOption "comma configuration";
pkgsFlake = mkOption {
type = types.str;
default = "pkgs";
example = "nixpkgs";
description = ''
Which flake from the registry should be used with
<command>nix shell</command>.
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
ambroisie.comma
];
home.sessionVariables = {
COMMA_PKGS_FLAKE = cfg.pkgsFlake;
};
};
}

View file

@ -47,7 +47,6 @@ in
LESSHISTFILE = "${dataHome}/less/history";
LESSKEY = "${configHome}/less/lesskey";
PSQL_HISTORY = "${dataHome}/psql_history";
REPO_CONFIG_DIR = "${configHome}/repo";
REDISCLI_HISTFILE = "${dataHome}/redis/rediscli_history";
XCOMPOSECACHE = "${dataHome}/X11/xcompose";
};

View file

@ -1,5 +1,5 @@
# Google Cloudtop configuration
{ lib, pkgs, ... }:
{ ... }:
{
# Google specific configuration
home.homeDirectory = "/usr/local/google/home/ambroisie";
@ -13,8 +13,6 @@
LD_PRELOAD = "/lib/x86_64-linux-gnu/libnss_cache.so.2\${LD_PRELOAD:+:}$LD_PRELOAD";
};
programs.git.package = lib.mkForce pkgs.emptyDirectory;
# I use scripts that use the passthrough sequence often on this host
my.home.tmux.enablePassthrough = true;
}

View file

@ -119,13 +119,7 @@ in
secretKeyFile = secrets."paperless/secret-key".path;
};
# The whole *arr software suite
pirate = {
enable = true;
# ... But not Lidarr because I don't care for music that much
lidarr = {
enable = false;
};
};
pirate.enable = true;
# Podcast automatic downloader
podgrab = {
enable = true;

View file

@ -27,6 +27,8 @@ in
};
slidingSync = {
enable = my.mkDisableOption "sliding sync";
port = mkOption {
type = types.port;
default = 8009;
@ -105,12 +107,12 @@ in
cfg.mailConfigFile
] ++ lib.optional (cfg.secretFile != null) cfg.secretFile;
sliding-sync = {
sliding-sync = lib.mkIf cfg.slidingSync.enable {
enable = true;
settings = {
SYNCV3_SERVER = "https://${matrixDomain}";
SYNCV3_BINDADDR = "127.0.0.1:${toString cfg.slidingSync.port}";
SYNCV3_BINDADDR = "127.0.0.1:${cfg.slidingSync.port}";
};
environmentFile = cfg.slidingSync.secretFile;
@ -131,9 +133,6 @@ in
"m.identity_server" = {
"base_url" = "https://vector.im";
};
"org.matrix.msc3575.proxy" = {
"url" = "https://matrix-sync.${matrixDomain}";
};
};
showLabsSettings = true;
defaultCountryCode = "FR"; # cocorico
@ -146,20 +145,6 @@ in
};
};
}
# Dummy VHosts for port collision detection
{
subdomain = "matrix-federation";
port = federationPort.private;
}
{
subdomain = "matrix-client";
port = clientPort.private;
}
# Sliding sync
{
subdomain = "matrix-sync";
inherit (cfg.slidingSync) port;
}
];
# Those are too complicated to use my wrapper...
@ -232,7 +217,6 @@ in
client = {
"m.homeserver" = { "base_url" = "https://${matrixDomain}"; };
"m.identity_server" = { "base_url" = "https://vector.im"; };
"org.matrix.msc3575.proxy" = { "url" = "https://matrix-sync.${matrixDomain}"; };
};
# ACAO required to allow element-web on any URL to request this json file
in

View file

@ -29,7 +29,7 @@ let
];
};
mkFail2Ban = service: lib.mkIf cfg.${service}.enable {
mkFail2Ban = service: {
services.fail2ban.jails = {
${service} = ''
enabled = true
@ -47,30 +47,14 @@ let
};
};
mkFullConfig = service: lib.mkIf cfg.${service}.enable (lib.mkMerge [
mkFullConfig = service: lib.mkMerge [
(mkService service)
(mkRedirection service)
]);
];
in
{
options.my.services.pirate = {
enable = lib.mkEnableOption "Media automation";
bazarr = {
enable = lib.my.mkDisableOption "Bazarr";
};
lidarr = {
enable = lib.my.mkDisableOption "Lidarr";
};
radarr = {
enable = lib.my.mkDisableOption "Radarr";
};
sonarr = {
enable = lib.my.mkDisableOption "Sonarr";
};
};
config = lib.mkIf cfg.enable (lib.mkMerge [

View file

@ -3,7 +3,7 @@
# Inspired by [1]
#
# [1]: https://github.com/delroth/infra.delroth.net/blob/master/roles/seedbox.nix
{ config, lib, pkgs, ... }:
{ config, lib, ... }:
let
cfg = config.my.services.transmission;
in
@ -45,7 +45,6 @@ in
config = lib.mkIf cfg.enable {
services.transmission = {
enable = true;
package = pkgs.transmission_4;
group = "media";
downloadDirPermissions = "775";

View file

@ -27,6 +27,9 @@ in
# Make sure it is activated in that case
my.system.docker.enable = true;
# FIXME: figure out the issue
services.unbound.resolveLocalQueries = false;
# Adjust runner service for nix usage
systemd.services.woodpecker-agent-docker = {
after = [ "docker.socket" ]; # Needs the socket to be available

View file

@ -30,4 +30,4 @@ if [ -z "$PROGRAM" ]; then
exit 1
fi
nix shell "${COMMA_NIXPKGS_FLAKE:-nixpkgs}#$PROGRAM" -c "$@"
nix shell "${COMMA_PKGS_FLAKE:-nixpkgs}#$PROGRAM" -c "$@"

View file

@ -1,5 +1,10 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.4.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.4.0/direnvrc" "sha256-XQzUAvL6pysIJnRJyR7uVpmUSZfc7LSgWQwq/4mBr1U="
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
use flake
watch_file ./flake/checks.nix
watch_file ./flake/dev-shells.nix
eval "$shellHooks"

View file

@ -1,5 +1,10 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.4.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.4.0/direnvrc" "sha256-XQzUAvL6pysIJnRJyR7uVpmUSZfc7LSgWQwq/4mBr1U="
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
use flake
watch_file ./flake/checks.nix
watch_file ./flake/dev-shells.nix
eval "$shellHooks"