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

home-manager: allow the tool to be installed in submodule setups #4342

Closed
wants to merge 1 commit into from

Conversation

musjj
Copy link
Contributor

@musjj musjj commented Aug 14, 2023

Description

Is there a reason why the standalone tool is not allowed to be installed when you are using home-manager as a submodule? I guess it's not necessary since you can just use nixos-rebuild instead. But if the user chooses to enable it anyways, IMO it should be properly installed.

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all or nix develop --ignore-environment .#all using Flakes.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

Maintainer CC

@rycee

@rycee
Copy link
Member

rycee commented Aug 15, 2023

Yeah, it's been a long-standing wish of mine to install home-manager also when used as a NixOS module. The tool would need to be reduced quite a bit when used like that, though. For example, we cannot support sub-commands like option, build, instantiate, switch, etc.

They more or less work right now mostly as an implementation detail; basically that HM maintains its own profile even when used inside a NixOS profile. We'll probably eventually move to place the HM generation inside the NixOS profile and then the standalone and NixOS module versions no longer will be interoperable.

Pretty much the only sub-command that we could support would be things like packages and news.

@musjj
Copy link
Contributor Author

musjj commented Aug 15, 2023

I see, so you're not supposed to run home-manager switch, etc. in a submodule setup? I'm currently using it because it's slightly faster since the system configuration isn't processed.

I guess I'll close it for now, since it's not really ready yet.

@musjj musjj closed this Aug 15, 2023
@ncfavier
Copy link
Member

I don't see why it couldn't be supported. nix build "$flakeAttr.config.home-manager.users.$user.home.activationPackage

@rycee
Copy link
Member

rycee commented Aug 15, 2023

@ncfavier Yeah, building and running the activation script would work but it would not have any persistent effect (similar to nixos-rebuild test). The user's "actual" current generation would show up inside the NixOS / nix-darwin profile directory. I.e., something like /run/current-system/home-manager/$user/….

So yeah, I guess we in principle could support home-manager test even in the NixOS module case 🙂

Ultimately I would like to have the current HM generation be activated through a systemd user service on login. Then it would be very natural to support home-manager login and home-manager test to repectively activate the generation on next login and immediately (but revert on next login).

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.

None yet

3 participants