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

Add different init systems service files for Nix #6558

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions misc/dinit/nix-daemon.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type = process
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for the weird spacing? Does dinit require this? (6 spaces followed by 2 tabs here, and 6 spaces followed by 1 tab for the logfile)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just noticed that. To be honest - I've just followed how some built-in service files on Artix look like. I've wanted to keep it the same way, so the = is in the same place. (ntpd and cronie service files, for example). I can fix it with next commit.
image
image

Thanks for noticing. Besides from that, is there anything else? I'll for sure add more service files soon, however, my question is, should I declare some other things somewhere else to make it work with Nix? If so, where? Is the directory where the files are even OK?

command = /nix/var/nix/profiles/default/bin/nix-daemon --daemon
smooth-recovery = true
logfile = /var/run/nix-daemon.log
7 changes: 7 additions & 0 deletions misc/openrc/nix-daemon.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/sbin/openrc-run

name="${RC_SVCNAME}"
description="Nix Daemon"
command_args_background="--daemon"
pidfile="/var/run/nix-daemon.pid"
command="/nix/var/nix/profiles/default/bin/nix-daemon"
3 changes: 3 additions & 0 deletions misc/runit/nix-daemon.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
sv check nix >/dev/null || exit 1
exec /nix/var/nix/profiles/default/bin/nix-daemon --daemon
11 changes: 11 additions & 0 deletions misc/shepherd/nix-daemon.service.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
define nix-daemon
(make <service>
#:provides '(nix-daemon)
#:docstring "nix-daemon, the nix package manager's daemon"
#:start (make-forkexec-constructor
'("/nix/var/nix/profiles/default/bin/nix-daemon"))
#:stop (make-kill-destructor)
#:respawn? #t)
(register-services nix-daemon)

(start nix-daemon)