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

[Feature Request] Home Manager support #11

Open
Pablo1107 opened this issue Mar 8, 2024 · 4 comments
Open

[Feature Request] Home Manager support #11

Pablo1107 opened this issue Mar 8, 2024 · 4 comments

Comments

@Pablo1107
Copy link

Pablo1107 commented Mar 8, 2024

It would be nice if this could also export a HM module to pull the config and switch to it.

@nlewo
Copy link
Owner

nlewo commented Mar 10, 2024

Yes, i think it could be a good idea.
We however have to ensure this would not add too much complexity to comin...

I think we should consider adding configuration to allow comin running a Home Manager switch to configuration instead of NixOS switch to configuration. This implies a comin instance would not be able to support both NixOS and Home manager simultaneously.

We should however hit some issues with the model since a Generation is currently, for instance, getting the machine-id during the evaluation phase. This part should not be executed for a Home Manager deployment.

It would be nice to have an idea of the comin NixOS module interface also, because we would have to modify it i think.

@Pablo1107
Copy link
Author

Pablo1107 commented Mar 10, 2024

I'm not super familiar with the activation process on NixOS, I just read a little bit the comin codebase and I saw that you use some nixos-rebuild internal script called switch-to-configuration instead of just using the nixos-rebuild switch command. Seems this script responsability is to check for stateful things that might be carried from generation to generation?

Home Manager on the other hand seems to just do a nix build followed by a $generation/activate. So probably it's a little bit of a simpler process than NixOS.

@nlewo
Copy link
Owner

nlewo commented Mar 11, 2024

I saw that you use some nixos-rebuild internal script called switch-to-configuration instead of just using the nixos-rebuild switch command.

I think nixos-rebuild is basically a wrapper around nix build and the switch-to-configuration script.

The NixOS deployment and Home Manager deployment should be pretty similar:

  • building a flake attribute to generate an activation script
  • running this activation script

However, regarding NixOS, comin is switching but it also does some other small tasks such as:

  • comparing some machine id to ensure the deployment is expected
  • restarting comin if required
  • rebooting if required (not implemented yet but planned)

I think these tasks should not be executed if the Home Manager context.

How would you plan to run comin to support deploy Home Manager?

  • As user or root?
  • As a Home Manager module?

@Pablo1107
Copy link
Author

How would you plan to run comin to support deploy Home Manager?

  • As user or root?
  • As a Home Manager module?

Ideally the Nix interface should be mostly the same, meaning it should be a HM module that you call a as a service that creates a systemctl --user service with your comin bin. That should run as a user. And this is important as most HM rely on not necessarily having root access.

However, regarding NixOS, comin is switching but it also does some other small tasks such as:

  • comparing some machine id to ensure the deployment is expected
  • restarting comin if required
  • rebooting if required (not implemented yet but planned)

I think these tasks should not be executed if the Home Manager context.

Maybe there is a case (env vars) that may need a re-login tho.

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

No branches or pull requests

2 participants