diff --git a/examples/acquire-wan-address.fnl b/examples/acquire-wan-address.fnl index 68a66ca..faf20d0 100644 --- a/examples/acquire-wan-address.fnl +++ b/examples/acquire-wan-address.fnl @@ -30,8 +30,9 @@ (.. "ip address del " p.address "/" p.len " dev " wan-device))) new-addresses)) -(fn run [state-directory wan-device] - (let [dir (svc.open state-directory)] +(fn run [] + (let [[state-directory wan-device] arg + dir (svc.open state-directory)] (var addresses []) (while true (while (not (dir:ready?)) (dir:wait)) @@ -40,8 +41,4 @@ (update-addresses wan-device addresses (dir:output "address")))) (dir:wait)))) - -(if (os.getenv "RUN_TESTS") - { : update-addresses : changes : run } - (let [[state-directory wan-device] arg] - (run state-directory wan-device))) +{ : update-addresses : changes : run } diff --git a/examples/acquire-wan-address.nix b/examples/acquire-wan-address.nix index df55a54..2039899 100644 --- a/examples/acquire-wan-address.nix +++ b/examples/acquire-wan-address.nix @@ -1,8 +1,9 @@ { - writeFennelScript + writeFennel , linotify , anoia }: -writeFennelScript "acquire-wan-address" - [ linotify anoia ] - ./acquire-wan-address.fnl +writeFennel "acquire-wan-address" { + packages = [ linotify anoia ]; + mainFunction = "run"; +} ./acquire-wan-address.fnl