Add support for the same username across multiple targets #144
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hopefully fixes #124
In the v3 migration docs, it says that a file containing home manager configuration at
homes/<target>/ <username>/default.nix
will make the corresponding homeConfiguration available asoutputs.homeConfigurations."<username>@<target>"
. In reality, it is available atoutputs.homeConfigurations.<username>
. It seems thatx86_64-linux
has precedence overaarch64-darwin
(edit: I think because of the order of variables inflake-utils
'sdefaultSystems
), so when I have bothhomes/aarch64-darwin/james/default.nix
andhomes/x86_64-linux/james/default.nix
, only thex86_64-linux
configuration actually makes it to theoutputs
(and importantly,darwinConfigurations.myMachine.home-manager.users
).This PR does 3 things:
Makes
homeConfigurations
work like the migration guide says it should (for the systems inoutputs.pkgs
- only systems ending in-linux
or-darwin
can make usablehomeConfigurations
, but other systems will still add tohomeConfigurations
. By usingattrNames pkgs
, we only makepackages.<system>.homeConfigurations
forsystems
which can make usablehomeConfigurations
.Uses
<username>@<target>
for homes defined at./homes/<target>/<username>/default.nix
when checking which homes to apply todarwinConfigurations
andnixosConfigurations
.Adds
packages.<target>.homeConfigurations
as an output ofmkFlake
so thathome-manager switch --flake .
(or".#<username>"
) works. In order to do this, we reconstructhomeConfigurations
for eachdefaultSystem
, including only the homes for that system. We then rename any homes whose name ends with@<system>
, and remove that@<system>
suffix. This ensures that a home declared byhomes/<system>/<username>/default.nix
can be seen byhome-manager
atpackages.<system>.homeConfigurations.<username>
I'm not the happiest about the changes I've made to
snowfall-lib/flake/default.nix
- I'm sure there's a much nicer way of doing this, but my nix skills aren't there yet.