From 1eb140ab221dd9780166ebd168fc1c3c730bb871 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Wed, 25 Jun 2025 15:43:42 +0200 Subject: [PATCH 1/6] libcap_ng: modernize libcap_ng: modernize --- pkgs/by-name/li/libcap_ng/package.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/li/libcap_ng/package.nix b/pkgs/by-name/li/libcap_ng/package.nix index 6435e5b676bf..1e6d2f83ff70 100644 --- a/pkgs/by-name/li/libcap_ng/package.nix +++ b/pkgs/by-name/li/libcap_ng/package.nix @@ -4,15 +4,18 @@ fetchurl, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "libcap-ng"; version = "0.8.5"; src = fetchurl { - url = "https://people.redhat.com/sgrubb/libcap-ng/libcap-ng-${version}.tar.gz"; + url = "https://people.redhat.com/sgrubb/libcap-ng/libcap-ng-${finalAttrs.version}.tar.gz"; hash = "sha256-O6UpTRy9+pivqs+8ALavntK4PoohgXGF39hEzIx6xv8="; }; + strictDeps = true; + enableParallelBuilding = true; + outputs = [ "out" "dev" @@ -23,10 +26,11 @@ stdenv.mkDerivation rec { "--without-python" ]; - meta = with lib; { + meta = { + changelog = "https://people.redhat.com/sgrubb/libcap-ng/ChangeLog"; description = "Library for working with POSIX capabilities"; homepage = "https://people.redhat.com/sgrubb/libcap-ng/"; - platforms = platforms.linux; - license = licenses.lgpl21; + platforms = lib.platforms.linux; + license = lib.licenses.lgpl21; }; -} +}) From 7b7a1f1359846b7b9f97bc61dfc768a65fdffec7 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Wed, 25 Jun 2025 15:50:06 +0200 Subject: [PATCH 2/6] libcap_ng: add pkg-config passthru test --- pkgs/by-name/li/libcap_ng/package.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/by-name/li/libcap_ng/package.nix b/pkgs/by-name/li/libcap_ng/package.nix index 1e6d2f83ff70..a1b156bad8c8 100644 --- a/pkgs/by-name/li/libcap_ng/package.nix +++ b/pkgs/by-name/li/libcap_ng/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchurl, + testers, }: stdenv.mkDerivation (finalAttrs: { @@ -26,10 +27,17 @@ stdenv.mkDerivation (finalAttrs: { "--without-python" ]; + passthru = { + tests = { + pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + }; + }; + meta = { changelog = "https://people.redhat.com/sgrubb/libcap-ng/ChangeLog"; description = "Library for working with POSIX capabilities"; homepage = "https://people.redhat.com/sgrubb/libcap-ng/"; + pkgConfigModules = [ "libcap-ng" ]; platforms = lib.platforms.linux; license = lib.licenses.lgpl21; }; From 1a0d09ef5209ac7d54f657825d6ee7545bedbcdb Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Wed, 25 Jun 2025 20:37:08 +0200 Subject: [PATCH 3/6] libcap_ng: use github sources Using github sources simplifies usage of update script. It is also preferrable, as it gives less opportunity for ingenuine preconfigured artifacts to be included in the release tarball. Checked using diffoscope: The output is identical to what the build using `fetchurl` yields, apart from the `libtool` version string in `$out/lib/libdrop_ambient.la` and nix store hashes. --- pkgs/by-name/li/libcap_ng/package.nix | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/li/libcap_ng/package.nix b/pkgs/by-name/li/libcap_ng/package.nix index a1b156bad8c8..eb67900b5e33 100644 --- a/pkgs/by-name/li/libcap_ng/package.nix +++ b/pkgs/by-name/li/libcap_ng/package.nix @@ -1,7 +1,9 @@ { lib, stdenv, - fetchurl, + fetchFromGitHub, + autoreconfHook, + swig, testers, }: @@ -9,14 +11,26 @@ stdenv.mkDerivation (finalAttrs: { pname = "libcap-ng"; version = "0.8.5"; - src = fetchurl { - url = "https://people.redhat.com/sgrubb/libcap-ng/libcap-ng-${finalAttrs.version}.tar.gz"; - hash = "sha256-O6UpTRy9+pivqs+8ALavntK4PoohgXGF39hEzIx6xv8="; + src = fetchFromGitHub { + owner = "stevegrubb"; + repo = "libcap-ng"; + tag = "v${finalAttrs.version}"; + hash = "sha256-qcHIHG59PDPfPsXA1r4hG4QhK2qyE7AgXOwUDjIy7lE="; }; + # NEWS needs to exist or else the build fails + postPatch = '' + touch NEWS + ''; + strictDeps = true; enableParallelBuilding = true; + nativeBuildInputs = [ + autoreconfHook + swig + ]; + outputs = [ "out" "dev" From 075b80a4caa665d3e6403954aed602a44bf3a8fe Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Wed, 25 Jun 2025 20:29:18 +0200 Subject: [PATCH 4/6] libcap_ng: enable check --- pkgs/by-name/li/libcap_ng/package.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/by-name/li/libcap_ng/package.nix b/pkgs/by-name/li/libcap_ng/package.nix index eb67900b5e33..6fcf930cccd4 100644 --- a/pkgs/by-name/li/libcap_ng/package.nix +++ b/pkgs/by-name/li/libcap_ng/package.nix @@ -47,6 +47,10 @@ stdenv.mkDerivation (finalAttrs: { }; }; + # assumption: build machine runs linux kernel 5.0 or newer + # see https://github.com/stevegrubb/libcap-ng?tab=readme-ov-file#note-to-distributions + doCheck = true; + meta = { changelog = "https://people.redhat.com/sgrubb/libcap-ng/ChangeLog"; description = "Library for working with POSIX capabilities"; From 6be5e909c5f567a61f39b879b88d39d553f8f872 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Wed, 25 Jun 2025 20:38:52 +0200 Subject: [PATCH 5/6] libcap_ng: add updateScript --- pkgs/by-name/li/libcap_ng/package.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/by-name/li/libcap_ng/package.nix b/pkgs/by-name/li/libcap_ng/package.nix index 6fcf930cccd4..efffdae63ae4 100644 --- a/pkgs/by-name/li/libcap_ng/package.nix +++ b/pkgs/by-name/li/libcap_ng/package.nix @@ -5,6 +5,7 @@ autoreconfHook, swig, testers, + nix-update-script, }: stdenv.mkDerivation (finalAttrs: { @@ -42,6 +43,7 @@ stdenv.mkDerivation (finalAttrs: { ]; passthru = { + updateScript = nix-update-script { }; tests = { pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; }; From b22910a00618bb8fc7c83677a941d01454fe414d Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Wed, 25 Jun 2025 20:29:37 +0200 Subject: [PATCH 6/6] libcap_ng: add grimmauld to maintainers --- pkgs/by-name/li/libcap_ng/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/li/libcap_ng/package.nix b/pkgs/by-name/li/libcap_ng/package.nix index efffdae63ae4..99b7547c8fcc 100644 --- a/pkgs/by-name/li/libcap_ng/package.nix +++ b/pkgs/by-name/li/libcap_ng/package.nix @@ -60,5 +60,6 @@ stdenv.mkDerivation (finalAttrs: { pkgConfigModules = [ "libcap-ng" ]; platforms = lib.platforms.linux; license = lib.licenses.lgpl21; + maintainers = with lib.maintainers; [ grimmauld ]; }; })