From 6b2a21404d2a4fa2c17c4cf36defe0623016b025 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 3 Sep 2017 23:54:26 +0200 Subject: systemd notify --- trivmix.cabal | 3 ++- trivmix.nix | 7 ++++--- trivmix/Trivmix.hs | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/trivmix.cabal b/trivmix.cabal index 1aebf91..5be6ccd 100644 --- a/trivmix.cabal +++ b/trivmix.cabal @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: trivmix -version: 2.7.4 +version: 2.7.5 -- synopsis: -- description: license: PublicDomain @@ -38,6 +38,7 @@ executable trivmix , explicit-exception >=0.1 && <1 , process >=1.2 && <2 , filelock >=0.1 && <1 + , systemd >=1.1.2 && <2 , trivmix hs-source-dirs: trivmix default-language: Haskell2010 diff --git a/trivmix.nix b/trivmix.nix index c8149cf..873c7bf 100644 --- a/trivmix.nix +++ b/trivmix.nix @@ -1,17 +1,18 @@ { mkDerivation, base, case-insensitive, data-default, directory , explicit-exception, filelock, filepath, hinotify, jack -, optparse-applicative, process, stdenv, transformers, unix +, optparse-applicative, process, stdenv, systemd, transformers +, unix }: mkDerivation { pname = "trivmix"; - version = "2.7.4"; + version = "2.7.5"; src = ./.; isLibrary = true; isExecutable = true; libraryHaskellDepends = [ base case-insensitive data-default ]; executableHaskellDepends = [ base directory explicit-exception filelock filepath hinotify jack - optparse-applicative process transformers unix + optparse-applicative process systemd transformers unix ]; license = stdenv.lib.licenses.publicDomain; } diff --git a/trivmix/Trivmix.hs b/trivmix/Trivmix.hs index 50caa1b..493c964 100644 --- a/trivmix/Trivmix.hs +++ b/trivmix/Trivmix.hs @@ -16,6 +16,8 @@ import System.Posix.Types import System.Environment import System.Process +import System.Systemd.Daemon (notifyReady) + import Control.Concurrent import Control.Concurrent.MVar import Control.Concurrent.Chan @@ -142,6 +144,7 @@ trivmix Options{..} = do Jack.withActivation client' . Trans.lift $ do forM_ run $ \script -> (callProcess script [client ++ ":" ++ input, client ++ ":" ++ output]) `catch` (\code -> hPutStrLn stderr $ script ++ " failed: " ++ show (code :: ExitCode)) + notifyReady forever $ threadDelay 1000000 mix :: MVar Level -> CFloat -> IO CFloat -- cgit v1.2.3