Upgrade nixpkgs, bump Haskell tool versions, and fix the new HLint errors.

Maintenance work to keep our server tools up to date.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10503
GitOrigin-RevId: 4402e39a5600d14c1e7d5eb4c91b152c2111f315
This commit is contained in:
Samir Talwar 2023-11-22 10:01:03 +01:00 committed by hasura-bot
parent 250b1d4709
commit 0373beaed0
6 changed files with 25 additions and 21 deletions

6
flake.lock generated
View File

@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1696330627,
"narHash": "sha256-o0WGId7Vuhl+5KeNgh343Orex0YUMVCopf1LWr+kI/k=",
"lastModified": 1699914561,
"narHash": "sha256-b296O45c3Jgj8GEFg/NN7ZOJjBBCHr1o2iA4yoJ3OKE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7b6b919f3a707c566b8592106bb7ce070721b137",
"rev": "2f8742189e9ef86961ab90a30c68eb844565578a",
"type": "github"
},
"original": {

View File

@ -32,7 +32,7 @@ let
};
unixODBC = pkgs.unixODBC.overrideAttrs (oldAttrs: {
configureFlags = [ "--disable-gui" "--sysconfdir=${odbcConfiguration}" ];
configureFlags = (if oldAttrs ? configureFlags then oldAttrs.configureFlags else [ ]) ++ [ "--disable-gui" "--sysconfdir=${odbcConfiguration}" ];
});
# Ensure that GHC and HLS have access to all the dynamic libraries we have kicking around.
@ -48,8 +48,8 @@ let
for bin in ${original}/bin/*; do
if [[ -x "$bin" ]]; then
makeWrapper "$bin" "$out/bin/$(basename "$bin")" \
--set LD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries} \
--set DYLD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries}
--set LD_LIBRARY_PATH ${dynamicLibraryPath} \
--set DYLD_LIBRARY_PATH ${dynamicLibraryPath}
fi
done
'';
@ -65,11 +65,11 @@ let
installPhase = ''
mkdir -p "$out/bin"
makeWrapper ${original}/bin/haskell-language-server "$out/bin/haskell-language-server" \
--set LD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries} \
--set DYLD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries}
--set LD_LIBRARY_PATH ${dynamicLibraryPath} \
--set DYLD_LIBRARY_PATH ${dynamicLibraryPath}
makeWrapper ${original}/bin/haskell-language-server-wrapper "$out/bin/haskell-language-server-wrapper" \
--set LD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries} \
--set DYLD_LIBRARY_PATH ${pkgs.lib.strings.makeLibraryPath dynamicLibraries}
--set LD_LIBRARY_PATH ${dynamicLibraryPath} \
--set DYLD_LIBRARY_PATH ${dynamicLibraryPath}
'';
};
@ -108,7 +108,7 @@ let
(versions.ensureVersion pkgs.haskell.packages.${pkgs.ghcName}.hlint)
pkgs.haskell.packages.${pkgs.ghcName}.hoogle
pkgs.haskell.packages.${pkgs.ghcName}.hspec-discover
(versions.ensureVersion pkgs.haskell.packages.${pkgs.ghcName}.ormolu_0_7_1_0)
(versions.ensureVersion pkgs.haskell.packages.${pkgs.ghcName}.ormolu)
];
devInputs = [
@ -146,6 +146,8 @@ let
pkgs.stdenv.cc.cc.lib
];
dynamicLibraryPath = pkgs.lib.strings.makeLibraryPath dynamicLibraries;
includeLibraries = [
pkgs.libkrb5.dev
pkgs.ncurses.dev
@ -160,6 +162,10 @@ let
++ includeLibraries
++ integrationTestInputs;
in
pkgs.mkShell {
pkgs.mkShell ({
buildInputs = baseInputs ++ consoleInputs ++ docsInputs ++ serverDeps ++ devInputs ++ ciInputs;
}
} // pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin {
shellHook = ''
export DYLD_LIBRARY_PATH='${dynamicLibraryPath}'
'';
})

View File

@ -1,6 +1,6 @@
{
"cabal-install": "3.10.1.0",
"ghc": "9.4.5",
"hlint": "3.5",
"ormolu": "0.7.1.0"
"hlint": "3.6.1",
"ormolu": "0.7.2.0"
}

View File

@ -192,7 +192,7 @@ postWithHeadersStatusViaWebSocket testEnv headers requestBody = do
]
]
responseListener testEnv connection \_ type' payload -> do
when (type' `notElem` ["data", "error"]) $ fail ("Websocket message type " <> T.unpack type' <> " received. Payload: " <> Char8.unpack (encode payload))
unless (type' `elem` ["data", "error"]) $ fail ("Websocket message type " <> T.unpack type' <> " received. Payload: " <> Char8.unpack (encode payload))
pure payload
-- | Post some JSON to graphql-engine, getting back more JSON.

View File

@ -459,10 +459,8 @@ supportedConnectionTemplateVersions = [1]
instance FromJSON ConnectionTemplate where
parseJSON = withObject "ConnectionTemplate" $ \o -> do
version <- o .:? "version" .!= 1
when (version `notElem` supportedConnectionTemplateVersions)
$ fail
$ "Supported versions are "
<> show supportedConnectionTemplateVersions
unless (version `elem` supportedConnectionTemplateVersions)
$ fail ("Supported versions are " <> show supportedConnectionTemplateVersions)
ConnectionTemplate version
<$> o
.: "template"

View File

@ -598,7 +598,7 @@ processJwt_ processJwtBytes decodeIssuer fGetHeaderType jwtCtxs headers mUnAuthR
>>= mkRoleName
. bsToTxt
when (requestedRole `notElem` allowedRoles)
unless (requestedRole `elem` allowedRoles)
$ throw400 AccessDenied "Your requested role is not in allowed roles"
let finalClaims =
HashMap.delete defaultRoleClaim . HashMap.delete allowedRolesClaim $ claimsMap