hercules-ci / flake-parts

❄️ Simplify Nix Flakes with the module system
https://flake.parts
MIT License
698 stars 38 forks source link

Q: How to correctly implement a home-manager? #212

Open Kreyren opened 5 months ago

Kreyren commented 5 months ago

I am struggling implementing flake-parts to work as a part of nixosSystem declaration can you help? So that on system rebuild it also deploys the home-manager configuration for the user, so far i figured out this:

image

https://github.com/Kreyren/nixos-config/pull/1/files#diff-5edef9e1a197551f68e55e21f7a097cd12ec03b7f6c4ab904b01ec1de4b72330R30-R55

Which kinda defeats the purpose of flake-parts as i want to get rid of hard-coded paths so that i can just ideally do self.homeConfigurations."kreyren@sinnenfreude" in modules and expect it to deploy the configuration while still being able to do e.g. nixos-rebuild --flake 'github:kreyren/nixos-config#homeConfigurations.\"kreyren@sinnenfreude\"" and have the home-manager deployed independently from the nixosSystem

terlar commented 5 months ago

I don't think this has anything to do with flake-parts. It is because the self.homeConfigurations."kreyren@sinnenfreude" is using homeManagerConfiguration function which doesn't return a module anymore. One solution is to extract all that config into a module and just use that module in the NixOS and homeManagerConfiguration function.