forked from DGNum/liminix
address service: rename addr->address & add prefixLength
these names are consistent with nixos
This commit is contained in:
parent
0e73362a8c
commit
3540f594b1
3 changed files with 12 additions and 10 deletions
|
@ -66,12 +66,14 @@ in {
|
||||||
} // {
|
} // {
|
||||||
inherit device;
|
inherit device;
|
||||||
};
|
};
|
||||||
address = interface: { family, addr } @ args: oneshot {
|
address = interface: { family, prefixLength, address } @ args:
|
||||||
dependencies = [ interface ];
|
let inherit (builtins) toString;
|
||||||
name = "${interface.device}.addr.${addr}";
|
in oneshot {
|
||||||
up = "ip address add ${addr} dev ${interface.device} ";
|
dependencies = [ interface ];
|
||||||
down = "ip address del ${addr} dev ${interface.device} ";
|
name = "${interface.device}.addr.${address}";
|
||||||
};
|
up = "ip address add ${address}/${toString prefixLength} dev ${interface.device} ";
|
||||||
|
down = "ip address del ${address}/${toString prefixLength} dev ${interface.device} ";
|
||||||
|
};
|
||||||
udhcpc = callPackage ./networking/udhcpc.nix {};
|
udhcpc = callPackage ./networking/udhcpc.nix {};
|
||||||
odhcpc = interface: { ... } @ args: longrun {
|
odhcpc = interface: { ... } @ args: longrun {
|
||||||
name = "${interface.device}.odhcp";
|
name = "${interface.device}.odhcp";
|
||||||
|
|
|
@ -8,8 +8,8 @@ in rec {
|
||||||
in bundle {
|
in bundle {
|
||||||
name = "loopback";
|
name = "loopback";
|
||||||
contents = [
|
contents = [
|
||||||
(address iface { family = "inet4"; addr ="127.0.0.1";})
|
(address iface { family = "inet4"; address ="127.0.0.1"; prefixLength = 8;})
|
||||||
(address iface { family = "inet6"; addr ="::1";})
|
(address iface { family = "inet6"; address ="::1"; prefixLength = 128;})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ in rec {
|
||||||
in bundle {
|
in bundle {
|
||||||
name = "loopback";
|
name = "loopback";
|
||||||
contents = [
|
contents = [
|
||||||
(address iface { family = "inet4"; addr ="127.0.0.1";})
|
(address iface { family = "inet4"; address ="127.0.0.1"; prefixLength = 8;})
|
||||||
(address iface { family = "inet6"; addr ="::1";})
|
(address iface { family = "inet6"; address ="::1"; prefixLength = 128;})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
services.dhcpv4 =
|
services.dhcpv4 =
|
||||||
|
|
Loading…
Reference in a new issue