From e331bd9a9200f27f58ebd68612a0d8e383ba23f6 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 3 Dec 2024 11:32:53 +0100 Subject: [PATCH 1/3] websocat: format with nixfmt --- pkgs/tools/misc/websocat/default.nix | 36 +++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/pkgs/tools/misc/websocat/default.nix b/pkgs/tools/misc/websocat/default.nix index 19196355558e..7127b48af2e6 100644 --- a/pkgs/tools/misc/websocat/default.nix +++ b/pkgs/tools/misc/websocat/default.nix @@ -1,5 +1,15 @@ -{ lib, stdenv, fetchFromGitHub, pkg-config, openssl, rustPlatform, libiconv -, Security, makeWrapper, bash }: +{ + lib, + stdenv, + bash, + fetchFromGitHub, + libiconv, + makeWrapper, + openssl, + pkg-config, + rustPlatform, + Security, +}: rustPlatform.buildRustPackage rec { pname = "websocat"; @@ -14,14 +24,21 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-2THUFcaM4niB7YiQiRXJQuaQu02fpgZKPWrejfhmRQ0="; - nativeBuildInputs = [ pkg-config makeWrapper ]; - buildInputs = [ openssl ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv Security ]; + nativeBuildInputs = [ + pkg-config + makeWrapper + ]; + buildInputs = + [ openssl ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + libiconv + Security + ]; buildFeatures = [ "ssl" ]; # Needed to get openssl-sys to use pkg-config. - OPENSSL_NO_VENDOR=1; + OPENSSL_NO_VENDOR = 1; # The wrapping is required so that the "sh-c" option of websocat works even # if sh is not in the PATH (as can happen, for instance, when websocat is @@ -32,11 +49,14 @@ rustPlatform.buildRustPackage rec { ''; meta = with lib; { - homepage = "https://github.com/vi/websocat"; description = "Command-line client for WebSockets (like netcat/socat)"; + homepage = "https://github.com/vi/websocat"; changelog = "https://github.com/vi/websocat/releases/tag/v${version}"; license = licenses.mit; - maintainers = with maintainers; [ thoughtpolice Br1ght0ne ]; + maintainers = with maintainers; [ + thoughtpolice + Br1ght0ne + ]; mainProgram = "websocat"; }; } From f1e02d7a44f70f51d062c4f7a118cedc969e50db Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 3 Dec 2024 11:36:12 +0100 Subject: [PATCH 2/3] websocat: add versionCheckHook --- pkgs/tools/misc/websocat/default.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/misc/websocat/default.nix b/pkgs/tools/misc/websocat/default.nix index 7127b48af2e6..89f9acd7bc9f 100644 --- a/pkgs/tools/misc/websocat/default.nix +++ b/pkgs/tools/misc/websocat/default.nix @@ -9,6 +9,7 @@ pkg-config, rustPlatform, Security, + versionCheckHook, }: rustPlatform.buildRustPackage rec { @@ -17,9 +18,9 @@ rustPlatform.buildRustPackage rec { src = fetchFromGitHub { owner = "vi"; - repo = pname; - rev = "v${version}"; - sha256 = "sha256-v5+9cbKe3c12/SrW7mgN6tvQIiAuweqvMIl46Ce9f2A="; + repo = "websocat"; + rev = "refs/tags/v${version}"; + hash = "sha256-v5+9cbKe3c12/SrW7mgN6tvQIiAuweqvMIl46Ce9f2A="; }; cargoHash = "sha256-2THUFcaM4niB7YiQiRXJQuaQu02fpgZKPWrejfhmRQ0="; @@ -28,6 +29,7 @@ rustPlatform.buildRustPackage rec { pkg-config makeWrapper ]; + buildInputs = [ openssl ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ @@ -35,6 +37,8 @@ rustPlatform.buildRustPackage rec { Security ]; + nativeInstallCheckInputs = [ versionCheckHook ]; + buildFeatures = [ "ssl" ]; # Needed to get openssl-sys to use pkg-config. @@ -48,6 +52,8 @@ rustPlatform.buildRustPackage rec { --prefix PATH : ${lib.makeBinPath [ bash ]} ''; + doInstallCheck = true; + meta = with lib; { description = "Command-line client for WebSockets (like netcat/socat)"; homepage = "https://github.com/vi/websocat"; From 1d957b2e3acf568e8017c29439f9edb3ed9313ae Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 3 Dec 2024 11:41:03 +0100 Subject: [PATCH 3/3] websocat: move to pkgs/by-name --- .../websocat/default.nix => by-name/we/websocat/package.nix} | 4 ++-- pkgs/top-level/all-packages.nix | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) rename pkgs/{tools/misc/websocat/default.nix => by-name/we/websocat/package.nix} (96%) diff --git a/pkgs/tools/misc/websocat/default.nix b/pkgs/by-name/we/websocat/package.nix similarity index 96% rename from pkgs/tools/misc/websocat/default.nix rename to pkgs/by-name/we/websocat/package.nix index 89f9acd7bc9f..a0e14ac56c06 100644 --- a/pkgs/tools/misc/websocat/default.nix +++ b/pkgs/by-name/we/websocat/package.nix @@ -2,13 +2,13 @@ lib, stdenv, bash, + darwin, fetchFromGitHub, libiconv, makeWrapper, openssl, pkg-config, rustPlatform, - Security, versionCheckHook, }: @@ -34,7 +34,7 @@ rustPlatform.buildRustPackage rec { [ openssl ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv - Security + darwin.apple_sdk.frameworks.Security ]; nativeInstallCheckInputs = [ versionCheckHook ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e6d18c1a3849..de5f8be121c5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18176,10 +18176,6 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) Security; }; - websocat = callPackage ../tools/misc/websocat { - inherit (darwin.apple_sdk.frameworks) Security; - }; - vector = callPackage ../tools/misc/vector { inherit (darwin.apple_sdk.frameworks) Security CoreServices SystemConfiguration; };