forked from DGNum/liminix
convert all route defns to module-based-service
This commit is contained in:
parent
51ad051443
commit
535eb70bb9
4 changed files with 6 additions and 41 deletions
|
@ -1,13 +1,8 @@
|
|||
{
|
||||
callPackage
|
||||
, liminix
|
||||
, ifwait
|
||||
, lib
|
||||
ifwait
|
||||
, serviceFns
|
||||
}:
|
||||
let
|
||||
inherit (liminix.services) oneshot longrun;
|
||||
inherit (lib) concatStringsSep optional;
|
||||
{
|
||||
ifup = name : ifname : ''
|
||||
. ${serviceFns}
|
||||
${ifwait}/bin/ifwait -v ${ifname} present
|
||||
|
@ -16,20 +11,4 @@ let
|
|||
echo ${ifname} > ifname
|
||||
)
|
||||
'';
|
||||
|
||||
in {
|
||||
inherit ifup;
|
||||
|
||||
route = { name, target, via, dependencies, dev ? null }:
|
||||
let with_dev = if dev != null then "dev ${dev}" else "";
|
||||
in oneshot {
|
||||
inherit name;
|
||||
up = ''
|
||||
ip route add ${target} via ${via} ${with_dev}
|
||||
'';
|
||||
down = ''
|
||||
ip route del ${target} via ${via} ${with_dev}
|
||||
'';
|
||||
inherit dependencies;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue