From c796abb799c8a8745c95f8f926d4c4fe397f1669 Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Sat, 11 Apr 2020 17:08:09 +0200 Subject: [PATCH] git-server features --- system/git.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system/git.nix b/system/git.nix index 6d56303c..690e9456 100644 --- a/system/git.nix +++ b/system/git.nix @@ -13,7 +13,6 @@ let bins = [ pkgs.git pkgs.nix ]; imports = [ "System.Environment (lookupEnv)" - "Control.Monad (ap)" "System.Directory (withCurrentDirectory)" ]; @@ -26,17 +25,18 @@ let main = do mirror <- lookupEnv "GL_OPTION_MIRROR" - for_ mirror $ \mirror -> do + whenJust mirror $ \mirror -> do echo ([i|Forwarding push to #{mirror}|] :: String) git "push" "--all" "-f" mirror deploy <- lookupEnv "GL_OPTION_WEB_DEPLOY" - for_ deploy $ \deploy -> do + whenJust deploy $ \deploy -> do + (maybe [] ("-A":) -> target) <- lookupEnv "GL_OPTION_WEB_DEPLOY_NIX_TARGET" (decodeUtf8 -> path) <- pwd |> captureTrim echo ([i|Deploying build to /var/www/#{deploy}|] :: String) - bracket (checkout path) (rm "-rf") $ \dir -> withCurrentDirectory dir $ nix "build" "-o" ([i|/var/www/#{deploy}|] :: String) + bracket (checkout path) (rm "-rf") $ \dir -> withCurrentDirectory dir $ nix "build" "-o" ([i|/var/www/#{deploy}|] :: String) target echo "Done" test <- lookupEnv "GL_OPTION_TEST" - for_ test $ \_ -> do + whenJust test $ \_ -> do echo "Triggering (an async) system update." exe "sudo" ${haskellList update-command}; '';