Hello!
As I have said so many times before, I am proposing to assimilate home-manager into nixpkgs monorepo.
Below is a draft of RFC I want to propose. Feel free to roast it!
RFC Draft I
- feature: All Your Home Manager Are Belong to Us
- start-date: (fill me in with today’s date, YYYY-MM-DD)-
- author: Anderson Torres
- co-authors: (find a buddy later to help out with the RFC)
- shepherd-team: (names, to be nominated and accepted by RFC steering committee)
- shepherd-leader: (name to be appointed by RFC steering committee)
- related-issues: (will contain links to implementation PRs)
Summary
Assimilate home-manager project into Nixpkgs monorepo.
Terminology
Henceforth,
- Home Manager will be called HM;
- The typical unprivileged user of a system will be called basic user;
- The typical privileged user of a system will be called superuser;
Motivation
Nix the language has at least three famous consumers, namely:
-
Nixpkgs, the biggest packageset in
existence; -
NixOS, the reference work on declarative configuration
and deployment of a Linux distribution; and -
Home Manager, another
reference work on declarative user-specific configuration management and
deployment.
Since at least 2014, NixOS was assimilated into Nixpkgs monorepo, now living
inside nixos
directory.
This RFC proposes a similar assimilation of HM into Nixpkgs.
Benefits
In principle, Nix already leverages Nixpkgs for basic users. However, the raw
usage of Nixpkgs is not too ergonomic, especially when compared to the more
structured model of NixOS.
HM provides a similar centralized, modular, declarative package management
experience to basic users, without the need of granting them superuser
privileges.
Given that NixOS - a system that leverages Nixpkgs for superusers - is already
bundled inside Nixpkgs tree, a fortiori HM - a system that leverages Nixpkgs for
basic users - should be included as the default, Nixpkgs-blessed system for
basic users.
Further, this assimilation will benefit two interesting publics:
-
Users of Nixpkgs and/or NixOS that are reluctant in using HM, since it is
neither official nor well-integrated into Nixpkgs workflow. -
Users of NixOS that already use HM in tandem, as a convenient way of
separating basic users’ business from system administration tasks.
Another great advantage of assimilating HM to Nixpkgs is a tighter integration
between both projects:
-
Merging HM commit history tree into Nixpkgs eliminates a barrier between
both projects, therefore conveying more flexibility in code sharing,
deduplication and refactoring in general. -
Refactors, reformulations, deprecations and removals of packages and other
related functionalities are commonplace around Nixpkgs. Since HM is
dependent on Nixpkgs, it needs to monitor and synchronize such activities.The eventual assimilation proposed here drops those issues dramatically.
-
The merge of communities brings a new point of view about package maintenace
in general.NixOS is the main point of structured conglomeration of packages; because of
this, Nixpkgs is more inclined to favor a superuser view of system
administration.Bringing HM to Nixpkgs provides a new point of view, more akin to the basic
user. -
Making HM an official, blessed tool conveys more credibility to both
Nixpkgs and HM.
Detailed design
- Prepare Home-Manager to migration
- Treewide formatting and refactoring according to most recent written and
unweritten rules of Nixpkgs code style
- Treewide formatting and refactoring according to most recent written and
- Merge Home-Manager repository, putting all its relevant files inside
home-manager
directory; - ? ? ?
- Profit!
In terms of Git hardwork, the assimilation of HM is expected to be not too
difficult; a judicious appplication of
git-filter-repo plus some
reposurgeon can solve this without
much hassle.
Problems are expected when dealing with the interface between Nixpkgs and HM,
albeit they can be reduced if we treat HM as an inner overlay.
Examples and Interactions
Ideally, after the assimilation, a basic user will experience few to no changes
in their workflow. The channels of distribution of packages will be merged,
promoting a cleanup on setups that otherwise would need synchronization.
On the other hand, from this assimilation forward the typical package maintainer
will interact with potentially two sets of too similar module systems.
Drawbacks
The main drawback of this assimilation is the resulting complexity.
Standardization
There are some discrepancies between the practices of both communities.
Synchronize the communities
There are almost 660 contributors in HM to this date. How they should be
allocated?
Ideally they should keep the same roles.
CI
Currently HM uses a different setup for continuous integration. Ideally the
Nixpkgs setup should be updated to include HM’s specific needs.
Alternatives
The alternatives are
-
The trivial “do nothing”
It just exacerbates the status quo, bringing nothing in the long term.
-
Bless another home management tool
HM is battle-tested and well renowned. There is no other tool remotely
comparable to it.
Prior art
As an example of prior art, there is our Scheme-based cousin, Guix Software
Distribution. Since at least 2022 AD they bring a similar tool, conveniently
called Guix Home.
The nicest thing about this tool is that it is tightly integrated with Guix, to
the point of home
being a mere subcommand of guix
.
Unresolved questions
How the future package inclusions should be carried out?
Future work
- Update an extend the CI
- Set expectations on portability among present and future platforms Nixpkgs
supports- Especially outside NixOS
- Factor HM and NixOS’s shared code into some service abstraction structure
References
-
Keeping One’s Home
Tidy, by Ludovic
Courtès - Guix Home
Configuration