mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 23:00:39 +02:00
feat(topology): remove cidr mask from systemd network addresses
This commit is contained in:
parent
30579a433e
commit
35643676b4
1 changed files with 12 additions and 2 deletions
|
@ -8,7 +8,10 @@
|
||||||
any
|
any
|
||||||
attrValues
|
attrValues
|
||||||
concatLists
|
concatLists
|
||||||
|
concatStringsSep
|
||||||
flip
|
flip
|
||||||
|
init
|
||||||
|
length
|
||||||
listToAttrs
|
listToAttrs
|
||||||
mapAttrsToList
|
mapAttrsToList
|
||||||
mkDefault
|
mkDefault
|
||||||
|
@ -17,7 +20,15 @@
|
||||||
mkMerge
|
mkMerge
|
||||||
nameValuePair
|
nameValuePair
|
||||||
optional
|
optional
|
||||||
|
splitString
|
||||||
;
|
;
|
||||||
|
|
||||||
|
removeCidrMask = x: let
|
||||||
|
toks = splitString "/" x;
|
||||||
|
in
|
||||||
|
if length toks > 1
|
||||||
|
then concatStringsSep "/" (init toks)
|
||||||
|
else builtins.head toks;
|
||||||
in {
|
in {
|
||||||
options.topology.extractors.systemd-network.enable = mkEnableOption "topology systemd-network extractor" // {default = true;};
|
options.topology.extractors.systemd-network.enable = mkEnableOption "topology systemd-network extractor" // {default = true;};
|
||||||
|
|
||||||
|
@ -60,8 +71,7 @@ in {
|
||||||
optional (interfaceName != null) {
|
optional (interfaceName != null) {
|
||||||
${interfaceName} = {
|
${interfaceName} = {
|
||||||
mac = network.matchConfig.MACAddress or null;
|
mac = network.matchConfig.MACAddress or null;
|
||||||
# TODO: FIXME: remove cidr mask
|
addresses = map removeCidrMask (network.address ++ (network.networkConfig.Address or []));
|
||||||
addresses = network.address ++ (network.networkConfig.Address or []);
|
|
||||||
gateways = network.gateway ++ (network.networkConfig.Gateway or []);
|
gateways = network.gateway ++ (network.networkConfig.Gateway or []);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue