Closed garyverhaegen-da closed 10 months ago
@jsjoedin can you share the error message you get? The CI failure does not seem to be related to env vars.
@jsjoedin can you share the error message you get? The CI failure does not seem to be related to env vars. here is the error message:
~/repos cd daml-finance Tue Nov 28 11:23:25 2023 direnv: loading ~/repos/daml-finance/.envrc direnv: loading ~/repos/daml-finance/.envrc.private direnv: using nix direnv: ([/usr/local/bin/direnv export fish]) is taking a while to execute. Use CTRL-C to give up. these 2 derivations will be built: /nix/store/xzhmmj58ghc2dga5g11jpbyg5v73y9g1-daml-tarball-2.8.0-snapshot.20231125.12402.0.v9caae0b1.drv /nix/store/p76c3bkqw1az65vxypn7a5hcbk1pc4pv-daml-sdk-2.8.0-snapshot.20231125.12402.0.v9caae0b1.drv building '/nix/store/xzhmmj58ghc2dga5g11jpbyg5v73y9g1-daml-tarball-2.8.0-snapshot.20231125.12402.0.v9caae0b1.drv'... unpacking sources unpacking source archive /nix/store/xm86ni7dqkp3ymv7x1clhlskx7f998d4-daml-finance source root is daml-finance unpackPhase completed in 36 seconds patching sources configuring no configure script, doing nothing building % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 9 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (22) The requested URL returned error: 404 ARTIFACTORY_USERNAME and ARTIFACTORY_PASSWORD must be set. error: builder for '/nix/store/xzhmmj58ghc2dga5g11jpbyg5v73y9g1-daml-tarball-2.8.0-snapshot.20231125.12402.0.v9caae0b1.drv' failed with exit code 1; last 10 log lines: unpackPhase completed in 36 seconds patching sources configuring no configure script, doing nothing building % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 9 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (22) The requested URL returned error: 404 ARTIFACTORY_USERNAME and ARTIFACTORY_PASSWORD must be set. For full logs, run 'nix log /nix/store/xzhmmj58ghc2dga5g11jpbyg5v73y9g1-daml-tarball-2.8.0-snapshot.20231125.12402.0.v9caae0b1.drv'. error: 1 dependencies of derivation '/nix/store/p76c3bkqw1az65vxypn7a5hcbk1pc4pv-daml-sdk-2.8.0-snapshot.20231125.12402.0.v9caae0b1.drv' failed to build direnv: export +ARTIFACTORY_PASSWORD +ARTIFACTORY_TOKEN +ARTIFACTORY_USERNAME ~PATH
regarding the CI error, it appears nix doesn't like different SDK versions. I got it working here:
https://github.com/digital-asset/daml-finance/pull/1169
As pointed out by @garyverhaegen-da:
sdk-version
or daml-version
is changed (in the daml.yaml file), please run bin/update-daml-hashes
to keep shell.nix
in sync (CI will notice & fail). You may need to comment out daml
from the buildInputs
list to get your Nix shell to run while you update the hashes.
@garyverhaegen-da, I have tried to get this branch to work locally but have failed (I see it is currently failing on the CI as well).
My problem seems to be that I can’t get the environment variables into the
daml.nix
script, i.e.,impureEnvVars = [ "ARTIFACTORY_USERNAME" "ARTIFACTORY_PASSWORD" ];
gives me empty values. They are available outside though, if Iecho "Username: $ARTIFACTORY_USERNAME"
from the command line I see a value. The curl commands also work if I run them using my credentials.Do you know if I need to enable impure variables somehow for nix or what the issue might be?
when I ask chatGPT I get: In nix-build: For nix-build, which is used for more reproducible builds, the environment is much more controlled and pure, meaning it does not import environment variables from the user's environment by default. impureEnvVars does not have the same effect in this context.