divnix / std

A DevOps framework for the SDLC with the power of Nix and Flakes. Good for keeping deadlines!
https://std.divnix.com
391 stars 43 forks source link

std depends on "nix2container" being called "n2c" #355

Open jg-cantaa opened 1 year ago

jg-cantaa commented 1 year ago

Due to this line:

https://github.com/divnix/std/blob/01adf87cf1ed37bcd72a90f2a4e385d76c81c825/src/std/fwlib/blockTypes/containers.nix#L30C24-L30C24

std requires downstream flakes to name "nix2container" as "n2c" in order to use the "load" action.

Pegasust commented 1 year ago

This is as intended https://github.com/divnix/std/blob/01adf87cf1ed37bcd72a90f2a4e385d76c81c825/flake.nix#L43

You need to pin the n2c as the consuming flake

The naming n2c is also consistent throughout the codebase https://github.com/divnix/std/blob/01adf87cf1ed37bcd72a90f2a4e385d76c81c825/src/local/flake.nix#L15

And is "enforced" that way as well https://github.com/divnix/std/blob/01adf87cf1ed37bcd72a90f2a4e385d76c81c825/src/lib/ops/mkStandardOCI.nix#L3

The same goes for any other horizontal integration, divnix/std would want to let you take control of the pinning since std is a framework/library, which is consistent in other swe practices, notably from Rust

I'm not sure if you meant by implicitly making the std take in nix2container by having your flake's input's nix2container named n2c, I'm quite rusty on that aspect of flake, but the intended way to use std+n2c is to have inputs.std.url = "..." AND inputs.std.inputs.n2c.follows = "nix2container" with inputs.nix2container.url = "github:nlewo/nix2container" or (untested) inputs.std.inputs.n2c.url = "github:nlewo/nix2container"

Pegasust commented 1 year ago

Ah, I think I understand what you mean now, please disregard my initial comment

blaggacao commented 1 year ago

Yes, I think this is an unclean design and could / should be rather enforced from the std inputs as it is with mkOCI.

Originally, the inputs action argument was added to indeed capture inputs by name from downstream flakes.

I need to double check, but in this case I agree it could probably be curried in from std's input overloading. The key is that the binary will be from the currentSystem so regardless of the target system. But that seems possible either way.