Skip to content

Commit

Permalink
Merge pull request #473 from hercules-ci/installation-improvements
Browse files Browse the repository at this point in the history
Installation improvements
  • Loading branch information
roberth authored Nov 30, 2022
2 parents 0ccf2e9 + f057e97 commit d3d9773
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions darwin-module.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(import ./nix/flake-compat.nix).defaultNix.darwinModules.agent-profile
2 changes: 1 addition & 1 deletion hercules-ci-agent/hercules-ci-agent/Hercules/Agent.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ configChecks :: App ()
configChecks = do
trusted <- asks (Config.nixUserIsTrusted . Env.config)
when (not trusted) do
logLocM WarningS "Your config does not indicate you have set up your user as a trusted user on the system. Running the agent as a trusted user ensures that your cache configuration is compatible with the system and improves performance if you have more than one agent. The NixOS and nix-darwin modules should configure this automatically. If this agent was set up with a manually written config file, see https://docs.hercules-ci.com/hercules-ci/reference/agent-config/"
logLocM WarningS "Your config does not indicate you have set up the user that runs the agent as a trusted-user on the system. Running the agent as a trusted-user ensures that your cache configuration is compatible with the system and it improves performance. The NixOS and nix-darwin modules configure this automatically. If this agent was set up with a manually written config file, add the user that runs the agent to nix.settings.trusted-users in your system configuration, or add it to the trusted-users line in your system nix.conf."

run :: Env.Env -> Config.FinalConfig -> IO ()
run env _cfg = do
Expand Down
10 changes: 6 additions & 4 deletions hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Nix/Init.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@ import Protolude
newEnv :: IO Env
newEnv = do
nixInfo <- EnvironmentInfo.getNixInfo
print nixInfo
when (EnvironmentInfo.nixNarinfoCacheNegativeTTL nixInfo /= 0) $ do
putErrText
"\n\
\We have detected that the setting narinfo-cache-negative-ttl is non-zero.\n\
\We have detected that the Nix setting narinfo-cache-negative-ttl is non-zero.\n\
\Running hercules-ci-agent on a system with a non-zero negative ttl will cause\n\
\problems when run in a cluster.\n\
\Note that this setting only affects the caching of paths that are *missing*\n\
\from a cache. Paths that *are* in the binary cache are cached as configured in\n\
\the 'positive' option.\n\
\the narinfo-cache-positive-ttl option. You don't need to configure the positive\n\
\option. \n\
\\n\
\On NixOS and nix-darwin, use the recommended installation method via module,\n\
\make sure that the `narinfo-cache-negative-ttl` isn't set via other means.\n\
\If you can't use the module, use\
\ nix.settings.narinfo-cache-negative-ttl = 0;\n\
\ or\n\
\ nix.extraOptions = \"narinfo-cache-negative-ttl = 0\"\n\
\\n\
\or add to your system nix.conf:\n\
\or add to your system /etc/nix/nix.conf:\n\
\ narinfo-cache-negative-ttl = 0\n\
\n"
throwIO $ FatalError "Please configure your system's Nix with: narinfo-cache-negative-ttl = 0 "
Expand Down

0 comments on commit d3d9773

Please sign in to comment.