krebs / krops

Mirror of https://cgit.krebsco.de/krops/about/ (PRs / issues accepted, as can be seen by not having them disabled)
Do What The F*ck You Want To Public License
132 stars 18 forks source link

`passage` support #39

Closed sylvorg closed 5 months ago

sylvorg commented 7 months ago

Hello!

Is there any way to use passage with this, the age fork of pass?

Thank you kindly for the clarification!

4z3 commented 7 months ago

If passage is a drop-in replacement for pass, then something like this could work

pkgs = import "${krops}/pkgs" {
  overlays = [
    (self: super: { pass = self.passage; })
  ];
};

Otherwise we would have to add another type, e.g. with the name passage, alongside the implementation for pass. Also, the new type has to be documented in the readme.

sylvorg commented 7 months ago

Damnit; forgot to add the links. 😅 Sorry about that! I've updated the original issue.

It doesn't entirely seem to be a drop-in replacement, as passage replaces pass as the command, likely for compatibility reasons.

4z3 commented 7 months ago

Another way not involving to add another type would be to add a wrapper, e.g. something like

pkgs = import "${krops}/pkgs" {
  overlays = [
    (self: super: {
      pass = self.writers.writeDashBin "pass" ''
        # TODO add code to behave like pass but use passage
      '';
    })
  ];
};
sylvorg commented 7 months ago

Huh... Would a simple ${super.passage}/bin/passage $@ work?

Also, quick question, what exactly does writeDashBin do?

4z3 commented 7 months ago

Huh... Would a simple ${super.passage}/bin/passage $@ work?

This might work. Why not test it? :) I don't have age set up right now. Also I'd recommend to add " around $@, i.e. "$@", so arguments get passed without word splitting.

Also, quick question, what exactly does writeDashBin do?

It creates a dash shell script. The base name of the script willl be taken from the first argument, i.e "pass", so it can be called like the original pass executable, i.e. "${pkgs.pass}/bin/pass". For people preferring bash, there's also writeBashBin.

sylvorg commented 7 months ago

Right; got it. Will do, and thanks for the advice and information! Should I go ahead and close this issue, then?

4z3 commented 7 months ago

Very welcome :)

Should I go ahead and close this issue, then?

Yes. Or alternatively we can also keep it open until you confirm that overriding works, or we can even keep it open until we add proper support for passage. I would definitely like to have native support for age if I would use it.. :)

sylvorg commented 7 months ago

I may not have time to test it in the near future, unfortunately; my configuration isn't finalized enough for it. However, it might better to keep it open anyway, in case someone else want to take a crack at it?

4z3 commented 5 months ago

Support for passage has been added in https://github.com/krebs/krops/commit/a6c7ecd8ba90c1eb2515cb235d85649295848e68.