Skip to content

Add buildWorkspace #180

@sellout

Description

@sellout

I’m not sure if this is a good idea, but if not I’d like to hear what the best alternative is (explicit separate buildPackage for each lib in the workspace?)

In any case, I want roughly

  outputs = { self, crane, flake-utils, nixpkgs, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        craneLib = crane.lib.${system};
        pkgs = import nixpkgs {inherit system;};
      in
    {
      packages =
        {default = self.packages.${system}.oneOfTheOnesInTheWorkspace;}
        // craneLib.buildWorkspace {
          src = craneLib.cleanCargoSource ./.;
          doCheck = true;
          buildInputs = [pkgs.libiconv];
          nativeBuildInputs = [];
        };
    });

where buildWorkspace produces an attrset of packages, one per package in the workspace. And the attrs passed to buildWorkspace are propagated to the individual packages. Although maybe it makes sense to put propagated attrs in a single attr, so other buildWorkspace attrs (like, maybe an exclude list or something) can be provided without conflicting or being propagated.

I’m still on the steep part of the learning curve for both Nix and Rust, so I’m as interested in arguments against this as I am in seeing it done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions