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

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

View File

@@ -19,7 +19,12 @@
default = [ ]; default = [ ];
}; };
disks = lib.mkOption { disks = lib.mkOption {
type = with lib.types; attrsOf (submodule ({name, ... }: { type =
with lib.types;
attrsOf (
submodule (
{ name, ... }:
{
options = { options = {
name = lib.mkOption { name = lib.mkOption {
type = str; type = str;
@@ -33,7 +38,9 @@
default = [ ]; default = [ ];
}; };
}; };
})); }
)
);
default = { }; default = { };
description = "disks comprising library"; description = "disks comprising library";
}; };
@@ -46,7 +53,12 @@
}: }:
{ {
nixosModule = nixosModule =
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
services.pulseaudio.enable = true; services.pulseaudio.enable = true;
@@ -61,23 +73,31 @@
"d ${settings.baseDir} 0755 root root" "d ${settings.baseDir} 0755 root root"
]; ];
fileSystems = let fileSystems =
let
disk2fs = disk2fs =
{ name, uuid, mountOptions, ... }: {
name,
uuid,
mountOptions,
...
}:
lib.nameValuePair "${settings.baseDir}/${name}" { lib.nameValuePair "${settings.baseDir}/${name}" {
device = "/dev/disk/by-uuid/${uuid}"; device = "/dev/disk/by-uuid/${uuid}";
fsType = "auto"; fsType = "auto";
options = ["noauto" "nofail"] ++ mountOptions; options = [
"noauto"
"nofail"
]
++ mountOptions;
}; };
in lib.listToAttrs in
(lib.mapAttrsToList (_: disk2fs) settings.disks); 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:
"${translate-prefix settings.baseDir}-${name}.mount";
disk2rule = disk2rule =
{ name, uuid, ... }: { name, uuid, ... }:
lib.concatStringsSep ", " [ lib.concatStringsSep ", " [
@@ -86,8 +106,8 @@
''ENV{DEVLINKS}=="*/dev/disk/by-uuid/${uuid}*"'' ''ENV{DEVLINKS}=="*/dev/disk/by-uuid/${uuid}*"''
''ENV{SYSTEMD_WANTS}="${mount-name name}"'' ''ENV{SYSTEMD_WANTS}="${mount-name name}"''
]; ];
in lib.concatMapStringsSep "\n" disk2rule in
(lib.attrValues settings.disks); lib.concatMapStringsSep "\n" disk2rule (lib.attrValues settings.disks);
services.mpd = { services.mpd = {
enable = true; enable = true;
@@ -102,8 +122,9 @@
''; '';
}; };
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

@@ -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;