Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to augment onPush with the default value. #442

Open
ursi opened this issue Aug 11, 2022 · 3 comments
Open

Add the ability to augment onPush with the default value. #442

ursi opened this issue Aug 11, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@ursi
Copy link

ursi commented Aug 11, 2022

I have a flake with legacyPackages that I wanted test. I figured I could add a separate onPush.legacyPackages for them so I could define how to build them, but the way the code currently works, if you provide your own onPush, it gets rid of the defaults. I would like there to be a way where I could choose to keep the default value, and augment it with my own.

@ursi ursi added the enhancement New feature or request label Aug 11, 2022
@roberth
Copy link
Member

roberth commented Aug 16, 2022

I could add a function in the herculesCI arguments so you can access the translation from flake outputs to nested attrsets and manipulate it in any way.
Here's an example of how this new feature idea may be used:

  herculesCI = { flakeOutputs, ... }: {
    onPush.default = {
      outputs = { ... }:
        flakeOutputs self // {
          # Attributes here will be built for each push.
          legacyPackages = ...;
        };
    };
  };

I'd also like to offer an easier interface as part of a flake.parts module.

@Kranzes
Copy link

Kranzes commented Aug 25, 2022

How would flake parts improve this situation?

@roberth
Copy link
Member

roberth commented Nov 15, 2022

Recent versions of hercules-ci-effects include a flakeModule that replaces the default herculesCI attribute in the flake by one that's managed through the module system. Like the agent's built-in functionality, it provides a herculesCI.onPush.default job, and thanks to a custom type, herculesCI.onPush.default.outputs supports merging.
This should solve the problem at least in projects that use flake-parts.

Example:

herculesCI = { config, ... }: {
  onPush.default.outputs.myCustomAttribute = pkgs.writeText "branch-name" ${config.repo.branch}
};

See config.repo and other options on the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants