1
0
Fork 0

Improve shh usage

This commit is contained in:
Malte Brandy 2019-08-14 00:24:38 +02:00
parent be53a56a6f
commit 0bfafc2041
5 changed files with 12 additions and 12 deletions

View file

@ -4,9 +4,9 @@ let
pkgs writeHaskellScript get-niv-path home-manager unstable haskellList;
in rec {
haskellBody = name: commandline: ''
getNivPath dir = readTrim . get_niv_path ([i|#{dir :: String}/nix/sources.nix|] :: String)
getNivPath dir name = get_niv_path ([i|#{dir :: String}/nix/sources.nix|] :: String) name |> captureTrim
getNivAssign dir name = fmap process . getNivPath dir $ name
getNivAssign dir name = process <$> getNivPath dir name
where process str = ["-I", [i|#{name :: String}=#{str :: LBS.ByteString}|]]
main = do
@ -51,17 +51,17 @@ in rec {
>>= ((ap (<$) $ git "clone" "${repoSrc}") . LBSC.unpack)
main = do
path <- readTrim pwd
path <- pwd |> captureTrim
bump <- (maybe False (== "bump") . listToMaybe) <$> getArgs
bracket checkout (rm "-rf") $ \dir -> do
withCurrentDirectory dir $ do
mapM_ (\x -> git_crypt "unlock" ([i|${configPath}/.git/git-crypt/keys/#{x}|] :: String)) ${
haskellList keys
haskellList keys
}
when bump $ ignoreFailure $ niv "update"
mapM_ (test_system_config dir) ${haskellList systems}
mapM_ (test_home_config dir) ${haskellList homes}
changed <- ((mempty /=) <$>) . readTrim $ git "-C" dir "status" "--porcelain"
changed <- (mempty /=) <$> (git "-C" dir "status" "--porcelain" |> captureTrim)
when changed $ do
git "-C" dir "config" "user.email" "maralorn@maralorn.de"
git "-C" dir "config" "user.name" "maralorn (nix-auto-updater)"

View file

@ -6,10 +6,10 @@ in {
bins = [ get-niv-path home-manager ];
} ''
getNivPath = get_niv_path "${configPath}/nix/sources.nix"
getNivPath name = get_niv_path "${configPath}/nix/sources.nix" name |> captureTrim
getNivAssign name = (tag <$>) . readTrim . getNivPath $ name
where tag str = ["-I", [i|#{name}=#{str :: LBS.ByteString}|]]
getNivAssign name = tag <$> getNivPath name
where tag str = ["-I", [i|#{name :: String}=#{str :: LBS.ByteString}|]]
main = do
args <- getArgs

View file

@ -8,10 +8,10 @@ in rec {
name = "update-system";
bins = [ get-niv-path nixos-rebuild ];
} ''
getNivPath = readTrim . get_niv_path "${configPath}/nix/sources.nix"
getNivPath name = get_niv_path "${configPath}/nix/sources.nix" name |> captureTrim
getNivAssign name = tag <$> getNivPath name
where tag str = ["-I", [i|#{name}=#{str :: LBS.ByteString}|] ]
where tag str = ["-I", [i|#{name :: String}=#{str :: LBS.ByteString}|]]
main = do
paths <- fmap concat . mapM getNivAssign $ ["nixpkgs", "unstable", "home-manager"]

View file

@ -40,7 +40,7 @@ in rec {
} ''
waitForExit = do
sleep "5s"
processes <- readTrim $ ps "aux"
processes <- ps "aux" |> captureTrim
when
(BSC.isInfixOf (BSC.pack "GW2.exe") (LBSC.toStrict processes))
waitForExit

View file

@ -31,7 +31,7 @@ let
git "push" "--all" mirror
deploy <- lookupEnv "GL_OPTION_WEB_DEPLOY"
for_ deploy $ \deploy -> do
path <- readTrim pwd
path <- pwd |> captureTrim
echo ([i|Deploying build to /var/www/#{deploy}|] :: String)
bracket (checkout $ LBSC.unpack path)(rm "-rf") $ \dir -> withCurrentDirectory dir $ nix "build" "-o" ([i|/var/www/#{deploy}|] :: String)
echo "Done"