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

nixos: systemd user services #1689

Closed
offlinehacker opened this issue Feb 6, 2014 · 15 comments
Closed

nixos: systemd user services #1689

offlinehacker opened this issue Feb 6, 2014 · 15 comments
Labels
0.kind: enhancement Add something new

Comments

@offlinehacker
Copy link
Contributor

So systemd supports user services, and some/most of nixos modules would not need a lot of changing to work in user environemnts(ex. changing the state dir). @zefhemel used supervisor for that(https://github.com/zefhemel/nix-docker), but that's not necessary and i would like to implement this, but first i would also like to get comments from others and especially @edolstra how to properly implement this.

@shlevy
Copy link
Member

shlevy commented Feb 6, 2014

I have some ideas for how to do this properly (and they would even work on non-nixos systems that use systemd), but they will need to wait until #1021 is fixed as systemd has changed how user services work since our systemd version.

@shlevy
Copy link
Member

shlevy commented Feb 6, 2014

Essentially we'd use the module system to define units and use that config to ultimately create a symlink tree that contains a bunch of unit files, plus an activation script to update relevant symlinks in the user's HOME and reload any needed targets, then have a simple tool like nixos-rebuild (that nixos-rebuild can hook into) to rebuild the tree + activation script and run the script.

@offlinehacker
Copy link
Contributor Author

+1

@edolstra
Copy link
Member

edolstra commented Feb 6, 2014

In the interim, you can use service-runner.nix, see 2b0aea1.

@offlinehacker
Copy link
Contributor Author

@edolstra thanks, exactly what i needed for now :)

@offlinehacker
Copy link
Contributor Author

We should have someting like system.defaultStateDir option(by default pointing to /var), which would be reused where needed. Then you could use it like dataDir = "${config.system.defaultStateDir}/db/postgresql". Do you see any problems with that and where should i put this option?

@offlinehacker
Copy link
Contributor Author

I am now working on something similar now (https://github.com/offlinehacker/nix-services). I use supervisor for managing processes(basically expression from @zefhemel for nix-docker), because systemd does not work on darwin.

@shlevy
Copy link
Member

shlevy commented Apr 5, 2014

Note also that @proger is working on an abstraction around services that might be useful here. Seems like a lot of people are converging on this problem :)

@shlevy shlevy added this to the 14.10 milestone Apr 5, 2014
@offlinehacker
Copy link
Contributor Author

I already have working implementation, which uses supervisord for running
services, i'm also using in production:
https://github.com/kiberpipa/nix-rehash/tree/master/nix-services
On Apr 5, 2014 7:23 PM, "Shea Levy" [email protected] wrote:

Note also that @proger https://github.com/proger is working on an
abstraction around services that might be useful here. Seems like a lot of
people are converging on this problem :)

Reply to this email directly or view it on GitHubhttps://github.com//issues/1689#issuecomment-39644844
.

@shlevy
Copy link
Member

shlevy commented Apr 5, 2014

Ah cool, I just asked for that in another PR :) I think after 14.04 we should start coordinating and seeing if we can't converge on a solution.

@shlevy shlevy removed their assignment Aug 26, 2014
@shlevy shlevy removed this from the 14.10 milestone Aug 26, 2014
@shlevy
Copy link
Member

shlevy commented Aug 26, 2014

I no longer expect to have the bandwidth to take this on.

@domenkozar
Copy link
Member

duplicate of #1689

@cstrahan
Copy link
Contributor

cstrahan commented Nov 3, 2014

@iElectric you closed this on the basis of it being a duplicate of #1689, but this is #1689. Did you have another issue in mind, or should this be reopened?

@wmertens
Copy link
Contributor

wmertens commented Nov 4, 2014

@iElectric did you mean #4493 or #4594 or something else?

@domenkozar
Copy link
Member

@wmertens correct, sorry for wrong info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: enhancement Add something new
Projects
None yet
Development

No branches or pull requests

6 participants