Problem with a Scons derivation that installs a DBus file

Hello! I would really appreciate some help with this issue, which involves SCons and DBus.

TL/DR version (detailed context below)

The package, among other stuff, installs a dBus file. It is SCons based. Scons is printing the following error:


Insufficient rights to install the system-wide dbus service file.
Please run the "scons install" command with higher authority.

How can I fix this?

Detailed context

Situation

The situation is there’s a package that stopped working for me around a year ago, which is [ffado-mixer]( nixpkgs/pkgs/os-specific/linux/ffado/default.nix at 25f538306313eae3927264466c70d7001dcea1df · NixOS/nixpkgs · GitHub ).

The issue seems to be it isn’t building its associated DBus service (I directly arrived to that conclussion discussing this wit the main developer).

When I looked into the buiilding logs using nix log I could clearly see that Scons was scanning for some dependencies for this service, not finding them and therefore not building the DBus portion.

I moved one of the dependencies (dbus-cplusplus) from buildInputs into nativeBuildInputs and that error stopped happening, but I got a new one which is still stopping it from building, the one in TL/DR above.

I’m assuming there must be a way to trick SCons into thinking it is inside a normal system and all the privileges it wants are arond, but I don’t know how to do it in this situation.

Derivation

{
  lib,
  stdenv,
  argp-standalone,
  dbus,
  dbus_cplusplus,
  fetchurl,
  glibmm,
  libavc1394,
  libconfig,
  libiec61883,
  libraw1394,
  libxmlxx3,
  libxcb,
  xcb-util-cursor,
  pkg-config,
  python3,
  scons,
  which,
  qt5,
}:

let
  python = python3.withPackages (
    pkgs:
    with pkgs;
    (
      [
        distutils
      ]
      ++ lib.optionals withMixer [
        pyqt5
        dbus-python
      ]
    )
  );
  withMixer = true;
in
stdenv.mkDerivation rec {
  pname = "ffado";
  version = "2.5.0";

  outputs = [
    "out"
    "bin"
    "dev"
  ];

  src = fetchurl {
    url = "http://www.ffado.org/files/libffado-${version}.tgz";
    hash = "sha256-JcEtk9U5iPPK+ZZSNu03nxZ6vePqTMYzsTTuYlTYfKE=";
  };

  prePatch =
    ''
      substituteInPlace ./support/tools/ffado-diag.in \
        --replace /lib/modules/ "/run/booted-system/kernel-modules/lib/modules/"

      # prevent build tools from leaking into closure
      substituteInPlace support/tools/SConscript --replace-fail \
        'support/tools/ffado-diag --static' \
        "echo '"'See `nix-store --query --tree ${placeholder "out"}`.'"'"
    ''
    + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
      # skip the CC sanity check, since that requires invoking cross-compiled binaries during build
      substituteInPlace SConstruct \
        --replace-fail 'conf.CompilerCheck()' 'True' \
        --replace-fail "pkg-config" "$PKG_CONFIG"
      substituteInPlace admin/pkgconfig.py \
        --replace-fail "pkg-config" "$PKG_CONFIG"
    '';

  nativeBuildInputs =
    [
      scons
      pkg-config
      which
      dbus
      dbus_cplusplus
    ]
    ++ lib.optionals withMixer [
      python
      python.pkgs.pyqt5
      qt5.wrapQtAppsHook
      libxcb
      xcb-util-cursor
    ];

  prefixKey = "PREFIX=";
  sconsFlags = [
    "CUSTOM_ENV=True" # tell SConstruct to use nixpkgs' CC/CXX/CFLAGS
    "DETECT_USERSPACE_ENV=False"
    "DEBUG=False"
    "ENABLE_ALL=True"
    "BUILD_TESTS=True"
    "BUILD_MIXER=${if withMixer then "True" else "False"}"
    "UDEVDIR=${placeholder "out"}/lib/udev/rules.d"
    "PYPKGDIR=${placeholder "out"}/${python.sitePackages}"
    "BINDIR=${placeholder "bin"}/bin"
    "INCLUDEDIR=${placeholder "dev"}/include"
    "PYTHON_INTERPRETER=${python.interpreter}"
  ];

  buildInputs =
    [
      dbus
      dbus_cplusplus
      glibmm
      libavc1394
      libconfig
      libiec61883
      libraw1394
      libxmlxx3
      python
    ]
    ++ lib.optionals (!stdenv.hostPlatform.isGnu) [
      argp-standalone
    ];

  NIX_LDFLAGS = lib.optionalString (!stdenv.hostPlatform.isGnu) "-largp";

  enableParallelBuilding = true;
  dontWrapQtApps = true;
  strictDeps = true;

  preFixup = lib.optionalString withMixer ''
    wrapQtApp "$bin/bin/ffado-mixer"
  '';

  meta = with lib; {
    homepage = "http://www.ffado.org";
    description = "FireWire audio drivers";
    license = licenses.gpl3;
    maintainers = with maintainers; [
      michojel
    ];
    platforms = platforms.linux;
  };
}

System details

  • nixos version: 25.11