create outputs for network interface
This commit is contained in:
parent
485ecc03b0
commit
6da0e67621
1 changed files with 3 additions and 2 deletions
|
@ -9,7 +9,8 @@ let
|
||||||
inherit (lib) concatStringsSep optional;
|
inherit (lib) concatStringsSep optional;
|
||||||
in {
|
in {
|
||||||
interface = { type ? "hardware", device, link ? null, primary ? null, id ? null, dependencies ? [] } @ args:
|
interface = { type ? "hardware", device, link ? null, primary ? null, id ? null, dependencies ? [] } @ args:
|
||||||
let ups =
|
let name = "${device}.link";
|
||||||
|
ups =
|
||||||
[]
|
[]
|
||||||
++ optional (type == "bridge")
|
++ optional (type == "bridge")
|
||||||
"ip link add name ${device} type bridge"
|
"ip link add name ${device} type bridge"
|
||||||
|
@ -20,7 +21,7 @@ in {
|
||||||
++ optional (primary != null)
|
++ optional (primary != null)
|
||||||
"ip link set dev ${device} master ${primary.device}";
|
"ip link set dev ${device} master ${primary.device}";
|
||||||
in oneshot {
|
in oneshot {
|
||||||
name = "${device}.link";
|
inherit name;
|
||||||
up = lib.concatStringsSep "\n" ups;
|
up = lib.concatStringsSep "\n" ups;
|
||||||
down = "ip link set down dev ${device}";
|
down = "ip link set down dev ${device}";
|
||||||
dependencies = dependencies ++ lib.optional (primary != null) primary;
|
dependencies = dependencies ++ lib.optional (primary != null) primary;
|
||||||
|
|
Loading…
Reference in a new issue