Skip to content

Conversation

@randomizedcoder
Copy link

Add comprehensive Nix packaging support for PCP 7.0.5, enabling reproducible
builds via Nix flakes and preparing for inclusion in nixpkgs.

New files:

  • flake.nix: Main Nix flake with package definition, dev shell, and VM test
  • flake.lock: Pinned nixpkgs and flake-utils versions
  • nix/vm-test.nix: NixOS VM integration test for pmcd daemon
  • nix/patches/gnumakefile-nix-fixes.patch: Remove ownership flags, fix
      tmpfiles path, exclude qa from build
  • nix/patches/tmpdir-portability.patch: Use ${TMPDIR:-/tmp} instead of
      hardcoded /var/tmp for sandbox compatibility
  • nix/patches/configure-ar-portable.patch: Portable ar fallback (not
      applied, available for upstream)
  • docs/HowTos/nix/index.rst: Comprehensive documentation explaining Nix
      packaging, technical details, and future improvements

Features enabled by default (Linux):

  • Core PCP tools, libraries, and PMDAs
  • Python3 and Perl language bindings
  • BPF/BCC kernel tracing PMDAs
  • Systemd integration
  • SNMP, device mapper, and service discovery

The flake provides:

  • nix build: Build PCP package with split outputs (out, man, doc)
  • nix develop: Development shell with build dependencies and PCP logo
  • nix build .#checks.x86_64-linux.vm-test: NixOS VM integration test

Technical fixes for Nix sandbox:

  • Patch /var/tmp to ${TMPDIR:-/tmp} for sandbox compatibility
  • Remove install ownership flags (handled by NixOS module)
  • Fix broken symlinks with double /nix/store prefix
  • Override systemd paths from pkg-config
  • Export AR for configure script

Documentation ./docs/HowTos/nix/index.rst includes explanations of why Nix
packaging can be challenging (non-FHS paths, sandboxed builds, pure
environment) and how these constraints help expose portability issues in
build systems.

Copy link
Member

@kmcdonell kmcdonell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@randomizedcoder Could I suggest you separate the 2 portability patches as a separate PR? I'm happy for those to proceed immediately.
Then you're left with just the one nix-specific patch and the associated nix life-support changes.
For the latter, my only (nit) issue is adding result* to the top-level .gitignore ... can that be more targeted, or does the nix build leave result* files all over the place?

@randomizedcoder
Copy link
Author

G'day Ken,

Thanks for the feedback.

I'm actually from Melbourne also!

Is this what you meant? #2445

Thanks,
Dave

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants