summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2017-09-03 23:54:26 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2017-09-03 23:54:26 +0200
commit6b2a21404d2a4fa2c17c4cf36defe0623016b025 (patch)
treed06db15fc8e902647c79549c3b443e8dede0080d
parentd93226b3ad30e65a607a0ee47acd32de844d312c (diff)
downloadtrivmix-6b2a21404d2a4fa2c17c4cf36defe0623016b025.tar
trivmix-6b2a21404d2a4fa2c17c4cf36defe0623016b025.tar.gz
trivmix-6b2a21404d2a4fa2c17c4cf36defe0623016b025.tar.bz2
trivmix-6b2a21404d2a4fa2c17c4cf36defe0623016b025.tar.xz
trivmix-6b2a21404d2a4fa2c17c4cf36defe0623016b025.zip
systemd notify
-rw-r--r--trivmix.cabal3
-rw-r--r--trivmix.nix7
-rw-r--r--trivmix/Trivmix.hs3
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
4name: trivmix 4name: trivmix
5version: 2.7.4 5version: 2.7.5
6-- synopsis: 6-- synopsis:
7-- description: 7-- description:
8license: PublicDomain 8license: 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}:
5mkDerivation { 6mkDerivation {
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
16import System.Environment 16import System.Environment
17import System.Process 17import System.Process
18 18
19import System.Systemd.Daemon (notifyReady)
20
19import Control.Concurrent 21import Control.Concurrent
20import Control.Concurrent.MVar 22import Control.Concurrent.MVar
21import Control.Concurrent.Chan 23import 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
147mix :: MVar Level -> CFloat -> IO CFloat 150mix :: MVar Level -> CFloat -> IO CFloat