Skip to content

Conversation

@irgolic
Copy link
Contributor

@irgolic irgolic commented Dec 17, 2025

Hey, thanks for creating such a useful abstraction over VMs!

Would you be open to reducing the size of your dependency tree? flake-utils is only used for the eachSystem function. Inlining or replacing it cuts the project's lockfile in half (as flake-utils itself depends on another flake).

All of these commits remove the external dependency in different ways; let me know if you would like me to amend or remove any of them:

  • The first commit (57e1244) inline-vendors forAllSystems, including an MIT header.
  • The second commit (d5f82d0) replaces it with a simpler function that retains parity.
  • The third commit (37af54c) removes the behavior of automatically including currentSystem if the flake is run with --impure. I'm guessing that most developers depending on flake-utils are unaware of this behavior – in my opinion explicitly relying on nix-systems for this behavior is a better way to achieve this goal.

While this PR aims to remove the external dependency on flake-utils in the simplest way possible, in the long term, I suggest rewriting the flake with a forAllSystems function for better readability (you won't need to merge two big attrsets, instead keeping it all top-level).

@SuperSandro2000
Copy link
Member

First of all the git history of this is not very at all nice. This should be one commit, as otherwise using git blame becomes needlessly way harder to use and we have lots of back and forth.

Then why not use lib.foldAttrs? That would make the code probably way shorter and easier to read.

You linked https://ayats.org/blog/no-flake-utils#do-we-really-need-flake-utils that is pretty short and if we touch that part of the code, we should go with that and do it completely.

Inlining or replacing it cuts the project's lockfile in half (as flake-utils itself depends on another flake).

True, but that wouldn't matter to much in any flakes I know where microvm is used, as there are usually at least a few other flake-utils. But for people not using 20 other flakes, there is a small benefit.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

see above comment

@irgolic
Copy link
Contributor Author

irgolic commented Dec 17, 2025

Thanks! Indeed, microvm-nix is currently the only flake I depend on that uses flake-utils.

I've changed this PR to consist of only one commit, implementing the pattern at https://ayats.org/blog/no-flake-utils#do-we-really-need-flake-utils. It turned out pretty clean, and removed a level of indentation from most of the file.

Let me know if there's anything else you'd like me to amend.

@SuperSandro2000 SuperSandro2000 merged commit bb9e99b into microvm-nix:main Dec 17, 2025
4 of 5 checks passed
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.

2 participants