-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Mainly writing this to actually figure out what I want to do, and how fine-grainly I want to split up the package.
First, reasoning - unify is the longest script by far, and it's become harder to maintain as a result of this. I'd like it to become a bit more modular.
Before this, we must first understand what Unify does, to figure out how to split up its concerns.
At its core, Unify runs nix flake update
and rbld
. That's it. Everything else is a wrapper around that functionality.
So, what wraps that? Well:
What does Unify do?
- First, Unify switches branches for you to a main/master branch, based on the value of
-b
orUNIFY_PRIMARY_BRANCHES
. It will swap back after execution, no matter how Unify exits. - Then, Unify runs
nix flake update
, and checks whether you care about any of the inputs that updated. If you did care about any of them, Unify continues running. If they didn't, Unify reverts the flake.lock changes, and exits early. - If you got this far, unify runs a rebuild, exiting early if the rebuild fails.
- Unify commits the changes and pushes them.
I like almost all of these. EXCEPT for the second one. fuiska
didn't exist when I first came up with unify
. I truly think fuiska
is a better way of solving the problem that unify
solves with the automated solution. BUT, I don't want to rip out the automated functionality just because I found a new toy. Ideally, it should be optional. But, perhaps more importantly, Unify should be maintainable.
Here's a basic proposal on splitting Unify in two. Or three, I guess.
The wrapper and the implementation
The implementation is step 2. I want this to be swappable. You could choose an implementation that always updates when you run Unify - that's what I personally want. Or, you could choose the existing implementation, where it checks your important inputs. This makes it a simple if/else, for which command gets run. Unify becomes a little lighter. It's not MUCH - this will still leave Unify as a pretty long file. But, I want to START with this.
Okay, time to go implement it!