nixfmt-rfc-style
There is nothing in this commit except for the changes made by nix-shell -p nixfmt-rfc-style --run "nixfmt ." If this has mucked up your open branches then sorry about that. You can probably nixfmt them to match before merging
This commit is contained in:
@@ -1,20 +1,30 @@
|
||||
{
|
||||
liminix
|
||||
, lib
|
||||
liminix,
|
||||
lib,
|
||||
}:
|
||||
{
|
||||
target,
|
||||
via,
|
||||
interface ? null,
|
||||
metric,
|
||||
}:
|
||||
{ target, via, interface ? null, metric }:
|
||||
let
|
||||
inherit (liminix.services) oneshot;
|
||||
with_dev = if interface != null then "dev $(output ${interface} ifname)" else "";
|
||||
target_hash = builtins.substring 0 12 (builtins.hashString "sha256" target);
|
||||
via_hash = builtins.substring 0 12 (builtins.hashString "sha256" via);
|
||||
in oneshot {
|
||||
name = "route-${target_hash}-${builtins.substring 0 12 (builtins.hashString "sha256" "${via_hash}-${if interface!=null then interface.name else ""}")}";
|
||||
in
|
||||
oneshot {
|
||||
name = "route-${target_hash}-${
|
||||
builtins.substring 0 12 (
|
||||
builtins.hashString "sha256" "${via_hash}-${if interface != null then interface.name else ""}"
|
||||
)
|
||||
}";
|
||||
up = ''
|
||||
ip route add ${target} via ${via} metric ${toString metric} ${with_dev}
|
||||
'';
|
||||
down = ''
|
||||
ip route del ${target} via ${via} ${with_dev}
|
||||
'';
|
||||
dependencies = [] ++ lib.optional (interface != null) interface;
|
||||
dependencies = [ ] ++ lib.optional (interface != null) interface;
|
||||
}
|
||||
|
Reference in New Issue
Block a user