From a13b8577ac02e0d3ebb45d88d37060278a4ffd5b Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 17 Nov 2025 10:29:01 +0100 Subject: [PATCH 1/9] conmon: use `finalAttrs` pattern --- pkgs/by-name/co/conmon/package.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/co/conmon/package.nix b/pkgs/by-name/co/conmon/package.nix index 5cdf2d780249..eacc8f4f27da 100644 --- a/pkgs/by-name/co/conmon/package.nix +++ b/pkgs/by-name/co/conmon/package.nix @@ -10,14 +10,14 @@ nixosTests, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "conmon"; version = "2.1.13"; src = fetchFromGitHub { owner = "containers"; repo = "conmon"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-XsVWcJsUc0Fkn7qGRJDG5xrQAsJr6KN7zMy3AtPuMTo="; }; @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { # manpage requires building the vendored go-md2man makeFlags = [ "bin/conmon" - "VERSION=${version}" + "VERSION=${finalAttrs.version}" ]; installPhase = '' @@ -49,13 +49,13 @@ stdenv.mkDerivation rec { passthru.tests = { inherit (nixosTests) cri-o podman; }; - meta = with lib; { - changelog = "https://github.com/containers/conmon/releases/tag/${src.rev}"; + meta = { + changelog = "https://github.com/containers/conmon/releases/tag/${finalAttrs.src.tag}"; homepage = "https://github.com/containers/conmon"; description = "OCI container runtime monitor"; - license = licenses.asl20; - teams = [ teams.podman ]; - platforms = platforms.linux; + license = lib.licenses.asl20; + teams = [ lib.teams.podman ]; + platforms = lib.platforms.linux; mainProgram = "conmon"; }; -} +}) From fdbd39c3436beffcfa93cdc2b90d1b1f014872a1 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 17 Nov 2025 10:48:06 +0100 Subject: [PATCH 2/9] conmon: use `systemdMinimal` --- pkgs/by-name/co/conmon/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/co/conmon/package.nix b/pkgs/by-name/co/conmon/package.nix index eacc8f4f27da..93b18b20a287 100644 --- a/pkgs/by-name/co/conmon/package.nix +++ b/pkgs/by-name/co/conmon/package.nix @@ -6,7 +6,7 @@ glib, glibc, libseccomp, - systemd, + systemdMinimal, nixosTests, }: @@ -25,7 +25,7 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ glib libseccomp - systemd + systemdMinimal ] ++ lib.optionals (!stdenv.hostPlatform.isMusl) [ glibc From 70e9ab70681735a18caaa25c8030eb4c9e5de0c3 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 17 Nov 2025 15:29:49 +0100 Subject: [PATCH 3/9] conmon: add `versionCheckHook` --- pkgs/by-name/co/conmon/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/co/conmon/package.nix b/pkgs/by-name/co/conmon/package.nix index 93b18b20a287..f412f33c9c39 100644 --- a/pkgs/by-name/co/conmon/package.nix +++ b/pkgs/by-name/co/conmon/package.nix @@ -8,6 +8,7 @@ libseccomp, systemdMinimal, nixosTests, + versionCheckHook, }: stdenv.mkDerivation (finalAttrs: { @@ -49,6 +50,10 @@ stdenv.mkDerivation (finalAttrs: { passthru.tests = { inherit (nixosTests) cri-o podman; }; + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "--version"; + meta = { changelog = "https://github.com/containers/conmon/releases/tag/${finalAttrs.src.tag}"; homepage = "https://github.com/containers/conmon"; From 19025f89ec1f160afc8dceb4bc63d884b4efadf0 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 17 Nov 2025 16:26:23 +0100 Subject: [PATCH 4/9] conmon: use `GIT_COMMIT` --- pkgs/by-name/co/conmon/package.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/co/conmon/package.nix b/pkgs/by-name/co/conmon/package.nix index f412f33c9c39..ad0840384a40 100644 --- a/pkgs/by-name/co/conmon/package.nix +++ b/pkgs/by-name/co/conmon/package.nix @@ -19,9 +19,20 @@ stdenv.mkDerivation (finalAttrs: { owner = "containers"; repo = "conmon"; tag = "v${finalAttrs.version}"; - hash = "sha256-XsVWcJsUc0Fkn7qGRJDG5xrQAsJr6KN7zMy3AtPuMTo="; + hash = "sha256-/Kt49c8a+R/+Z3KmFLpRTG+BdfPDAOEUtSis3alLAUQ="; + leaveDotGit = true; + postFetch = '' + cd $out + git rev-parse HEAD > COMMIT + rm -rf .git + ''; }; + preConfigure = '' + substituteInPlace Makefile \ + --replace-fail "(GIT_COMMIT)" "(shell cat COMMIT)" + ''; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ glib @@ -36,7 +47,6 @@ stdenv.mkDerivation (finalAttrs: { # manpage requires building the vendored go-md2man makeFlags = [ "bin/conmon" - "VERSION=${finalAttrs.version}" ]; installPhase = '' From 19240799ee376781afa48c95a329cda71b8e1dad Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 17 Nov 2025 10:48:16 +0100 Subject: [PATCH 5/9] crun: use `finalAttrs` pattern --- pkgs/by-name/cr/crun/package.nix | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/cr/crun/package.nix b/pkgs/by-name/cr/crun/package.nix index d180b228c02e..4163ccddcf0c 100644 --- a/pkgs/by-name/cr/crun/package.nix +++ b/pkgs/by-name/cr/crun/package.nix @@ -38,14 +38,14 @@ let ]; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "crun"; version = "1.25.1"; src = fetchFromGitHub { owner = "containers"; repo = "crun"; - rev = version; + tag = finalAttrs.version; hash = "sha256-WBAwyDODMrUDlgonRbxaNQ+aN8K6YicY2JVArXDJem8="; fetchSubmodules = true; }; @@ -68,13 +68,15 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; strictDeps = true; - NIX_LDFLAGS = "-lcriu"; + env = { + NIX_LDFLAGS = "-lcriu"; + }; # we need this before autoreconfHook does its thing in order to initialize # config.h with the correct values postPatch = '' - echo ${version} > .tarball-version - echo '#define GIT_VERSION "${src.rev}"' > git-version.h + echo ${finalAttrs.version} > .tarball-version + echo '#define GIT_VERSION "${finalAttrs.src.tag}"' > git-version.h ${lib.concatMapStringsSep "\n" ( e: "substituteInPlace Makefile.am --replace 'tests/${e}' ''" @@ -86,7 +88,7 @@ stdenv.mkDerivation rec { passthru.tests = { inherit (nixosTests) podman; }; meta = { - changelog = "https://github.com/containers/crun/releases/tag/${version}"; + changelog = "https://github.com/containers/crun/releases/tag/${finalAttrs.version}"; description = "Fast and lightweight fully featured OCI runtime and C library for running containers"; homepage = "https://github.com/containers/crun"; license = lib.licenses.gpl2Plus; @@ -94,4 +96,4 @@ stdenv.mkDerivation rec { teams = [ lib.teams.podman ]; mainProgram = "crun"; }; -} +}) From 4f6318ccc74892b202cd9e2b6497b5ff48836c2f Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 17 Nov 2025 10:48:37 +0100 Subject: [PATCH 6/9] crun: use `systemdMinimal` --- pkgs/by-name/cr/crun/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/cr/crun/package.nix b/pkgs/by-name/cr/crun/package.nix index 4163ccddcf0c..12060159d257 100644 --- a/pkgs/by-name/cr/crun/package.nix +++ b/pkgs/by-name/cr/crun/package.nix @@ -8,7 +8,7 @@ libcap, libseccomp, python3, - systemd, + systemdMinimal, yajl, nixosTests, criu, @@ -61,7 +61,7 @@ stdenv.mkDerivation (finalAttrs: { criu libcap libseccomp - systemd + systemdMinimal yajl ]; From 5392c7e2d0b79c783ed5b42d61b8254e2cb7c505 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 17 Nov 2025 15:28:22 +0100 Subject: [PATCH 7/9] crun: add `versionCheckHook` --- pkgs/by-name/cr/crun/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/cr/crun/package.nix b/pkgs/by-name/cr/crun/package.nix index 12060159d257..e815a5e40b5a 100644 --- a/pkgs/by-name/cr/crun/package.nix +++ b/pkgs/by-name/cr/crun/package.nix @@ -12,6 +12,7 @@ yajl, nixosTests, criu, + versionCheckHook, }: let @@ -87,6 +88,10 @@ stdenv.mkDerivation (finalAttrs: { passthru.tests = { inherit (nixosTests) podman; }; + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "--version"; + meta = { changelog = "https://github.com/containers/crun/releases/tag/${finalAttrs.version}"; description = "Fast and lightweight fully featured OCI runtime and C library for running containers"; From 18b81736bb8fed36adc2dd9db901e09bfb6cc1b5 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 17 Nov 2025 16:30:25 +0100 Subject: [PATCH 8/9] crun: use commit ID --- pkgs/by-name/cr/crun/package.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/cr/crun/package.nix b/pkgs/by-name/cr/crun/package.nix index e815a5e40b5a..6c2fa30a251b 100644 --- a/pkgs/by-name/cr/crun/package.nix +++ b/pkgs/by-name/cr/crun/package.nix @@ -49,6 +49,12 @@ stdenv.mkDerivation (finalAttrs: { tag = finalAttrs.version; hash = "sha256-WBAwyDODMrUDlgonRbxaNQ+aN8K6YicY2JVArXDJem8="; fetchSubmodules = true; + leaveDotGit = true; + postFetch = '' + cd $out + git rev-parse HEAD > COMMIT + rm -rf .git + ''; }; nativeBuildInputs = [ @@ -77,10 +83,10 @@ stdenv.mkDerivation (finalAttrs: { # config.h with the correct values postPatch = '' echo ${finalAttrs.version} > .tarball-version - echo '#define GIT_VERSION "${finalAttrs.src.tag}"' > git-version.h + echo "#define GIT_VERSION \"$(cat COMMIT)\"" > git-version.h ${lib.concatMapStringsSep "\n" ( - e: "substituteInPlace Makefile.am --replace 'tests/${e}' ''" + e: "substituteInPlace Makefile.am --replace-fail 'tests/${e}' ''" ) disabledTests} ''; From d060dee75bcae416a63de584c3aa58a663402539 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 17 Nov 2025 10:48:47 +0100 Subject: [PATCH 9/9] podman: use `systemdMinimal` --- pkgs/by-name/po/podman/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/po/podman/package.nix b/pkgs/by-name/po/podman/package.nix index 74d743260233..6b7dd7cb6c10 100644 --- a/pkgs/by-name/po/podman/package.nix +++ b/pkgs/by-name/po/podman/package.nix @@ -11,7 +11,7 @@ libapparmor, libseccomp, libselinux, - systemd, + systemdMinimal, go-md2man, nixosTests, python3, @@ -83,7 +83,7 @@ buildGoModule (finalAttrs: { libseccomp libselinux lvm2 - systemd + systemdMinimal ]; env = { @@ -134,7 +134,7 @@ buildGoModule (finalAttrs: { postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' RPATH=$(patchelf --print-rpath $out/bin/.podman-wrapped) - patchelf --set-rpath "${lib.makeLibraryPath [ systemd ]}":$RPATH $out/bin/.podman-wrapped + patchelf --set-rpath "${lib.makeLibraryPath [ systemdMinimal ]}":$RPATH $out/bin/.podman-wrapped substituteInPlace "$out/share/systemd/user/podman-user-wait-network-online.service" \ --replace-fail sleep '${coreutils}/bin/sleep' \ --replace-fail /bin/sh '${runtimeShell}'