nh2 / static-haskell-nix

easily build most Haskell programs into fully static Linux executables
389 stars 35 forks source link

Cannot build `cachix` #15

Closed nomeata closed 5 years ago

nomeata commented 5 years ago

In https://github.com/cachix/cachix/issues/184#issuecomment-473766644 it was suggested that

NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/88ae8f7d.tar.gz nix-build --no-link survey/default.nix -A haskellPackages.cachix

would build a static version of cachix. Unfortunately, it fails here:

~/build/haskell/static-haskell-nix $ NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/88ae8f7d.tar.gz nix-build --no-link survey/default.nix -A haskellPackages.cachix -j8 --builders ''
…
running tests
Running 2 test suites...
Test suite spec: RUNNING...
[ 6 of 15] Compiling Data.Swagger.Lens ( src/Data/Swagger/Lens.hs, dist/build/Data/Swagger/Lens.o )
[ 7 of 15] Compiling Data.Swagger.SchemaOptions ( src/Data/Swagger/SchemaOptions.hs, dist/build/Data/Swagger/SchemaOptions.o )
[ 8 of 15] Compiling Data.Swagger.Internal.ParamSchema ( src/Data/Swagger/Internal/ParamSchema.hs, dist/build/Data/Swagger/Internal/ParamSchema.o )
[ 9 of 15] Compiling Data.Swagger.ParamSchema ( src/Data/Swagger/ParamSchema.hs, dist/build/Data/Swagger/ParamSchema.o )
[10 of 15] Compiling Data.Swagger.Internal.Schema ( src/Data/Swagger/Internal/Schema.hs, dist/build/Data/Swagger/Internal/Schema.o )
[11 of 15] Compiling Data.Swagger.Schema ( src/Data/Swagger/Schema.hs, dist/build/Data/Swagger/Schema.o )
[12 of 15] Compiling Data.Swagger.Operation ( src/Data/Swagger/Operation.hs, dist/build/Data/Swagger/Operation.o )
[13 of 15] Compiling Data.Swagger.Internal.Schema.Validation ( src/Data/Swagger/Internal/Schema/Validation.hs, dist/build/Data/Swagger/Internal/Schema/Validation.o )
[14 of 15] Compiling Data.Swagger.Schema.Validation ( src/Data/Swagger/Schema/Validation.hs, dist/build/Data/Swagger/Schema/Validation.o )
[15 of 15] Compiling Data.Swagger     ( src/Data/Swagger.hs, dist/build/Data/Swagger.o )
[ 1 of 15] Compiling Data.Swagger.Declare ( src/Data/Swagger/Declare.hs, dist/build/Data/Swagger/Declare.p_o )

src/Data/Swagger/Declare.hs:165:46: warning: [-Wdeprecations]
    In the use of type constructor or class ‘ListT’
    (imported from Control.Monad.List, but defined in Control.Monad.Trans.List):
    Deprecated: "This transformer is invalid on most monads"
    |
165 | instance MonadDeclare d m => MonadDeclare d (ListT m) where
    |                                              ^^^^^
[ 2 of 15] Compiling Data.Swagger.Internal.AesonUtils ( src/Data/Swagger/Internal/AesonUtils.hs, dist/build/Data/Swagger/Internal/AesonUtils.p_o )
[ 3 of 15] Compiling Data.Swagger.Internal.TypeShape ( src/Data/Swagger/Internal/TypeShape.hs, dist/build/Data/Swagger/Internal/TypeShape.p_o )
[ 4 of 15] Compiling Data.Swagger.Internal.Utils ( src/Data/Swagger/Internal/Utils.hs, dist/build/Data/Swagger/Internal/Utils.p_o )
[ 5 of 15] Compiling Data.Swagger.Internal ( src/Data/Swagger/Internal.hs, dist/build/Data/Swagger/Internal.p_o )

Servant.Auth.Server
  The Auth combinator
    returns a 401 if all authentications are Indefinite
    succeeds if one authentication suceeds
      +++ OK, passed 100 tests.
    fails (403) if one authentication fails
      # PENDING: Authentications don't yet fail, only are Indefinite
    doesn't clobber pre-existing response headers
      +++ OK, passed 100 tests.
    Raw
      gets the response body
        +++ OK, passed 100 tests.
      doesn't clobber pre-existing reponse headers
        +++ OK, passed 100 tests.
    Setting cookies
      sets cookies that it itself accepts
        +++ OK, passed 100 tests.
      uses the Expiry from the configuration
        +++ OK, passed 100 tests.
      sets the token cookie as HttpOnly
        +++ OK, passed 100 tests.
  The Auth combinator
    With XSRF check
      fails if XSRF header and cookie don't match FAILED [1]
      fails with no XSRF header or cookie
        +++ OK, passed 100 tests.
      succeeds if XSRF header and cookie match, and JWT is valid
        +++ OK, passed 100 tests.
      sets and clears the right cookies
        +++ OK, passed 100 tests.
    With no XSRF check for GET requests
      succeeds with no XSRF header or cookie for GET
        +++ OK, passed 100 tests.
      fails with no XSRF header or cookie for POST
        +++ OK, passed 100 tests.
    With no XSRF check at all
      succeeds with no XSRF header or cookie for GET
        +++ OK, passed 100 tests.
      succeeds with no XSRF header or cookie for POST
        +++ OK, passed 100 tests.
      sets and clears the right cookies
        +++ OK, passed 100 tests.
  The JWT combinator
    fails if 'aud' does not match predicate
      +++ OK, passed 100 tests.
    succeeds if 'aud' does match predicate FAILED [2]
    fails if 'nbf' is set to a future date
      +++ OK, passed 100 tests.
    fails if 'exp' is set to a past date
      +++ OK, passed 100 tests.
    succeeds if 'exp' is set to a future date
      +++ OK, passed 100 tests.
    fails if JWT is not signed
      +++ OK, passed 100 tests.
    fails if JWT does not use expected algorithm
      # PENDING: Need https://github.com/frasertweedale/hs-jose/issues/19
    fails if data is not valid JSON
    suceeds as wreq's oauth2Bearer
      +++ OK, passed 100 tests.
  throwAll
    works for plain values
    works for function types
      +++ OK, passed 100 tests.
  The BasicAuth combinator
    succeeds with the correct password and username
    fails with non-existent user
    fails with incorrect password
    fails with no auth header

Failures:

  test/Servant/Auth/ServerSpec.hs:526:32:
  1) Servant.Auth.Server, The Auth combinator, With XSRF check, fails if XSRF header and cookie don't match
       Falsifiable (after 73 tests):
         User {name = "o~8fr\SOIB\7288\ETXr\594666.x\936020HF@\943883I\260569Sf=\305132U\ESC|\321218\&7\675297\1065722}\334695\feI6\322731{\50885~~\DEL\\\341886\RS\878266g\874217\1065911\v\RS\723836i\697751\963120i\ACK\374486K\997076", _id = "^\585134\831983zqkJ\DC4R G\NAK\435941%\r\vRJ\535080)6N\SI\264671\385762$+}#\452437_AV\ETX\1085042\NUL\SOH`M\1046392\1036372\189890\445035\SUB&n%!\451181yU\\\ETB\293643"}
       predicate failed on expected exception: HttpException (HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 38215
         secure               = False
         requestHeaders       = [("Cookie","TheyDinedOnMince=blerg; RuncibleSpoon=eyJhbGciOiJIUzI1NiJ9.eyJkYXQiOnsiX2lkIjoiXvKOtq7zi4evenFrSlx1MDAxNFIgR1x1MDAxNfGqm6UlXHJcdTAwMGJSSvKCqKgpNk5cdTAwMGbxgKef8Z6LoiQrfSPxrp2VX0FWXHUwMDAz9Ii5slx1MDAwMFx1MDAwMWBN87-duPO9gZTwrpeC8aypq1x1MDAxYSZuJSHxromteVVcXFx1MDAxN_GHrIsiLCJuYW1lIjoib344ZnJcdTAwMGVJQuGxuFx1MDAwM3LykYuqLnjzpKGUSEZA86aci0nwv6eZU2Y98YqfrFVcdTAwMWJ88Y6bgjfypLeh9ISLun3xka2nXHUwMDBjZUk28Y6yq3vsm4V-fn9cXPGTnb5cdTAwMWXzlpq6Z_OVm6n0hI63XHUwMDBiXHUwMDFl8rCtvGnyqpaX86uIsGlcdTAwMDbxm5uWS_Ozm5QifX0.rxoQ5jx5YSE14jcs12OUQWXnAf9fTFI3rmcwHug2a9k"),("AndSlicesOfQuince","blah"),("User-Agent","haskell wreq-0.5.2.1")]
         path                 = "/"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        (InternalException Network.Socket.recvBuf: resource vanished (Connection reset by peer)))

  To rerun use: --match "/Servant.Auth.Server/The Auth combinator/With XSRF check/fails if XSRF header and cookie don't match/"

  test/Servant/Auth/ServerSpec.hs:291:3:
  2) Servant.Auth.Server, The JWT combinator, succeeds if 'aud' does match predicate
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 36609
         secure               = False
         requestHeaders       = [("Authorization","<REDACTED>"),("User-Agent","haskell wreq-0.5.2.1")]
         path                 = "/"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        (InternalException Network.Socket.recvBuf: resource vanished (Connection reset by peer))
       (after 72 tests)
         User {name = "{i\DC22)>", _id = "\648735\931178Y7gi\311350\ENQ\FSN\ENQK6\137112\r\287965\439247\961389\242656\1072694\&9`S\r:t'h/V~rT\727610E\DC2\SOH\NULL\SI\EOT#\SYNz\fi:Tq[awDC\EOT\872054\554206l_3_"}

  To rerun use: --match "/Servant.Auth.Server/The JWT combinator/succeeds if 'aud' does match predicate/"

Randomized with seed 1298701833

Finished in 61.8818 seconds
33 examples, 2 failures, 2 pending
Test suite spec: FAIL
Test suite logged to: dist/test/servant-auth-server-0.4.0.0-spec.log
Test suite readme: RUNNING...
Test suite readme: PASS
Test suite logged to: dist/test/servant-auth-server-0.4.0.0-readme.log
1 of 2 test suites (1 of 2 test cases) passed.
builder for '/nix/store/82nll6705z1hw05g4afp4427nr510i5z-servant-auth-server-0.4.0.0.drv' failed with exit code 1
nomeata commented 5 years ago

Hmm, the number of test failures of servant-auth-server vary from run to run. Probably a problem with upstream's test suite being not very robust. Likely https://github.com/haskell-servant/servant-auth/issues/115.

nomeata commented 5 years ago

Indeed, this is just https://github.com/haskell-servant/servant-auth/issues/115 and just retrying the build in a loop eventually made it build cachix!