Add support for the same username across multiple targets#144
Open
jameslounds wants to merge 5 commits intosnowfallorg:mainfrom
Open
Add support for the same username across multiple targets#144jameslounds wants to merge 5 commits intosnowfallorg:mainfrom
jameslounds wants to merge 5 commits intosnowfallorg:mainfrom
Conversation
…not just `flake-utils.defaultSystems`
…ystems, not just `flake-utils.defaultSystems`" Stick with just the defaultSystems for now - that was more changes than I tnought
KyleKrein
added a commit
to KyleKrein/snowfall-lib
that referenced
this pull request
Aug 9, 2025
AdoptedThis fix has been implemented to enable the same username across multiple targets. Changes1. Unique home naming - Prevents collisions:
2. Per-system packages output - Convenient access:
3. Updated host matching - Uses full Benefits✅ Fixes home configuration collision Verification✅ Commit: anntnzrb/snowfall-lib@012761f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.nixwill make the corresponding homeConfiguration available asoutputs.homeConfigurations."<username>@<target>". In reality, it is available atoutputs.homeConfigurations.<username>. It seems thatx86_64-linuxhas precedence overaarch64-darwin(edit: I think because of the order of variables inflake-utils'sdefaultSystems), so when I have bothhomes/aarch64-darwin/james/default.nixandhomes/x86_64-linux/james/default.nix, only thex86_64-linuxconfiguration actually makes it to theoutputs(and importantly,darwinConfigurations.myMachine.home-manager.users).This PR does 3 things:
Makes
homeConfigurationswork like the migration guide says it should (for the systems inoutputs.pkgs- only systems ending in-linuxor-darwincan make usablehomeConfigurations, but other systems will still add tohomeConfigurations. By usingattrNames pkgs, we only makepackages.<system>.homeConfigurationsforsystemswhich can make usablehomeConfigurations.Uses
<username>@<target>for homes defined at./homes/<target>/<username>/default.nixwhen checking which homes to apply todarwinConfigurationsandnixosConfigurations.Adds
packages.<target>.homeConfigurationsas an output ofmkFlakeso thathome-manager switch --flake .(or".#<username>") works. In order to do this, we reconstructhomeConfigurationsfor 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.nixcan be seen byhome-manageratpackages.<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.