Skip to content

self parameter for eachSystem/eachDefaultSystem #78

Open
@WizardUli

Description

@WizardUli

When you want to reference a package from another package, or a devShell, etc... inside eachSystem/eachDefaultSystem closure then you have to either use the pesky rec keyword which even does not work for all cases or you have to use self parameter from the flake itself like self.${system}.packages.abc which is unnecessarily repeating the system.

I propose adding a variant of eachSystem/eachDefaultSystem which could be used like this:

{
  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem2 (sself: system: {
      packages.abc = ...;

      devShells.default = pkgs.mkShell {
        packages = [
          sself.packages.abc # Instead of self.${system}.packages.abc;
        ];
      };
    });
}

Perhaps it could be made backward compatible similar to overrideAttrs (NixOS/nixpkgs#119942) so new variant of eachSystem may not be necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions