I’m using the azure-functions-core-tools package for .NET development and found good us of it.
The issue that I’ve bumped into is that the precompiled release of the package contains some more binaries, then what is being packed by NixOS.
I’ve tried to do a manual build of the NixOS package, and that only contains a single “func” binary, while the prebuild package contains:
./func
./in-proc6/func
./in-proc8/func
Can the package be adjusted or can I somehow use the precompiled binary?
But I’m still missing dependencies, that I haven’t managed to add - could anyone point me in the right direction:
> error: auto-patchelf could not satisfy dependency libssl.so.1.0.0 wanted by /nix/store/gllzaq8c1xz53k23cr3z0xfysm0c6vh0-azure-functions-cli-bin-4.0.6821/usr/lib/azure-functions-cli-bin/workers/powershell/7/runtimes/linux-x64/native/libmi.so
> error: auto-patchelf could not satisfy dependency libcrypto.so.1.0.0 wanted by /nix/store/gllzaq8c1xz53k23cr3z0xfysm0c6vh0-azure-functions-cli-bin-4.0.6821/usr/lib/azure-functions-cli-bin/workers/powershell/7/runtimes/linux-x64/native/libmi.so
> error: auto-patchelf could not satisfy dependency libssl.so.1.0.0 wanted by /nix/store/gllzaq8c1xz53k23cr3z0xfysm0c6vh0-azure-functions-cli-bin-4.0.6821/usr/lib/azure-functions-cli-bin/workers/powershell/7.2/runtimes/linux-x64/native/libmi.so
> error: auto-patchelf could not satisfy dependency libcrypto.so.1.0.0 wanted by /nix/store/gllzaq8c1xz53k23cr3z0xfysm0c6vh0-azure-functions-cli-bin-4.0.6821/usr/lib/azure-functions-cli-bin/workers/powershell/7.2/runtimes/linux-x64/native/libmi.so
If you do that before the autoPatchelfHook runs you can still rely on it for any other dependencies.
This likely will not work in practice, I don’t think 1.0 and 1.1 are ABI compatible. Here’s a reasonable-looking compatibility chart: API/ABI changes review for OpenSSL
I think this program is just broken, I doubt you will be able to find a libssl1.0 in any reputable distro that hasn’t been EOL since like 2019.
Having looked at their upstream repo for a second, they seem to support running on distros with even openssl 3.0 packaged. Make sure you’re not using some ancient version of it.
buildFhsUserEnv is a nicer way to accomplish this. Chances are any ssl operations will segfault, though, but hey, maybe this just doesn’t use ssl much.
Yeah, so, this’ll work, but you’ve now added a bash to your system path. This means that your system inherently leaks this to everything. If you e.g. write code that assumes a bash-compatible shell, you will only realize after deployment that you’re not POSIX-compatible.
It can also change the behavior of applications because the version of bash deployed now isn’t tied to your nix package.
I don’t think this is per-se wrong, but you’re actively removing one of the selling points of nix (which is fine. I’m not your mom). There is an alternative to that with practically no downsides, however, an fhs env:
environment.systemPackages = let
# You can also use `pkgs.buildFHSEnv` if cgroups cause issues
azure = pkgs.buildFHSEnvBubblewrap {
pname = "azure-functions-cli-bin";
version = "4.0.6821";
runScript = "func";
targetPkgs = [
# Bash is included in the env by default
(callPackage ./azure-functions-cli-bin.nix { })
];
};
in [
azure
];
Now you can run azure-functions-cli-bin to call your binary in an environment with bash available. Add extra packages as you need more fhs paths.
Under the hood this just writes a script that uses bubblewrap to launch a cgroup that partially decouples the filesystem so that in the cgroup the application sees bash under the hard-coded absolute path where it expects it to be. We refer to this as an “fhs env”, because it’s an fhs-compliant environment specific to this binary.
Having said all of that, you could also play around with the nix package. I’d attempt something like: