Fix tmpfiles
This commit is contained in:
parent
a47f76d8c0
commit
0a9d28abdb
8 changed files with 146 additions and 107 deletions
|
@ -39,9 +39,7 @@
|
||||||
name = "monolith";
|
name = "monolith";
|
||||||
url = "https://git.henryhiles.com";
|
url = "https://git.henryhiles.com";
|
||||||
tokenFile = config.age.secrets."runnerToken.age".path;
|
tokenFile = config.age.secrets."runnerToken.age".path;
|
||||||
labels = [
|
labels = ["native:host"];
|
||||||
"native:host"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,95 +1,6 @@
|
||||||
{
|
{config, ...}: {
|
||||||
config,
|
services.livekit = {
|
||||||
lib,
|
enable = true;
|
||||||
pkgs,
|
keyFile = config.age.secrets."livekitKeys.age".path;
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.services.livekit;
|
|
||||||
in {
|
|
||||||
services.livekit.enable = true;
|
|
||||||
meta.maintainers = with lib.maintainers; [quadradical];
|
|
||||||
options.services.livekit = {
|
|
||||||
package = lib.mkPackageOption pkgs "livekit" {};
|
|
||||||
|
|
||||||
keyFile = lib.mkOption {
|
|
||||||
type = lib.types.path;
|
|
||||||
description = "LiveKit key file";
|
|
||||||
};
|
|
||||||
|
|
||||||
useExternalIP = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = false;
|
|
||||||
description = ''
|
|
||||||
When set to true, attempts to discover the host's public IP via STUN.
|
|
||||||
This is useful for cloud environments such as AWS & Google where hosts have an internal IP that maps to an external one
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
port = lib.mkOption {
|
|
||||||
type = lib.types.port;
|
|
||||||
default = 7880;
|
|
||||||
description = "Main TCP port for RoomService and RTC endpoint.";
|
|
||||||
};
|
|
||||||
|
|
||||||
rtc = {
|
|
||||||
portRangeStart = lib.mkOption {
|
|
||||||
type = lib.types.int;
|
|
||||||
default = 50000;
|
|
||||||
description = "Start of UDP port range for WebRTC";
|
|
||||||
};
|
|
||||||
|
|
||||||
portRangeEnd = lib.mkOption {
|
|
||||||
type = lib.types.int;
|
|
||||||
default = 51000;
|
|
||||||
description = "End of UDP port range for WebRTC";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
systemd.services.livekit = {
|
|
||||||
description = "LiveKit SFU server";
|
|
||||||
documentation = ["https://docs.livekit.io"];
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
wants = ["network-online.target"];
|
|
||||||
after = ["network-online.target"];
|
|
||||||
|
|
||||||
serviceConfig = {
|
|
||||||
DynamicUser = true;
|
|
||||||
User = "livekit";
|
|
||||||
LockPersonality = true;
|
|
||||||
MemoryDenyWriteExecute = true;
|
|
||||||
ProtectClock = true;
|
|
||||||
ProtectControlGroups = true;
|
|
||||||
ProtectHostname = true;
|
|
||||||
ProtectKernelLogs = true;
|
|
||||||
ProtectKernelModules = true;
|
|
||||||
ProtectKernelTunables = true;
|
|
||||||
PrivateDevices = true;
|
|
||||||
PrivateMounts = true;
|
|
||||||
PrivateUsers = true;
|
|
||||||
RestrictAddressFamilies = [
|
|
||||||
"AF_INET"
|
|
||||||
"AF_INET6"
|
|
||||||
];
|
|
||||||
RestrictNamespaces = true;
|
|
||||||
RestrictRealtime = true;
|
|
||||||
SystemCallArchitectures = "native";
|
|
||||||
SystemCallFilter = [
|
|
||||||
"@system-service"
|
|
||||||
"~@privileged"
|
|
||||||
];
|
|
||||||
ExecStart = "${cfg.package}/bin/livekit-server --config=${lib.generators.toJSON {
|
|
||||||
port = cfg.port;
|
|
||||||
rtc = {
|
|
||||||
port_range_start = cfg.rtc.portRangeStart;
|
|
||||||
port_range_end = cfg.rtc.portRangeEnd;
|
|
||||||
use_external_ip = cfg.useExternalIP;
|
|
||||||
};
|
|
||||||
}} --key-file=${cfg.keyFile}";
|
|
||||||
Restart = "on-failure";
|
|
||||||
RestartSec = 5;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
122
modules/common/services/livekit.nix
Normal file
122
modules/common/services/livekit.nix
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.services.livekit;
|
||||||
|
in {
|
||||||
|
meta.maintainers = with lib.maintainers; [quadradical];
|
||||||
|
options.services.livekit = {
|
||||||
|
enable = lib.mkEnableOption "Livekit SFU";
|
||||||
|
package = lib.mkPackageOption pkgs "livekit" {};
|
||||||
|
|
||||||
|
keyFile = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
description = "LiveKit key file, with syntax `LIVEKIT_KEYS=\"key: secret\"`;";
|
||||||
|
};
|
||||||
|
|
||||||
|
openFirewall = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Opens ports 50000 to 51000 on the firewall.";
|
||||||
|
};
|
||||||
|
|
||||||
|
useExternalIP = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
When set to true, attempts to discover the host's public IP via STUN.
|
||||||
|
This is useful for cloud environments such as AWS & Google where hosts have an internal IP that maps to an external one
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 7880;
|
||||||
|
description = "Main TCP port for RoomService and RTC endpoint.";
|
||||||
|
};
|
||||||
|
|
||||||
|
rtc = {
|
||||||
|
portRangeStart = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = 50000;
|
||||||
|
description = "Start of UDP port range for WebRTC";
|
||||||
|
};
|
||||||
|
|
||||||
|
portRangeEnd = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = 51000;
|
||||||
|
description = "End of UDP port range for WebRTC";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||||
|
allowedTCPPorts = [
|
||||||
|
cfg.port
|
||||||
|
];
|
||||||
|
allowedUDPPortRanges = [
|
||||||
|
{
|
||||||
|
from = cfg.rtc.port_range_start;
|
||||||
|
to = cfg.rtc.port_range_end;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.livekit = {
|
||||||
|
description = "LiveKit SFU server";
|
||||||
|
documentation = ["https://docs.livekit.io"];
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
wants = ["network-online.target"];
|
||||||
|
after = ["network-online.target"];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
EnvironmentFile = cfg.keyFile;
|
||||||
|
DynamicUser = true;
|
||||||
|
User = "livekit";
|
||||||
|
LockPersonality = true;
|
||||||
|
MemoryDenyWriteExecute = true;
|
||||||
|
ProtectClock = true;
|
||||||
|
ProtectControlGroups = true;
|
||||||
|
ProtectHostname = true;
|
||||||
|
ProtectKernelLogs = true;
|
||||||
|
ProtectKernelModules = true;
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
PrivateDevices = true;
|
||||||
|
PrivateMounts = true;
|
||||||
|
PrivateUsers = true;
|
||||||
|
RestrictAddressFamilies = [
|
||||||
|
"AF_INET"
|
||||||
|
"AF_INET6"
|
||||||
|
"AF_NETLINK"
|
||||||
|
];
|
||||||
|
RestrictNamespaces = true;
|
||||||
|
RestrictRealtime = true;
|
||||||
|
ProtectHome = true;
|
||||||
|
SystemCallArchitectures = "native";
|
||||||
|
SystemCallFilter = [
|
||||||
|
"@system-service"
|
||||||
|
"~@privileged"
|
||||||
|
"~@resources"
|
||||||
|
];
|
||||||
|
CapabilityBoundingSet = [
|
||||||
|
"CAP_NET_BIND_SERVICE"
|
||||||
|
"CAP_NET_RAW"
|
||||||
|
];
|
||||||
|
ExecStart = "${cfg.package}/bin/livekit-server --config-body=${builtins.toJSON (builtins.toJSON {
|
||||||
|
port = cfg.port;
|
||||||
|
rtc = {
|
||||||
|
port_range_start = cfg.rtc.portRangeStart;
|
||||||
|
port_range_end = cfg.rtc.portRangeEnd;
|
||||||
|
use_external_ip = cfg.useExternalIP;
|
||||||
|
};
|
||||||
|
})}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = 5;
|
||||||
|
UMask = "077";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
1
modules/common/services/lk-jwt-service.nix
Normal file
1
modules/common/services/lk-jwt-service.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{}
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
systemd.tmpfiles.settings.firefox = {
|
systemd.tmpfiles.settings.firefox = {
|
||||||
# "/home/quadradical/.mozilla/firefox/quadradical"."d".user = "quadradical";
|
# "/home/quadradical/.mozilla/firefox/quadradical"."d".user = "quadradical";
|
||||||
"/home/quadradical/.mozilla/firefox/profiles.ini"."f+".argument = builtins.toJSON (lib.generators.toINI {} {
|
"/home/quadradical/.mozilla/firefox/profiles.ini"."L+".argument = toString ((pkgs.formats.ini {}).generate "profiles.ini" {
|
||||||
General = {
|
General = {
|
||||||
StartWithLastProfile = 1;
|
StartWithLastProfile = 1;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
{
|
{pkgs, ...}: {
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
hardware.keyboard.qmk.enable = true;
|
hardware.keyboard.qmk.enable = true;
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
(pkgs.qmk.overrideAttrs (oldAttrs: {
|
(pkgs.qmk.overrideAttrs (oldAttrs: {
|
||||||
|
@ -12,7 +8,7 @@
|
||||||
|
|
||||||
systemd.tmpfiles.settings.qmk = {
|
systemd.tmpfiles.settings.qmk = {
|
||||||
"/home/quadradical/.config/qmk"."d".user = "quadradical";
|
"/home/quadradical/.config/qmk"."d".user = "quadradical";
|
||||||
"/home/quadradical/.config/qmk/qmk.ini"."f+".argument = lib.replaceStrings ["\n"] ["\\n"] (lib.generators.toINI {} {
|
"/home/quadradical/.config/qmk/qmk.ini"."L+".argument = toString ((pkgs.formats.ini {}).generate "qmk.ini" {
|
||||||
user = {
|
user = {
|
||||||
qmk_home = "/home/quadradical/Documents/Code/qmk_firmware";
|
qmk_home = "/home/quadradical/Documents/Code/qmk_firmware";
|
||||||
overlay_dir = "/home/quadradical/Documents/Code/qmk_userspace";
|
overlay_dir = "/home/quadradical/Documents/Code/qmk_userspace";
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
systemd.tmpfiles.settings.vscodium = {
|
systemd.tmpfiles.settings.vscodium = {
|
||||||
# "/home/quadradical/.config/VSCodium/User"."d".user = "quadradical";
|
# "/home/quadradical/.config/VSCodium/User"."d".user = "quadradical";
|
||||||
"/home/quadradical/.config/VSCodium/User/settings.json"."f+".argument = builtins.toJSON {
|
"/home/quadradical/.config/VSCodium/User/settings.json"."L+".argument = toString ((pkgs.formats.json {}).generate "settings.json" {
|
||||||
"arb-editor.suppressedWarnings" = ["missing_metadata_for_key"];
|
"arb-editor.suppressedWarnings" = ["missing_metadata_for_key"];
|
||||||
"dart.debugExternalPackageLibraries" = true;
|
"dart.debugExternalPackageLibraries" = true;
|
||||||
"dart.debugSdkLibraries" = true;
|
"dart.debugSdkLibraries" = true;
|
||||||
|
@ -105,9 +105,9 @@
|
||||||
};
|
};
|
||||||
"indentRainbow.ignoreErrorLanguages" = ["*"];
|
"indentRainbow.ignoreErrorLanguages" = ["*"];
|
||||||
"dart.runPubGetOnPubspecChanges" = "never";
|
"dart.runPubGetOnPubspecChanges" = "never";
|
||||||
};
|
});
|
||||||
|
|
||||||
"/home/quadradical/.config/VSCodium/User/keybindings.json"."f+".argument = builtins.toJSON [
|
"/home/quadradical/.config/VSCodium/User/keybindings.json"."L+".argument = toString ((pkgs.formats.json {}).generate "settings.json" [
|
||||||
{
|
{
|
||||||
key = "ctrl+s";
|
key = "ctrl+s";
|
||||||
command = "workbench.action.files.saveAll";
|
command = "workbench.action.files.saveAll";
|
||||||
|
@ -116,6 +116,6 @@
|
||||||
key = "ctrl+s";
|
key = "ctrl+s";
|
||||||
command = "-workbench.action.files.save";
|
command = "-workbench.action.files.save";
|
||||||
}
|
}
|
||||||
];
|
]);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
11
secrets/livekitKeys.age
Normal file
11
secrets/livekitKeys.age
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZLUVVkUSA0YlVy
|
||||||
|
aGI1NS9ZS0NtK0sySkhPcGIxRzR3dUp0UHltUlo4Zkp0NXNXVnd3CjJLaEh4bDdv
|
||||||
|
MGhoOHF6cjk5bUVNS0xvNnRyQVl4S3hzbjMxeUcwSGVlOFEKLT4gXWk5b2ItZ3Jl
|
||||||
|
YXNlIEkvNSBPLnY5Kwo3elZyWlhOa1gvZWxJUEdiRmNBRGYvUmVNeEFudnJBMXZV
|
||||||
|
Z3lJaHpKMkdQeWdadk9hc1RvVFhUUmI3UkFPMHcxCmI1T2Vjc3N0WDN2aWFQVmlU
|
||||||
|
QkJFbUdEOExnRlp2MjJaeXhkZzNGVEhxc21JQVk0R1U4MGtZU1EKLS0tIHBlTlVo
|
||||||
|
WFFUTjhkSnpRZXRwbWhHTm9HN21ZR0luNVNlRWZmNmE5MXpxUWsKXkQToeaUm3in
|
||||||
|
AKmPG75dH3GTggyAX78nFqt8JXcDzmGdUXt3bJ4G83Fs2XaY/irEAh1E8YQVznD8
|
||||||
|
4eCoK2abkca64ADUKzvYYjc0AfWMUqCGVIeXY1ZvQZ1g
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
Loading…
Add table
Add a link
Reference in a new issue