Skip to content

Commit

Permalink
sqruff: init at 0.17.0 (#342435)
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage authored Oct 17, 2024
2 parents d42e72b + 139cb73 commit 1d8bdbd
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
7 changes: 7 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8401,6 +8401,13 @@
githubId = 33969028;
name = "Sebastian Hasler";
};
hasnep = {
name = "Hannes";
email = "[email protected]";
matrix = "@hasnep:matrix.org";
github = "Hasnep";
githubId = 25184102;
};
hausken = {
name = "Hausken";
email = "[email protected]>";
Expand Down
58 changes: 58 additions & 0 deletions pkgs/by-name/sq/sqruff/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
lib,
rustPlatform,
fetchFromGitHub,
installShellFiles,
stdenv,
darwin,
rust-jemalloc-sys,
nix-update-script,
versionCheckHook,
}:
rustPlatform.buildRustPackage rec {
pname = "sqruff";
version = "0.17.0";

src = fetchFromGitHub {
owner = "quarylabs";
repo = "sqruff";
rev = "refs/tags/v${version}";
hash = "sha256-uUtbVf4U59jne5uORXpyzpqhFQoviKi2O9KQ5s1CfhU=";
};

cargoHash = "sha256-kIBjPh+rL4vzIAqGNYMpw39A0vADbHxi/PkhoG+QL6c=";

# Requires nightly features (feature(let_chains) and feature(trait_upcasting))
RUSTC_BOOTSTRAP = true;

nativeBuildInputs = [ installShellFiles ];

buildInputs = [
rust-jemalloc-sys
] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.CoreServices ];

# Patch the tests to find the binary
postPatch = ''
substituteInPlace crates/cli/tests/ui.rs \
--replace-fail \
'config.program.program = format!("../../target/{profile}/sqruff").into();' \
'config.program.program = "../../target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/sqruff".into();'
'';

nativeCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = [ "--version" ];
doInstallCheck = true;

passthru = {
updateScript = nix-update-script { };
};

meta = {
description = "Fast SQL formatter/linter";
homepage = "https://github.com/quarylabs/sqruff";
changelog = "https://github.com/quarylabs/sqruff/releases/tag/${version}";
license = lib.licenses.asl20;
mainProgram = "sqruff";
maintainers = with lib.maintainers; [ hasnep ];
};
}

0 comments on commit 1d8bdbd

Please sign in to comment.