diff --git a/src/Main.hs b/src/Main.hs index 9774d63..c8e09d7 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -21,7 +21,13 @@ makeOptions :: Sh Options makeOptions = do dryRun <- isJust <$> get_env "DRY_RUN" 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 = shelly $ do @@ -32,7 +38,7 @@ main = shelly $ do mkdir_p (workingDir options) touchfile logFile - githubToken <- cmd "cat" "github_token.txt" + setUpEnvironment options updates <- cmd "cat" "packages-to-update.txt" diff --git a/src/Utils.hs b/src/Utils.hs index 9172bad..3aa343a 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -15,7 +15,8 @@ type Version = Text data Options = Options { dryRun :: Bool, - workingDir :: FilePath + workingDir :: FilePath, + githubToken :: Text } setupNixpkgs :: Sh FilePath