mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat(aya): runner
This commit is contained in:
parent
fc11fb8152
commit
585c758254
11 changed files with 785 additions and 32 deletions
50
modules/nixos/network/networks.nix
Normal file
50
modules/nixos/network/networks.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkOptionDefault;
|
||||
inherit (inputs.self.lib.lib) eui64;
|
||||
inherit (config) networking services;
|
||||
networkModule = { config, ... }: {
|
||||
options = with lib.types; {
|
||||
mdns = {
|
||||
enable = mkEnableOption "SLAAC" // {
|
||||
default = config.matchConfig.Type or null == "ether" && services.resolved.enable;
|
||||
};
|
||||
};
|
||||
slaac = {
|
||||
enable = mkEnableOption "SLAAC" // {
|
||||
default = config.matchConfig.Type or null == "ether" && networking.enableIPv6;
|
||||
};
|
||||
postfix = mkOption {
|
||||
type = str;
|
||||
};
|
||||
};
|
||||
};
|
||||
config = {
|
||||
slaac.postfix = mkIf (config.matchConfig.MACAddress or null != null) (
|
||||
mkOptionDefault (eui64 config.matchConfig.MACAddress)
|
||||
);
|
||||
networkConfig = mkMerge [
|
||||
(mkIf config.slaac.enable {
|
||||
IPv6AcceptRA = true;
|
||||
})
|
||||
(mkIf config.mdns.enable {
|
||||
MulticastDNS = true;
|
||||
})
|
||||
];
|
||||
linkConfig = mkIf config.mdns.enable {
|
||||
Multicast = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options = with lib.types; {
|
||||
systemd.network.networks = mkOption {
|
||||
type = attrsOf (submodule networkModule);
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue