Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

users: Initial home-manager only configurations(non-nixos systems) #93

Merged
merged 3 commits into from
Jan 27, 2021

Conversation

Pacman99
Copy link
Member

@Pacman99 Pacman99 commented Jan 14, 2021

Closes #83

Working implementation of exporting home-manager only configurations. This exports to a non-official output of homeConfigurations, along with hmActivationPackages in the packages output. Both are an attrset of hosts then users

So if you were trying to build activationPackage for the host NixOS and user nixos, you can do:
nix build ./#homeConfigurations.NixOS.nixos.home.activationPackage
or
`nix-build ./#hmActivation.NixOS.nixos'
This ones easier for debugging, because nix build will default to the packages output if homeConfiguration has any error and it won't say when it does so.

The flk script can then use the activation package to activate the home-manager configuration(not implemented yet).

There are a few more things to add like local nix registry and config with xdg.configFile along with nix paths and other compatibility things.

TODO:

  • Create homeConfiguration for each user in each system
  • Export activation packages for each homeConfiguration
  • Add support in flk wrapper script to easily build and switch home-manager configurations
  • Document feature in readme
    - [ ] Add some default modules/imports to all the homeConfigurations, preferably only in homeConfigurations and not for system configs. Not sure if this is even possible yet. This can include: nix paths, local nix.conf, and others in the future.I think this can be done in the future, possibly along with adding custom modules feature to home-manager.

@nrdxp nrdxp changed the title users: Initial home-manager only configurations(non-nixos systemst) users: Initial home-manager only configurations(non-nixos systems) Jan 14, 2021
@nrdxp
Copy link
Collaborator

nrdxp commented Jan 14, 2021

I haven't had a lot of free time this month, but I'll be glad to test this out as soon as I've got a minute.

Shouldn't be too difficult to work out the kinks.

@Pacman99
Copy link
Member Author

Yeah of course take your time, thanks for responding. I'll try to keep working through the bugs and implementing a few other things. I think overlays aren't currently added to the pkgs passed into home-manager and the flake registry and nix path can be set through home manager.

I also have one question, I put the code in default.nix in the users folder, but it directly uses nixosConfigurations, so it doesn't actually use any of the user files. Does it make sense to have it there? I was thinking it could go in utils.

@Pacman99 Pacman99 force-pushed the home-manager-only branch 2 times, most recently from 397742e to 79f41cd Compare January 16, 2021 04:25
@Pacman99
Copy link
Member Author

So this turned out to be a lot simpler than I thought, apparently you can just use config.home-manager.users.[username].home.activationPackage to build the hm configuration.

I also appended the homeConfiguration activationPackages to the packages output as hmActivationPackages so you can just build and debug with ./#hmActivationPackages.[host].[user]

I think this is a pretty much complete and fairly simple implementation of this. There are a couple things left to do and I'll add that to the main post.

@Pacman99 Pacman99 marked this pull request as ready for review January 16, 2021 18:30
@nrdxp
Copy link
Collaborator

nrdxp commented Jan 27, 2021

Just pushed a rebase PR to your branch to fix the merge issues.

@nrdxp nrdxp self-requested a review January 27, 2021 17:35
@Pacman99
Copy link
Member Author

Alright thanks for doing the rebase! I think I merged it right, I just force pushed you're exact branch to mine

@nrdxp
Copy link
Collaborator

nrdxp commented Jan 27, 2021

Only minor issue left when running nix flake check:

flake attribute 'packages.x86_64-linux.hmActivationPackages' is not a derivation
(use '--show-trace' to show detailed location information)

I think we can resolve this later though as it doesn't actually affect functionality.

@Pacman99
Copy link
Member Author

Ohh interesting. How does it work in nixpkgs, since that has subsets of packages like pythonPackages? Or is pythonPackages a derivation itself somehow?

@nrdxp
Copy link
Collaborator

nrdxp commented Jan 27, 2021

Right now, nixpkgs doesn't even use the packages output attribute it it's flake, instead cramming everything into legacyPackages for now. Pressumably because of issues like this that still need to be resolved upstream.

@nrdxp nrdxp merged commit 5e2f4d0 into divnix:template Jan 27, 2021
@Pacman99
Copy link
Member Author

Ohh that makes sense

@Pacman99 Pacman99 deleted the home-manager-only branch January 27, 2021 18:41
@nrdxp nrdxp mentioned this pull request Feb 24, 2021
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.

Home manager on Non-nixos systems
2 participants