From e35d6f78dc797150451f5134833afa0ecdf4a241 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 3 Oct 2012 17:57:20 -0400 Subject: [PATCH] Rename nix-worker to nix-daemon --- .gitignore | 4 ++-- configure.ac | 2 +- doc/manual/Makefile.am | 2 +- doc/manual/env-common.xml | 4 ++-- doc/manual/installation.xml | 10 +++++----- doc/manual/manual.xml | 2 +- doc/manual/{nix-worker.xml => nix-daemon.xml} | 9 ++++----- doc/manual/release-notes.xml | 8 +++++++- .../{nix-worker.service => nix-daemon.service} | 2 +- nix.spec.in | 8 ++++---- src/Makefile.am | 2 +- src/nix-daemon/Makefile.am | 12 ++++++++++++ .../nix-worker.cc => nix-daemon/nix-daemon.cc} | 12 ++++++------ src/nix-worker/Makefile.am | 9 --------- tests/common.sh.in | 4 ++-- 15 files changed, 49 insertions(+), 41 deletions(-) rename doc/manual/{nix-worker.xml => nix-daemon.xml} (78%) rename misc/systemd/{nix-worker.service => nix-daemon.service} (80%) create mode 100644 src/nix-daemon/Makefile.am rename src/{nix-worker/nix-worker.cc => nix-daemon/nix-daemon.cc} (98%) delete mode 100644 src/nix-worker/Makefile.am diff --git a/.gitignore b/.gitignore index bd66cabef..8a7e99d06 100644 --- a/.gitignore +++ b/.gitignore @@ -106,8 +106,8 @@ Makefile.in # /src/nix-store/ /src/nix-store/nix-store -# /src/nix-worker/ -/src/nix-worker/nix-worker +# /src/nix-daemon/ +/src/nix-daemon/nix-daemon # /tests/ /tests/test-tmp diff --git a/configure.ac b/configure.ac index 4b13ba276..11a5390fa 100644 --- a/configure.ac +++ b/configure.ac @@ -364,7 +364,7 @@ AC_CONFIG_FILES([Makefile src/libexpr/Makefile src/nix-instantiate/Makefile src/nix-env/Makefile - src/nix-worker/Makefile + src/nix-daemon/Makefile src/nix-setuid-helper/Makefile src/nix-log2xml/Makefile src/bsdiff-4.3/Makefile diff --git a/doc/manual/Makefile.am b/doc/manual/Makefile.am index 42da3c8b0..eedc992a3 100644 --- a/doc/manual/Makefile.am +++ b/doc/manual/Makefile.am @@ -23,7 +23,7 @@ man1_MANS = nix-env.1 nix-build.1 nix-store.1 nix-instantiate.1 \ man5_MANS = nix.conf.5 -man8_MANS = nix-worker.8 +man8_MANS = nix-daemon.8 FIGURES = figures/user-environments.png diff --git a/doc/manual/env-common.xml b/doc/manual/env-common.xml index c4c0f9d2d..fcdd2c268 100644 --- a/doc/manual/env-common.xml +++ b/doc/manual/env-common.xml @@ -304,9 +304,9 @@ $ mount -o bind /mnt/otherdisk/nix /nix /var/run/nix/remote-stores. Note that if you’re building through the Nix daemon, the only setting for + linkend="sec-nix-daemon">Nix daemon, the only setting for this variable that matters is the one that the - nix-worker process uses. So if you want to + nix-daemon process uses. So if you want to change it, you have to restart the daemon. diff --git a/doc/manual/installation.xml b/doc/manual/installation.xml index bbcc057f1..fdab71fc0 100644 --- a/doc/manual/installation.xml +++ b/doc/manual/installation.xml @@ -412,11 +412,11 @@ $ chown -R root /nix/store /nix/var/nix -The Nix daemon should be +The Nix daemon should be started as follows (as root): -$ nix-worker --daemon +$ nix-daemon You’ll want to put that line somewhere in your system’s boot scripts. @@ -450,11 +450,11 @@ named anything. It should own the Nix store and database: $ chown -R nix /nix/store /nix/var/nix -and of course nix-worker --daemon should be started -under that user, e.g., +and of course nix-daemon should be started under +that user, e.g., -$ su - nix -c "exec /nix/bin/nix-worker --daemon" +$ su - nix -c "exec /nix/bin/nix-daemon" diff --git a/doc/manual/manual.xml b/doc/manual/manual.xml index ccff9423c..aa461d708 100644 --- a/doc/manual/manual.xml +++ b/doc/manual/manual.xml @@ -59,7 +59,7 @@ - +
diff --git a/doc/manual/nix-worker.xml b/doc/manual/nix-daemon.xml similarity index 78% rename from doc/manual/nix-worker.xml rename to doc/manual/nix-daemon.xml index 5ae9d59bd..c68605fd6 100644 --- a/doc/manual/nix-worker.xml +++ b/doc/manual/nix-daemon.xml @@ -1,24 +1,23 @@ + xml:id="sec-nix-daemon"> - nix-worker + nix-daemon 8 Nix - nix-worker + nix-daemon Nix multi-user support daemon - nix-worker - + nix-daemon diff --git a/doc/manual/release-notes.xml b/doc/manual/release-notes.xml index 43d5080af..8d0840d06 100644 --- a/doc/manual/release-notes.xml +++ b/doc/manual/release-notes.xml @@ -10,7 +10,7 @@
Release 1.2 (TBA) -This release has the following improvements: +This release has the following improvements and changes: @@ -47,6 +47,12 @@ $ mount -o remount,ro,bind /nix/store modifications. + + The command nix-worker has been renamed + to nix-daemon. Support for running the Nix + worker in “slave” mode has been removed. + +
diff --git a/misc/systemd/nix-worker.service b/misc/systemd/nix-daemon.service similarity index 80% rename from misc/systemd/nix-worker.service rename to misc/systemd/nix-daemon.service index 2ededfea8..ee28209f0 100644 --- a/misc/systemd/nix-worker.service +++ b/misc/systemd/nix-daemon.service @@ -4,7 +4,7 @@ After=syslog.target [Service] Type=simple -ExecStart=/usr/bin/nix-worker --daemon +ExecStart=/usr/bin/nix-daemon [Install] WantedBy=multi-user.target diff --git a/nix.spec.in b/nix.spec.in index 9d93c654d..822684c5e 100644 --- a/nix.spec.in +++ b/nix.spec.in @@ -139,7 +139,7 @@ chmod -x $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/nix.sh %if ! 0%{?rhel} # install systemd service descriptor mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system -cp -p misc/systemd/nix-worker.service \ +cp -p misc/systemd/nix-daemon.service \ $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system/ %endif @@ -173,8 +173,8 @@ chgrp %{nixbld_group} /nix/store chmod 1775 /nix/store %if ! 0%{?rhel} # Enable and start Nix worker -systemctl enable nix-worker.service -systemctl start nix-worker.service +systemctl enable nix-daemon.service +systemctl start nix-daemon.service %endif %files @@ -186,7 +186,7 @@ systemctl start nix-worker.service %exclude %dir %{perl_vendorarch}/auto/ %{_prefix}/libexec/* %if ! 0%{?rhel} -%{_prefix}/lib/systemd/system/nix-worker.service +%{_prefix}/lib/systemd/system/nix-daemon.service %endif %{_datadir}/emacs/site-lisp/nix-mode.el %{_datadir}/nix diff --git a/src/Makefile.am b/src/Makefile.am index 25ae67996..0ae407c57 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,3 @@ SUBDIRS = boost libutil libstore libmain nix-store nix-hash \ - libexpr nix-instantiate nix-env nix-worker nix-setuid-helper \ + libexpr nix-instantiate nix-env nix-daemon nix-setuid-helper \ nix-log2xml bsdiff-4.3 diff --git a/src/nix-daemon/Makefile.am b/src/nix-daemon/Makefile.am new file mode 100644 index 000000000..b8e9f4a06 --- /dev/null +++ b/src/nix-daemon/Makefile.am @@ -0,0 +1,12 @@ +bin_PROGRAMS = nix-daemon + +nix_daemon_SOURCES = nix-daemon.cc +nix_daemon_LDADD = ../libmain/libmain.la ../libstore/libstore.la ../libutil/libutil.la \ + ../boost/format/libformat.la + +AM_CXXFLAGS = \ + -I$(srcdir)/.. -I$(srcdir)/../libutil \ + -I$(srcdir)/../libstore -I$(srcdir)/../libmain + +install-exec-local: + ln -sf nix-daemon $(DESTDIR)$(bindir)/nix-worker diff --git a/src/nix-worker/nix-worker.cc b/src/nix-daemon/nix-daemon.cc similarity index 98% rename from src/nix-worker/nix-worker.cc rename to src/nix-daemon/nix-daemon.cc index 833fc3518..6256258ec 100644 --- a/src/nix-worker/nix-worker.cc +++ b/src/nix-daemon/nix-daemon.cc @@ -25,7 +25,7 @@ using namespace nix; disconnects and immediately kill any ongoing builds. On platforms that lack it, we only notice the disconnection the next time we try to write to the client. So if you have a builder that never - generates output on stdout/stderr, the worker will never notice + generates output on stdout/stderr, the daemon will never notice that the client has disconnected until the builder terminates. */ #ifdef O_ASYNC #define HAVE_HUP_NOTIFICATION @@ -677,7 +677,7 @@ static void processConnection() /* Prevent users from doing something very dangerous. */ if (geteuid() == 0 && querySetting("build-users-group", "") == "") - throw Error("if you run `nix-worker' as root, then you MUST set `build-users-group'!"); + throw Error("if you run `nix-daemon' as root, then you MUST set `build-users-group'!"); #endif /* Open the store. */ @@ -724,7 +724,7 @@ static void processConnection() assert(!canSendStderr); }; - printMsg(lvlError, format("%1% worker operations") % opCount); + printMsg(lvlError, format("%1% operations") % opCount); } @@ -858,7 +858,7 @@ static void daemonLoop() case 0: try { /* child */ - /* Background the worker. */ + /* Background the daemon. */ if (setsid() == -1) throw SysError(format("creating a new session")); @@ -907,8 +907,8 @@ void run(Strings args) void printHelp() { - showManPage("nix-worker"); + showManPage("nix-daemon"); } -string programId = "nix-worker"; +string programId = "nix-daemon"; diff --git a/src/nix-worker/Makefile.am b/src/nix-worker/Makefile.am deleted file mode 100644 index 6b1b2827c..000000000 --- a/src/nix-worker/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -bin_PROGRAMS = nix-worker - -nix_worker_SOURCES = nix-worker.cc -nix_worker_LDADD = ../libmain/libmain.la ../libstore/libstore.la ../libutil/libutil.la \ - ../boost/format/libformat.la - -AM_CXXFLAGS = \ - -I$(srcdir)/.. -I$(srcdir)/../libutil \ - -I$(srcdir)/../libstore -I$(srcdir)/../libmain diff --git a/tests/common.sh.in b/tests/common.sh.in index ee0ddfbb6..f327ad727 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -59,9 +59,9 @@ clearManifests() { startDaemon() { # Start the daemon, wait for the socket to appear. !!! - # ‘nix-worker’ should have an option to fork into the background. + # ‘nix-daemon’ should have an option to fork into the background. rm -f $NIX_STATE_DIR/daemon-socket/socket - nix-worker --daemon & + nix-daemon & for ((i = 0; i < 30; i++)); do if [ -e $NIX_STATE_DIR/daemon-socket/socket ]; then break; fi sleep 1