diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2017-09-03 23:54:26 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2017-09-03 23:54:26 +0200 |
commit | 6b2a21404d2a4fa2c17c4cf36defe0623016b025 (patch) | |
tree | d06db15fc8e902647c79549c3b443e8dede0080d | |
parent | d93226b3ad30e65a607a0ee47acd32de844d312c (diff) | |
download | trivmix-6b2a21404d2a4fa2c17c4cf36defe0623016b025.tar trivmix-6b2a21404d2a4fa2c17c4cf36defe0623016b025.tar.gz trivmix-6b2a21404d2a4fa2c17c4cf36defe0623016b025.tar.bz2 trivmix-6b2a21404d2a4fa2c17c4cf36defe0623016b025.tar.xz trivmix-6b2a21404d2a4fa2c17c4cf36defe0623016b025.zip |
systemd notify
-rw-r--r-- | trivmix.cabal | 3 | ||||
-rw-r--r-- | trivmix.nix | 7 | ||||
-rw-r--r-- | 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 @@ | |||
2 | -- documentation, see http://haskell.org/cabal/users-guide/ | 2 | -- documentation, see http://haskell.org/cabal/users-guide/ |
3 | 3 | ||
4 | name: trivmix | 4 | name: trivmix |
5 | version: 2.7.4 | 5 | version: 2.7.5 |
6 | -- synopsis: | 6 | -- synopsis: |
7 | -- description: | 7 | -- description: |
8 | license: PublicDomain | 8 | license: PublicDomain |
@@ -38,6 +38,7 @@ executable trivmix | |||
38 | , explicit-exception >=0.1 && <1 | 38 | , explicit-exception >=0.1 && <1 |
39 | , process >=1.2 && <2 | 39 | , process >=1.2 && <2 |
40 | , filelock >=0.1 && <1 | 40 | , filelock >=0.1 && <1 |
41 | , systemd >=1.1.2 && <2 | ||
41 | , trivmix | 42 | , trivmix |
42 | hs-source-dirs: trivmix | 43 | hs-source-dirs: trivmix |
43 | default-language: Haskell2010 | 44 | 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 @@ | |||
1 | { mkDerivation, base, case-insensitive, data-default, directory | 1 | { mkDerivation, base, case-insensitive, data-default, directory |
2 | , explicit-exception, filelock, filepath, hinotify, jack | 2 | , explicit-exception, filelock, filepath, hinotify, jack |
3 | , optparse-applicative, process, stdenv, transformers, unix | 3 | , optparse-applicative, process, stdenv, systemd, transformers |
4 | , unix | ||
4 | }: | 5 | }: |
5 | mkDerivation { | 6 | mkDerivation { |
6 | pname = "trivmix"; | 7 | pname = "trivmix"; |
7 | version = "2.7.4"; | 8 | version = "2.7.5"; |
8 | src = ./.; | 9 | src = ./.; |
9 | isLibrary = true; | 10 | isLibrary = true; |
10 | isExecutable = true; | 11 | isExecutable = true; |
11 | libraryHaskellDepends = [ base case-insensitive data-default ]; | 12 | libraryHaskellDepends = [ base case-insensitive data-default ]; |
12 | executableHaskellDepends = [ | 13 | executableHaskellDepends = [ |
13 | base directory explicit-exception filelock filepath hinotify jack | 14 | base directory explicit-exception filelock filepath hinotify jack |
14 | optparse-applicative process transformers unix | 15 | optparse-applicative process systemd transformers unix |
15 | ]; | 16 | ]; |
16 | license = stdenv.lib.licenses.publicDomain; | 17 | license = stdenv.lib.licenses.publicDomain; |
17 | } | 18 | } |
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 | |||
16 | import System.Environment | 16 | import System.Environment |
17 | import System.Process | 17 | import System.Process |
18 | 18 | ||
19 | import System.Systemd.Daemon (notifyReady) | ||
20 | |||
19 | import Control.Concurrent | 21 | import Control.Concurrent |
20 | import Control.Concurrent.MVar | 22 | import Control.Concurrent.MVar |
21 | import Control.Concurrent.Chan | 23 | import Control.Concurrent.Chan |
@@ -142,6 +144,7 @@ trivmix Options{..} = do | |||
142 | Jack.withActivation client' . Trans.lift $ do | 144 | Jack.withActivation client' . Trans.lift $ do |
143 | forM_ run $ \script -> | 145 | forM_ run $ \script -> |
144 | (callProcess script [client ++ ":" ++ input, client ++ ":" ++ output]) `catch` (\code -> hPutStrLn stderr $ script ++ " failed: " ++ show (code :: ExitCode)) | 146 | (callProcess script [client ++ ":" ++ input, client ++ ":" ++ output]) `catch` (\code -> hPutStrLn stderr $ script ++ " failed: " ++ show (code :: ExitCode)) |
147 | notifyReady | ||
145 | forever $ threadDelay 1000000 | 148 | forever $ threadDelay 1000000 |
146 | 149 | ||
147 | mix :: MVar Level -> CFloat -> IO CFloat | 150 | mix :: MVar Level -> CFloat -> IO CFloat |