Skip to content

Conversation

@viperML
Copy link
Owner

@viperML viperML commented May 25, 2025

This is a major refactor for wrapper-managaer, basically rewriting it from sratch by learning from past mistakes.

There is a new function called wrapWith, to create a single wrapper:

wrapper-manager.lib.wrapWith pkgs {
  basePackage = pkgs.hello;
  prependFlags = ["-g" "Hi"];
}
# => «derivation /nix/store/...»

If you are not using flakes, the calling API has changed, please apply these changes:

Old way of evaluating wrapper-manager without flakes:

let
  url = "https://github.com/viperML/wrapper-manager/archive/refs/heads/master.tar.gz";

  wrapper-manager = import (builtins.fetchTarball url) {
    inherit (pkgs) lib;
  };
  
  eval = wrapper-manager.lib {
    inherit pkgs;
    modules = [ ... ];
  };
in
  ...

New way of evaluating wrapper-manager without flakes:

let
  url = "https://github.com/viperML/wrapper-manager/archive/refs/heads/master.tar.gz";

  wrapper-manager = import (builtins.fetchTarball url); # don't eval this
  
  eval = wrapper-manager.lib {
    inherit pkgs;
    modules = [ ... ];
  };
in
  ...

@viperML viperML force-pushed the next branch 2 times, most recently from 4950b55 to 0e099e2 Compare May 26, 2025 07:05
@viperML
Copy link
Owner Author

viperML commented May 26, 2025

Marking as draft as this is incomplete for now.

@viperML viperML marked this pull request as draft May 26, 2025 07:29
Copy link
Contributor

@nrabulinski nrabulinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's still WIP so just leaving comments about things that immediately caught my eye

@viperML viperML changed the title V2 Api Refactor and v2 API Jun 19, 2025
@viperML viperML marked this pull request as ready for review June 19, 2025 11:12
@viperML
Copy link
Owner Author

viperML commented Jun 19, 2025

@nrabulinski this should be ready to review.

There's a problem in that mkRemovedOptionModule is implemented in terms of assertions, which is not part of evalModules but rather integrated into NixOS.

Me we can just do a one-off thing for deprecating .flags.

(For the record, my dotfiles are already using this branch)

viperML added a commit to viperML/dotfiles that referenced this pull request Jun 19, 2025
@nrabulinski
Copy link
Contributor

nrabulinski commented Jun 19, 2025

There's a problem in that mkRemovedOptionModule is implemented in terms of assertions, which is not part of evalModules but rather integrated into NixOS.

I work around this in wrapper-manager-hm-compat, by evaling assertions when creating the wrappers, you can see it here. Would be nice to have that upstream actually.

@viperML
Copy link
Owner Author

viperML commented Jun 19, 2025

There's a problem in that mkRemovedOptionModule is implemented in terms of assertions, which is not part of evalModules but rather integrated into NixOS.

I work around this in wrapper-manager-hm-compat, by evaling assertions when creating the wrappers, you can see it here. Would be nice to have that upstream actually.

Looking at the modules, what I don't know is how to load assertions.nix for each option that has a submodule, and collect all assertions for all submodules.

@viperML
Copy link
Owner Author

viperML commented Jun 20, 2025

In the end I did a one-off thing to deprecate .flags. We can look at implementing .assertions in a later PR.

@viperML viperML merged commit afa8b33 into master Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants