This commit is contained in:
2025-12-10 11:08:12 +07:00
parent 3b2b4ff2a4
commit b3d61ef94e
5 changed files with 91 additions and 64 deletions

View File

@@ -190,7 +190,7 @@
binds = [ "wlp1s0" ]; binds = [ "wlp1s0" ];
disks.m3 = { disks.m3 = {
uuid = "105D-319E"; uuid = "105D-319E";
mountOptions = ["utf8"]; mountOptions = [ "utf8" ];
}; };
}; };
}; };

View File

@@ -30,20 +30,24 @@
''; '';
}; };
networking.wireless = let networking.wireless =
credentials = config.clan.core.vars.generators.wireless-credentials.files; let
in { credentials = config.clan.core.vars.generators.wireless-credentials.files;
enable = true; in
secretsFile = credentials.psk.path; {
networks.${credentials.essid.value}.pskRaw = "ext:psk"; enable = true;
}; secretsFile = credentials.psk.path;
networks.${credentials.essid.value}.pskRaw = "ext:psk";
};
networking.interfaces.wlp1s0 = { networking.interfaces.wlp1s0 = {
useDHCP = false; useDHCP = false;
ipv4.addresses = [{ ipv4.addresses = [
address = "10.0.0.9"; {
prefixLength = 24; address = "10.0.0.9";
}]; prefixLength = 24;
}
];
}; };
services.yggdrasil.settings.Peers = lib.mkForce [ services.yggdrasil.settings.Peers = lib.mkForce [

View File

@@ -16,25 +16,32 @@
}; };
binds = lib.mkOption { binds = lib.mkOption {
type = with lib.types; listOf str; type = with lib.types; listOf str;
default = []; default = [ ];
}; };
disks = lib.mkOption { disks = lib.mkOption {
type = with lib.types; attrsOf (submodule ({name, ... }: { type =
options = { with lib.types;
name = lib.mkOption { attrsOf (
type = str; submodule (
default = name; { name, ... }:
}; {
uuid = lib.mkOption { options = {
type = str; name = lib.mkOption {
}; type = str;
mountOptions = lib.mkOption { default = name;
type = listOf str; };
default = []; uuid = lib.mkOption {
}; type = str;
}; };
})); mountOptions = lib.mkOption {
default = {}; type = listOf str;
default = [ ];
};
};
}
)
);
default = { };
description = "disks comprising library"; description = "disks comprising library";
}; };
}; };
@@ -46,14 +53,19 @@
}: }:
{ {
nixosModule = nixosModule =
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
services.pulseaudio.enable = true; services.pulseaudio.enable = true;
# workaround cookie permissions # workaround cookie permissions
services.pulseaudio.tcp.enable = true; services.pulseaudio.tcp.enable = true;
services.pulseaudio.tcp.anonymousClients = { services.pulseaudio.tcp.anonymousClients = {
allowedIpRanges = ["127.0.0.1"]; allowedIpRanges = [ "127.0.0.1" ];
allowAll = true; allowAll = true;
}; };
@@ -61,33 +73,41 @@
"d ${settings.baseDir} 0755 root root" "d ${settings.baseDir} 0755 root root"
]; ];
fileSystems = let fileSystems =
disk2fs = let
{ name, uuid, mountOptions, ... }: disk2fs =
lib.nameValuePair "${settings.baseDir}/${name}" { {
device = "/dev/disk/by-uuid/${uuid}"; name,
fsType = "auto"; uuid,
options = ["noauto" "nofail"] ++ mountOptions; mountOptions,
}; ...
in lib.listToAttrs }:
(lib.mapAttrsToList (_: disk2fs) settings.disks); lib.nameValuePair "${settings.baseDir}/${name}" {
device = "/dev/disk/by-uuid/${uuid}";
fsType = "auto";
options = [
"noauto"
"nofail"
]
++ mountOptions;
};
in
lib.listToAttrs (lib.mapAttrsToList (_: disk2fs) settings.disks);
services.udev.extraRules = let services.udev.extraRules =
translate-prefix = path: let
(lib.removePrefix "-" translate-prefix = path: (lib.removePrefix "-" (lib.replaceStrings [ "/" ] [ "-" ] path));
(lib.replaceStrings ["/"] ["-"] path)); mount-name = name: "${translate-prefix settings.baseDir}-${name}.mount";
mount-name = name: disk2rule =
"${translate-prefix settings.baseDir}-${name}.mount"; { name, uuid, ... }:
disk2rule = lib.concatStringsSep ", " [
{ name, uuid, ... }: ''ACTION=="add"''
lib.concatStringsSep ", " [ ''SUBSYSTEM=="block"''
''ACTION=="add"'' ''ENV{DEVLINKS}=="*/dev/disk/by-uuid/${uuid}*"''
''SUBSYSTEM=="block"'' ''ENV{SYSTEMD_WANTS}="${mount-name name}"''
''ENV{DEVLINKS}=="*/dev/disk/by-uuid/${uuid}*"'' ];
''ENV{SYSTEMD_WANTS}="${mount-name name}"'' in
]; lib.concatMapStringsSep "\n" disk2rule (lib.attrValues settings.disks);
in lib.concatMapStringsSep "\n" disk2rule
(lib.attrValues settings.disks);
services.mpd = { services.mpd = {
enable = true; enable = true;
@@ -102,10 +122,11 @@
''; '';
}; };
networking.firewall.interfaces = lib.genAttrs settings.binds networking.firewall.interfaces = lib.genAttrs settings.binds (_: {
(_: { allowedTCPPorts = [config.services.mpd.network.port]; }); allowedTCPPorts = [ config.services.mpd.network.port ];
});
environment.systemPackages = [pkgs.mpc]; environment.systemPackages = [ pkgs.mpc ];
}; };
}; };
}; };

View File

@@ -325,7 +325,10 @@
requires = [ "asterisk.service" ]; requires = [ "asterisk.service" ];
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
path = with pkgs; [ inotify-tools asterisk ]; path = with pkgs; [
inotify-tools
asterisk
];
script = '' script = ''
inotifywait -m -e move /etc/asterisk | inotifywait -m -e move /etc/asterisk |
while read path action file; do while read path action file; do

View File

@@ -12,7 +12,7 @@
options.client-ip-ranges = lib.mkOption { options.client-ip-ranges = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
description = "ip subnets permitted to stream to the server"; description = "ip subnets permitted to stream to the server";
default = []; default = [ ];
}; };
}; };
perInstance = perInstance =
@@ -30,8 +30,7 @@
systemWide = true; systemWide = true;
tcp = { tcp = {
enable = true; enable = true;
anonymousClients.allowedIpRanges = anonymousClients.allowedIpRanges = settings.client-ip-ranges;
settings.client-ip-ranges;
anonymousClients.allowAll = true; anonymousClients.allowAll = true;
}; };
zeroconf.publish.enable = true; zeroconf.publish.enable = true;