I’m trying to package mmdebstrap which depends on apt-get among others. When the script tests if tools are installed, apt-get keeps throwing E: Unable to determine a suitable packaging system type error, which blocked the execution:
❯ mmdebstrap
E: Unable to determine a suitable packaging system type
printf: usage: printf [-v var] format [arguments]
E: Unable to determine a suitable packaging system type
printf: usage: printf [-v var] format [arguments]
E: Unable to determine a suitable packaging system type
printf: usage: printf [-v var] format [arguments]
E: cannot find apt-get
The error message is generated here, and it appears to be unable to find a system with score > 0. The only score function is here.
However, those 3 criteria either needs to access /etc/apt/apt.conf or /etc/apt/apt.conf.d to read the configuration files before I can override them, or needs /etc/debian_version to exist. Since I can’t really install files to global /etc, apt-get is unusable as a build input.
Do you think if BIN_DIR is patched to point to dpkg Nix store in CMakeLists.txt, apt would work as input? I’m not too familiar with this code, nor how to generate dynamic patch on the fly.
I have found a way to deal with this without patching the code:
# apt assumes dpkg is installed under the same $BIN_DIR folder on a Debian
# system (among a few other things), otherwise it will refuse to run with
# the following error:
# E: Unable to determine a suitable packaging system type
postInstall = ''
ln -s ${lib.getBin dpkg}/bin/dpkg $out/bin/dpkg
'';
Edit: well there are more works to get it working. I’ll have a complete solution in my PR.