Open beforan opened 5 months ago
Any workaround?
@beforan Thanks for bringing this to our attention. Looking at the packaging difference between 23.11 and 24.05, it's clear why this happens.
In 23.11, we fetch the zip (which includes the templates, as you have already found out) and patch the executables to work for NixOS. In 24.05, we have opted for a different approach which is to compile the executables using the builder modules in nixpkgs, so there is no need for patching.
It seems that in switching packaging approaches, we have missed that some files (such as the templates directory) should also be present in the derivation.
@momeemt, since you have already created a PR for the updated version of the azure-functions-core-tools
, would you be open to fixing this in your PR by adding the templates folder in the postInstall
phase?
Quick heads up: I'm pretty brand new to Nix, so apologies if I've missed something or if I go about this issue the wrong way. Let me know.
Describe the bug
Installing the current release (
24.05
) orunstable
(at time of writing) package ofazure-functions-core-tools
(package version4.0.5455
) leaves some functionality unusable due to thetemplates/
directory of the release missing from the nix cache.I've tried to
init
a new .NET function and the tools cannot complete due to the missing templates:Sure enough, if I
cd
to that location, the wholetemplates/
directory is not present.Here is the GitHub release the
24.05
package should presumably be pulling (based on the package version): https://github.com/Azure/azure-functions-core-tools/releases/tag/4.0.5455Downloading an asset from the above and unzipping it does contain the
templates/
directory as expected.Switching to
23.11
and usingazure-functions-core-tools
version4.0.5348
works correctly.I've observed this using Flakes and
nix develop
/ direnv on both Fedora 40 with Nix and macOS usingnix-darwin
.Steps To Reproduce
Steps to reproduce the behavior:
unstable
or24.05
Define combined dotnet packages per these docs:
nix develop
func init FunctionApp --worker-runtime dotnet-isolated --target-framework net8.0
Example Flake to reproduce
```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; outputs = { self, nixpkgs, ... } @ inputs: let forEachSystem = nixpkgs.lib.genAttrs ["aarch64-darwin" "x86_64-linux"]; in { devShells = forEachSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; in { default = pkgs.mkShell { name = "my-project-shell"; packages = with pkgs; [ (with dotnetCorePackages; combinePackages [ sdk_8_0 runtime_6_0 aspnetcore_6_0 ]) azure-cli azure-functions-core-tools ]; }; }); }; } ```Expected behavior
func init FunctionApp --worker-runtime dotnet-isolated --target-framework net8.0
should successfully complete and create a new Function App.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
I don't know if this affects anything other than dotnet - not familiar enough with the inner working of the azure functions tools to know what else uses that templates directory.
I have confirmed it works with the
23.11
version forazure-functions-core-tools
: Here's a Flake that works for me:Example Flake with workaround
```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; func-nixpkgs.url = "github:NixOS/nixpkgs?ref=release-23.11"; }; outputs = { self, nixpkgs, func-nixpkgs, ... } @ inputs: let forEachSystem = nixpkgs.lib.genAttrs ["aarch64-darwin" "x86_64-linux"]; in { devShells = forEachSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; func-pkgs = func-nixpkgs.legacyPackages.${system}; in { default = pkgs.mkShell { name = "my-project-shell"; packages = with pkgs; [ (with dotnetCorePackages; combinePackages [ sdk_8_0 runtime_6_0 aspnetcore_6_0 ]) azure-cli func-pkgs.azure-functions-core-tools ]; }; }); }; } ```Since the
23.11
version works, I have noticed that the package scripts differ quite a lot between23.11
and24.05
.I'm not deep enough into Nix yet to know if the difference matters, but clearly they are approaching the packaging a little differently.
Notify maintainers
@mdarocha @Detegr are package maintainers @momeemt has opened #310237 to upgrade the tools but it still uses the
24.05
package approach; would be interested to know if that has the same issue.Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.