mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 14:50:40 +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
|
||||
attrValues
|
||||
concatLists
|
||||
concatStringsSep
|
||||
flip
|
||||
init
|
||||
length
|
||||
listToAttrs
|
||||
mapAttrsToList
|
||||
mkDefault
|
||||
|
@ -17,7 +20,15 @@
|
|||
mkMerge
|
||||
nameValuePair
|
||||
optional
|
||||
splitString
|
||||
;
|
||||
|
||||
removeCidrMask = x: let
|
||||
toks = splitString "/" x;
|
||||
in
|
||||
if length toks > 1
|
||||
then concatStringsSep "/" (init toks)
|
||||
else builtins.head toks;
|
||||
in {
|
||||
options.topology.extractors.systemd-network.enable = mkEnableOption "topology systemd-network extractor" // {default = true;};
|
||||
|
||||
|
@ -60,8 +71,7 @@ in {
|
|||
optional (interfaceName != null) {
|
||||
${interfaceName} = {
|
||||
mac = network.matchConfig.MACAddress or null;
|
||||
# TODO: FIXME: remove cidr mask
|
||||
addresses = network.address ++ (network.networkConfig.Address or []);
|
||||
addresses = map removeCidrMask (network.address ++ (network.networkConfig.Address or []));
|
||||
gateways = network.gateway ++ (network.networkConfig.Gateway or []);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue