Skip to content

Add the ability for withPackages and withExtensions to be written in devbox.json #2408

Open
@kpervin

Description

@kpervin

What problem are you trying to solve?

There are certain nixpkgs that require configuration using withExtensions and withPackages. Currently, the only way to utilize those packages in that way using DevBox is to create a flake, which feels antithetical to DevBox's proposition of abstracting Nix.

Example, for using the azure-cli with azure-cli-extensions:

{
  description = "A flake to install azure-cli";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils, }:
    flake-utils.lib.eachDefaultSystem (system:
      let pkgs = nixpkgs.legacyPackages.${system};
      in {
        formatter = pkgs.nixfmt;
        packages = {
          default = pkgs.azure-cli.withExtensions
            [ pkgs.azure-cli-extensions.terraform ];
        };
      });
}
{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.6/.schema/devbox.schema.json",
  "packages": {
    "path:./.flakes/azure-cli": "",
  }
}

What solution would you like?

Allow for withExtensions and withPackages, possibly also override, to be definable in devbox.json:

{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.6/.schema/devbox.schema.json",
  "packages": {
    "azure-cli": {
      "version": "latest",
      "withExtensions": {
        "azure-cli-extensions.terraform": "latest"
      }
    }
  }
}

Additionally, also including cli functionality to be able to add these to devbox.json, ex: devbox add azure-cli --with-extensions azure-cli-extensions.terraform .

Alternatives you've considered

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requesttriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions