mirror of
https://github.com/ryantm/nixpkgs-update.git
synced 2024-12-17 16:31:47 +03:00
clean up environment set-up
This commit is contained in:
parent
be679a5bd6
commit
f7fe3a4e7c
10
src/Main.hs
10
src/Main.hs
@ -21,7 +21,13 @@ makeOptions :: Sh Options
|
|||||||
makeOptions = do
|
makeOptions = do
|
||||||
dryRun <- isJust <$> get_env "DRY_RUN"
|
dryRun <- isJust <$> get_env "DRY_RUN"
|
||||||
workingDir <- (</> ".nix-update") <$> get_env_text "HOME"
|
workingDir <- (</> ".nix-update") <$> get_env_text "HOME"
|
||||||
return $ Options dryRun workingDir
|
githubToken <- cmd "cat" "github_token.txt"
|
||||||
|
return $ Options dryRun workingDir githubToken
|
||||||
|
|
||||||
|
setUpEnvironment :: Options -> Sh ()
|
||||||
|
setUpEnvironment options = do
|
||||||
|
setenv "PAGER" ""
|
||||||
|
setenv "GITHUB_TOKEN" (githubToken options)
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = shelly $ do
|
main = shelly $ do
|
||||||
@ -32,7 +38,7 @@ main = shelly $ do
|
|||||||
mkdir_p (workingDir options)
|
mkdir_p (workingDir options)
|
||||||
touchfile logFile
|
touchfile logFile
|
||||||
|
|
||||||
githubToken <- cmd "cat" "github_token.txt"
|
setUpEnvironment options
|
||||||
|
|
||||||
updates <- cmd "cat" "packages-to-update.txt"
|
updates <- cmd "cat" "packages-to-update.txt"
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@ type Version = Text
|
|||||||
|
|
||||||
data Options = Options {
|
data Options = Options {
|
||||||
dryRun :: Bool,
|
dryRun :: Bool,
|
||||||
workingDir :: FilePath
|
workingDir :: FilePath,
|
||||||
|
githubToken :: Text
|
||||||
}
|
}
|
||||||
|
|
||||||
setupNixpkgs :: Sh FilePath
|
setupNixpkgs :: Sh FilePath
|
||||||
|
Loading…
Reference in New Issue
Block a user