From 1d3c4e4324d3aeb6cf5b950e6175b5512fe0ce1a Mon Sep 17 00:00:00 2001 From: Hannes Date: Sat, 10 Aug 2024 09:57:24 +0800 Subject: [PATCH 1/3] maintainers: add Hasnep --- maintainers/maintainer-list.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 73b9177703849..5d2d0e1c0e9fd 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -8401,6 +8401,13 @@ githubId = 33969028; name = "Sebastian Hasler"; }; + hasnep = { + name = "Hannes"; + email = "h@nnes.dev"; + matrix = "@hasnep:matrix.org"; + github = "Hasnep"; + githubId = 25184102; + }; hausken = { name = "Hausken"; email = "hauskens-git@disp.lease>"; From 1a5b596d5aa4594b9923a35bbfa1a09322143cd2 Mon Sep 17 00:00:00 2001 From: Hannes Date: Sat, 10 Aug 2024 09:57:24 +0800 Subject: [PATCH 2/3] sqruff: init at 0.17.0 --- pkgs/by-name/sq/sqruff/package.nix | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 pkgs/by-name/sq/sqruff/package.nix diff --git a/pkgs/by-name/sq/sqruff/package.nix b/pkgs/by-name/sq/sqruff/package.nix new file mode 100644 index 0000000000000..03f54d3f6e56d --- /dev/null +++ b/pkgs/by-name/sq/sqruff/package.nix @@ -0,0 +1,56 @@ +{ + lib, + rustPlatform, + fetchFromGitHub, + installShellFiles, + stdenv, + darwin, + rust-jemalloc-sys, + nix-update-script, + testers, + sqruff, +}: +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();' + ''; + + passthru = { + updateScript = nix-update-script { }; + tests.version = testers.testVersion { package = sqruff; }; + }; + + 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 ]; + }; +} From 139cb739fd98f62245c2c9ca45d1c0fb33ed47e3 Mon Sep 17 00:00:00 2001 From: Hannes Date: Thu, 17 Oct 2024 22:47:41 +0800 Subject: [PATCH 3/3] Use recommended version check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: GaƩtan Lepage <33058747+GaetanLepage@users.noreply.github.com> --- pkgs/by-name/sq/sqruff/package.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/sq/sqruff/package.nix b/pkgs/by-name/sq/sqruff/package.nix index 03f54d3f6e56d..d1c9343296ef9 100644 --- a/pkgs/by-name/sq/sqruff/package.nix +++ b/pkgs/by-name/sq/sqruff/package.nix @@ -7,8 +7,7 @@ darwin, rust-jemalloc-sys, nix-update-script, - testers, - sqruff, + versionCheckHook, }: rustPlatform.buildRustPackage rec { pname = "sqruff"; @@ -40,9 +39,12 @@ rustPlatform.buildRustPackage rec { 'config.program.program = "../../target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/sqruff".into();' ''; + nativeCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = [ "--version" ]; + doInstallCheck = true; + passthru = { updateScript = nix-update-script { }; - tests.version = testers.testVersion { package = sqruff; }; }; meta = {