Compare commits
8 Commits
matrix
...
c7ee0c1acb
Author | SHA1 | Date | |
---|---|---|---|
c7ee0c1acb
|
|||
33f55317f7
|
|||
9057ebf7fd
|
|||
6f98fbb5cd
|
|||
f44a098f80
|
|||
4aa27cf9bb
|
|||
2a92ded7db
|
|||
4f13020601
|
6
flake.lock
generated
6
flake.lock
generated
@@ -186,11 +186,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_3": {
|
"nixpkgs_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703200384,
|
"lastModified": 1703467016,
|
||||||
"narHash": "sha256-q5j06XOsy0qHOarsYPfZYJPWbTbc8sryRxianlEPJN0=",
|
"narHash": "sha256-/5A/dNPhbQx/Oa2d+Get174eNI3LERQ7u6WTWOlR1eQ=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "0b3d618173114c64ab666f557504d6982665d328",
|
"rev": "d02d818f22c777aa4e854efc3242ec451e5d462a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@@ -1,8 +1,11 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
snd-usb-audio-module = pkgs.callPackage ./snd-usb-audio.nix {
|
snd-usb-audio-module = pkgs.callPackage ./snd-usb-audio.nix {
|
||||||
kernel = config.boot.kernelPackages.kernel;
|
kernel = config.boot.kernelPackages.kernel;
|
||||||
};
|
};
|
||||||
|
patched = snd-usb-audio-module.overrideAttrs (prev: {
|
||||||
|
patches = [ ./0001-Update-device-ID-for-PreSonus-1824c.patch ];
|
||||||
|
});
|
||||||
upmixConfig = ''
|
upmixConfig = ''
|
||||||
stream.properties = {
|
stream.properties = {
|
||||||
channelmix.upmix = true
|
channelmix.upmix = true
|
||||||
@@ -10,10 +13,9 @@ let
|
|||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
|
boot.kernelModules = [ "snd-usb-audio" ];
|
||||||
boot.extraModulePackages = [
|
boot.extraModulePackages = [
|
||||||
(snd-usb-audio-module.overrideAttrs (_: {
|
(patched)
|
||||||
patches = [ ./0001-Update-device-ID-for-PreSonus-1824c.patch ];
|
|
||||||
}))
|
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.etc = {
|
environment.etc = {
|
||||||
|
@@ -64,5 +64,9 @@
|
|||||||
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
pkgs.apfs-fuse
|
||||||
|
];
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
}
|
}
|
||||||
|
@@ -17,8 +17,59 @@
|
|||||||
};
|
};
|
||||||
deviceTree = {
|
deviceTree = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
filter = "*rpi-4-*.dtb";
|
||||||
overlays = [
|
overlays = [
|
||||||
{ name = "hifiberry-digi-pro"; dtboFile = "${pkgs.device-tree_rpi.overlays}/hifiberry-digi-pro.dtbo"; }
|
{
|
||||||
|
# Adapted from: https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts
|
||||||
|
# changes:
|
||||||
|
# - modified top-level "compatible" field from bcm2835 to bcm2711
|
||||||
|
# - s/i2s_clk_consumer/i2s/ (name on bcm2711 platform)
|
||||||
|
name = "hifiberry-digi-pro";
|
||||||
|
dtsText = ''
|
||||||
|
/dts-v1/;
|
||||||
|
/plugin/;
|
||||||
|
|
||||||
|
/ {
|
||||||
|
compatible = "brcm,bcm2711";
|
||||||
|
|
||||||
|
fragment@0 {
|
||||||
|
target = <&i2s>;
|
||||||
|
__overlay__ {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment@1 {
|
||||||
|
target = <&i2c1>;
|
||||||
|
__overlay__ {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
wm8804@3b {
|
||||||
|
#sound-dai-cells = <0>;
|
||||||
|
compatible = "wlf,wm8804";
|
||||||
|
reg = <0x3b>;
|
||||||
|
PVDD-supply = <&vdd_3v3_reg>;
|
||||||
|
DVDD-supply = <&vdd_3v3_reg>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment@2 {
|
||||||
|
target = <&sound>;
|
||||||
|
__overlay__ {
|
||||||
|
compatible = "hifiberry,hifiberry-digi";
|
||||||
|
i2s-controller = <&i2s>;
|
||||||
|
status = "okay";
|
||||||
|
clock44-gpio = <&gpio 5 0>;
|
||||||
|
clock48-gpio = <&gpio 6 0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
firmware = with pkgs; [
|
firmware = with pkgs; [
|
||||||
|
@@ -30,8 +30,6 @@
|
|||||||
./security/gpg.nix
|
./security/gpg.nix
|
||||||
./security/pass.nix
|
./security/pass.nix
|
||||||
./services/borgmatic
|
./services/borgmatic
|
||||||
./services/coturn
|
|
||||||
./services/matrix
|
|
||||||
./shell/git
|
./shell/git
|
||||||
./shell/zsh
|
./shell/zsh
|
||||||
];
|
];
|
||||||
|
@@ -26,7 +26,7 @@ in {
|
|||||||
wireless = {
|
wireless = {
|
||||||
enable = true;
|
enable = true;
|
||||||
interfaces = cfg.interfaces;
|
interfaces = cfg.interfaces;
|
||||||
environmentFile = config.age.secrets.passwords/networks.path;
|
environmentFile = config.age.secrets."passwords/networks".path;
|
||||||
networks = {
|
networks = {
|
||||||
"Apollo 600 Mbps".psk = "@PSK_APOLLO@";
|
"Apollo 600 Mbps".psk = "@PSK_APOLLO@";
|
||||||
};
|
};
|
||||||
|
@@ -1,59 +0,0 @@
|
|||||||
{ config, lib, pkgs, inputs, ... }:
|
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.modules.services.coturn;
|
|
||||||
domain = "vimium.com";
|
|
||||||
in {
|
|
||||||
options.modules.services.coturn = {
|
|
||||||
enable = mkOption {
|
|
||||||
default = false;
|
|
||||||
example = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
age.secrets."passwords/services/coturn/secret" = {
|
|
||||||
file = "${inputs.secrets}/passwords/services/coturn/secret.age";
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.firewall = {
|
|
||||||
allowedTCPPorts = [
|
|
||||||
5349 # STUN TLS
|
|
||||||
5350 # STUN TLS alt
|
|
||||||
];
|
|
||||||
allowedUDPPortRanges = [
|
|
||||||
{ from = 49152; to = 49999; } # TURN relay
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
services.coturn = {
|
|
||||||
enable = true;
|
|
||||||
lt-cred-mech = true;
|
|
||||||
use-auth-secret = true;
|
|
||||||
static-auth-secret = ""; # TODO: Pass as extraConfig
|
|
||||||
realm = "turn.${domain}";
|
|
||||||
relay-ips = [
|
|
||||||
"198.244.190.160"
|
|
||||||
];
|
|
||||||
no-tcp-relay = true;
|
|
||||||
extraConfig = ''
|
|
||||||
cipher-list="HIGH"
|
|
||||||
no-loopback-peers
|
|
||||||
no-multicast-peers
|
|
||||||
'';
|
|
||||||
secure-stun = true;
|
|
||||||
cert = "/var/lib/acme/turn.${domain}/fullchain.pem";
|
|
||||||
pkey = "/var/lib/acme/turn.${domain}/key.pem";
|
|
||||||
min-port = 49152;
|
|
||||||
max-port = 49999;
|
|
||||||
};
|
|
||||||
|
|
||||||
security.acme.certs = {
|
|
||||||
"turn.${domain}" = {
|
|
||||||
reloadServices = [ "coturn" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@@ -1,120 +0,0 @@
|
|||||||
{ config, lib, pkgs, inputs, ... }:
|
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.modules.services.matrix;
|
|
||||||
domain = "vimium.com";
|
|
||||||
clientConfig = {
|
|
||||||
"m.homeserver" = {
|
|
||||||
base_url = "https://matrix.${domain}";
|
|
||||||
server_name = domain;
|
|
||||||
};
|
|
||||||
"m.identity_server" = {};
|
|
||||||
};
|
|
||||||
serverConfig."m.server" = "matrix.${domain}:443";
|
|
||||||
mkWellKnown = data: ''
|
|
||||||
more_set_headers 'Content-Type: application/json';
|
|
||||||
return 200 '${builtins.toJSON data}';
|
|
||||||
'';
|
|
||||||
in {
|
|
||||||
options.modules.services.matrix = {
|
|
||||||
enable = mkOption {
|
|
||||||
default = false;
|
|
||||||
example = true;
|
|
||||||
};
|
|
||||||
coturn = mkOption {
|
|
||||||
default = config.services.coturn.enable;
|
|
||||||
example = true;
|
|
||||||
};
|
|
||||||
elementWeb = mkOption {
|
|
||||||
default = true;
|
|
||||||
example = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
networking.firewall = {
|
|
||||||
allowedTCPPorts = [
|
|
||||||
8448 # Matrix federation
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
services.nginx = {
|
|
||||||
virtualHosts = {
|
|
||||||
"${domain}" = {
|
|
||||||
# Assume this listener is already setup
|
|
||||||
locations."= /.well-known/matrix/server".extraConfig = (mkWellKnown serverConfig);
|
|
||||||
locations."= /.well-known/matrix/client".extraConfig = (mkWellKnown clientConfig);
|
|
||||||
};
|
|
||||||
"matrix.${domain}" = {
|
|
||||||
forceSSL = true;
|
|
||||||
useACMEHost = "matrix.${domain}";
|
|
||||||
listen = [
|
|
||||||
{ addr = "0.0.0.0"; port = 443; ssl = true; }
|
|
||||||
{ addr = "0.0.0.0"; port = 80; }
|
|
||||||
{ addr = "0.0.0.0"; port = 8448; ssl = true; }
|
|
||||||
{ addr = "[::1]"; port = 443; ssl = true; }
|
|
||||||
{ addr = "[::1]"; port = 80; }
|
|
||||||
{ addr = "[::1]"; port = 8448; ssl = true; }
|
|
||||||
];
|
|
||||||
locations = {
|
|
||||||
"/" = {
|
|
||||||
proxyPass = "http://localhost:8008";
|
|
||||||
extraConfig = ''
|
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
"/_matrix" = {
|
|
||||||
proxyPass = "http://localhost:8008";
|
|
||||||
extraConfig = ''
|
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
|
||||||
client_max_body_size ${services.matrix-synapse.settings.max_upload_size};
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
"/_synapse/client".proxyPass = "http://localhost:8008";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"chat.${domain}" = mkIf cfg.elementWeb {
|
|
||||||
forceSSL = true;
|
|
||||||
useACMEHost = "matrix.${domain}";
|
|
||||||
root = pkgs.element-web.override {
|
|
||||||
conf = {
|
|
||||||
default_server_config = clientConfig;
|
|
||||||
brand = "Vimium Chat";
|
|
||||||
branding = {
|
|
||||||
auth_header_logo_url = "https://vimium.com/images/logo.svg";
|
|
||||||
auth_footer_links = [
|
|
||||||
{ text = "Vimium.com"; url = "https://www.vimium.com"; }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
services.matrix-synapse = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
database.name = "sqlite3";
|
|
||||||
enable_registration = false;
|
|
||||||
server_name = domain;
|
|
||||||
turn_shared_secret_file = mkIf cfg.coturn config.age.secrets."passwords/services/coturn/secret".path;
|
|
||||||
turn_uris = mkIf cfg.coturn [
|
|
||||||
"turn:${config.services.coturn.realm}:5349?transport=udp"
|
|
||||||
"turn:${config.services.coturn.realm}:5350?transport=udp"
|
|
||||||
"turn:${config.services.coturn.realm}:5349?transport=tcp"
|
|
||||||
"turn:${config.services.coturn.realm}:5350?transport=tcp"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
security.acme.certs = {
|
|
||||||
"matrix.${domain}" = {
|
|
||||||
extraDomainNames = mkIf cfg.elementWeb [ "chat.${domain}" ];
|
|
||||||
reloadServices = [ "matrix-synapse" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
Reference in New Issue
Block a user