NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.41k stars 13.63k forks source link

`azure-functions-core-tools` templates are missing from `24.05` package #317497

Open beforan opened 3 months ago

beforan commented 3 months ago

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) or unstable (at time of writing) package of azure-functions-core-tools (package version 4.0.5455) leaves some functionality unusable due to the templates/ 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:

[user@system:~]$ func init FunctionApp --worker-runtime dotnet-isolated --target-framework net8.0

Can't find templates location. Looked under '/nix/store/0ydxfg1b4r6f2ylbbd80x1s2i91w7v5k-azure-functions-core-tools-4.0.5455/lib/azure-functions-core-tools/templates/net-isolated'

Sure enough, if I cd to that location, the whole templates/ 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.5455

Downloading an asset from the above and unzipping it does contain the templates/ directory as expected.

Switching to 23.11 and using azure-functions-core-tools version 4.0.5348 works correctly.

I've observed this using Flakes and nix develop / direnv on both Fedora 40 with Nix and macOS using nix-darwin.

Steps To Reproduce

Steps to reproduce the behavior:

  1. create a Flake targeting nixpkgs unstable or 24.05
  2. define a devShell with the following packages:
    • azure-cli
    • azure-functions-core-tools
  3. Define combined dotnet packages per these docs:

    (with dotnetCorePackages;
          combinePackages [
            sdk_8_0 # SDK for the app itself
    
            # .NET 6 for func tools
            runtime_6_0
            aspnetcore_6_0
          ])
  4. nix develop
  5. try to init a new dotnet Function App:
    • func init FunctionApp --worker-runtime dotnet-isolated --target-framework net8.0
  6. Get the error described above.
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 for azure-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 between 23.11 and 24.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.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/y11cs26gb9b1irv5hk776mra7hgy80bl-nix-info
copying path '/nix/store/y11cs26gb9b1irv5hk776mra7hgy80bl-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.8.10-301.fsync.fc40.x86_64, Fedora Linux, 40.20240531.0 (Kinoite), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/store/fjs1x9gz2n1dvjqcyyl6qsw110qxc2zn-source`

Add a :+1: reaction to issues you find important.

doggy8088 commented 2 weeks ago

Any workaround?