Commit graph

127 commits

Author SHA1 Message Date
Alyssa Ross 4f80464645
Apply OS checks to host platform, not build
Previously, the build system used uname(1) output when it wanted to
check the operating system it was being built for, which meant that it
didn't take into-account cross-compilation when the build and host
operating systems were different.

To fix this, instead of consulting uname output, we consult the host
triple, specifically the third "kernel" part.

For "kernel"s with stable ABIs, like Linux or Cygwin, we can use a
simple ifeq to test whether we're compiling for that system, but for
other platforms, like Darwin, FreeBSD, or Solaris, we have to use a
more complicated check to take into account the version numbers at the
end of the "kernel"s.  I couldn't find a way to just strip these
version numbers in GNU Make without shelling out, which would be even
more ugly IMO.  Because these checks differ between kernels, and the
patsubst ones are quite fiddly, I've added variables for each host OS
we might want to check to make them easier to reuse.
2021-06-23 15:00:36 +00:00
Matthew Bauer 79674c6cdb Fix zsh completion script
Installed site-functions need to be run directly, not via compdef.
2021-06-12 23:50:26 -05:00
Chua Hou aedb5c7301
Install zsh completion script 2021-06-02 00:44:03 +08:00
Anders Kaseorg 4f493faf80 launchd: Use exec to avoid leaving the extra shell wrapper running
Before:

  UID   PID  PPID   C STIME   TTY           TIME CMD
    0  1737     1   0  2:28PM ??         0:00.00 /bin/sh -c /bin/wait4path /nix/var/nix/profiles/default/bin/nix-daemon && /nix/var/nix/profiles/default/bin/nix-daemon
    0  1739  1737   0  2:28PM ??         0:00.05 /nix/var/nix/profiles/default/bin/nix-daemon

After:

  UID   PID  PPID   C STIME   TTY           TIME CMD
    0  1763     1   0  2:29PM ??         0:00.05 /nix/var/nix/profiles/default/bin/nix-daemon

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-05-04 14:33:47 -07:00
Eelco Dolstra 20a7d8d23a Add some missing clean-files 2020-10-18 20:32:59 +02:00
regnat eea310b241 Add a zsh completion script
Based on @clhodapp's suggestion in https://github.com/spwhitt/nix-zsh-completions/issues/32#issuecomment-705315356 and adapted to use the description of the completions
2020-10-09 09:47:47 +02:00
regnat 04e5d0e704 Add a description in the completion outputs
Make nix output completions in the form `completion\tdescription`.
This can't be used by bash (afaik), but other shells like zsh or fish
can display it along the completion choices
2020-10-09 09:39:51 +02:00
Marwan Aljubeh b7c02232b2
Fix the nix-daemon Mac OS SSL CA cert
Mac OS multi-user installations are currently broken because all requests
made by nix-daemon to the binary cache fail with:

```
unable to download ... Problem with the SSL CA cert (path? access rights?) (77).
```

This change ensures that the nix-daemon knows where to find the SSL CA cert file.

Fixes #2899 and #3261.
2020-09-16 17:56:43 +01:00
Eelco Dolstra 959295cf4b Fix completion script install name 2020-06-04 13:37:37 +02:00
Eelco Dolstra da310fac62 Bash completion: Don't break on ':' 2020-05-11 21:37:53 +02:00
Eelco Dolstra e0c19ee620 Add completion for paths 2020-05-10 21:35:07 +02:00
Eelco Dolstra 91ddee6bf0 nix: Implement basic bash completion 2020-05-10 20:32:21 +02:00
Dan Callahan 8c4a5e7ba1
Make nix-daemon.plist less fragile on macOS
We're calling `wait4path` on the full, resolved `@bindir@/nix-daemon` path.

That means we're hardcoding something like:

    /bin/wait4path /nix/store/zs9c5xhp3zv9p23qnjxp87nl5injsi1i-nix-2.3/bin/nix-daemon &amp;&amp; /nix/var/nix/profiles/default/bin/nix-daemon

That seems unnecessarily fragile.

It might be better to wait4path on the path we intend to call.
2019-10-09 12:52:01 +01:00
Matthew Bauer 0847f2f1b3 Copy instead of linking launch agent
On Catalina, the /nix filesystem might not be mounted at start time.
To avoid this service not starting, we need to keep the launch agent
outside of the Nix store. A wait4pid will hold for our /nix dir to be
mounted.

Fixes #3125.
2019-10-08 21:52:17 -04:00
Eelco Dolstra 918717f3b5
Merge pull request #3066 from matthewbauer/wait4path
Use wait4path on org.nixos.nix-daemon.plist
2019-09-03 12:10:32 +02:00
Matthew Bauer 87c604c1f0 Fix launchd program args
launchd has some weird syntx. Apparently the program needs to be in
the ProgramArguments, as Program appears to be ignored.
2019-09-02 18:35:10 -04:00
Matthew Bauer 800fba1037 Use wait4path on org.nixos.nix-daemon.plist
When using a volume, the nix-daemon path may not exist. To avoid this
issue, we must use the wait4path tool. This should solve one of the
issues in multi-user on macOS Catalina.
2019-08-27 10:58:48 -04:00
Piotr Szubiakowski d459224724 nix-daemon.service: add install section.
Signed-off-by: Piotr Szubiakowski <pszubiak@eso.org>
2019-08-27 10:35:35 +02:00
Daiderd Jordan 8ac1130cc2
nix-daemon: add variable to disable fork safety
Since macOS 10.14 this has become an error, causing problems if the
nix-daemon loads nix during substitution (this is a forked process).

Workaround for #2523.
2019-02-09 20:35:30 +01:00
Peter Simons 81261ca538 docker: move the docker file to https://github.com/NixOS/docker
We have automated builds at https://hub.docker.com/r/nixos/nix/ now. The master
branch of the "docker" repository is available as "latest". Branches that match
the regular expression "^[0-9.]+$" are pushed to the tag that corresponds to
their branch name. Other branches are ignored.
2018-06-21 19:13:04 +02:00
Lorenzo Manacorda b600d46412
Dockerfile: 2.0.4 2018-06-06 14:50:47 +02:00
Domen Kožar 2228891260
docker readme: simplify 2018-05-08 12:37:52 +02:00
Domen Kožar 85f9650322
Dockerfile: 2.0.2 2018-05-08 12:37:43 +02:00
Domen Kožar 257c3c763a
Add README for docker 2018-05-08 12:28:55 +02:00
Domen Kožar 1e20ed5a0c
Dockerfile: update to 2.0.1 2018-05-08 12:28:06 +02:00
Ben Challenor a74288b943 Dockerfile: verify tar file with sha256sum 2018-03-19 04:56:13 +00:00
Ben Challenor ec6a328fe8 Dockerfile: 1.11.14 -> 2.0 2018-03-18 23:31:11 +00:00
Daiderd Jordan 05cb8e5c5a
launchd: enable keepalive for the nix-daemon service
Without this the daemon won't be restarted if the process ever dies, for
example when sending a SIGHUP to reload nix.conf.
2018-02-28 19:58:48 +01:00
Peter Simons 37164ae389 docker: ensure that the installation works for users other than 'root', too
The path /root/.nix-profile is a sym-link to /nix/var/nix/profiles/default. The
latter path, however, works for everyone while the former path works only for
root, so we prefer the public path whenever possible.
2017-10-07 17:28:34 +02:00
Peter Simons 1511f01351 docker: update to Nix 1.11.14
- Use the latest Nix version 1.11.14.

- Attempts to download the Nix installation tarball from http://nixos.org
  redirect to https these days, which wget doesn't support unless OpenSSL is
  available.

- Use addgroup and adduser commands to create the Nix build users.

- Link the Nix profile script into /etc/profile.d, where it's run
  automatically.

- Dropped installation of bash and tar. Neither tool is essential for running
  Nix.

Use the command "docker build -t nix . && docker run -it --rm nix sh -"
to build and run the Nix docker container.
2017-09-11 14:26:14 +02:00
Matthew Bauer 2c75945de5
Remove nix-mode.el from Nix.
This removes the file nix-mode.el from Nix. The file is now available within the
repository https://github.com/NixOS/nix-mode.

Fixes #662
Fixes #1040
Fixes #1054
Fixes #1055
Closes #1119
Fixes #1419

NOTE: all of the above should be fixed within NixOS/nix-mode. If one of those
hasn’t please reopen within NixOS/nix-mode and not within NixOS/nix.
2017-08-19 21:16:30 -07:00
Eelco Dolstra 847f19a5f7
Provide a builtin default for $NIX_SSL_CERT_FILE
This is mostly to ensure that when Nix is started on macOS via a
launchd service or sshd (for a remote build), it gets a certificate
bundle.
2017-06-12 16:44:43 +02:00
Eelco Dolstra 465cb68244
Figure out the user's home directory if $HOME is not set 2017-05-05 17:08:23 +02:00
Jörg Thalheim b3f55fdf62
nix-daemon.service: set XDG_CONFIG_HOME
Otherwise starting nix-daemon fails

● nix-daemon.service - Nix Daemon
   Loaded: loaded
(/nix/store/mnf00a6gc55xl47smk0b32gmi7xpvlfp-nix-1.12pre5308_2f21d522/lib/systemd/system/nix-daemon.service;
enabled; vendor preset: enabled)
  Drop-In:
/nix/store/m2rgjp71n4kyp8j5fxgbrlv13scd5vvv-system-units/nix-daemon.service.d
           └─overrides.conf
   Active: failed (Result: exit-code) since Sat 2017-04-29 11:29:21
CEST; 9s ago
  Process: 7299 ExecStart=nix-daemon --daemon (code=exited, status=1/FAILURE)
 Main PID: 7299 (code=exited, status=1/FAILURE)
      CPU: 19ms

... systemd[1]: Started Nix Daemon.
... nix-daemon[7299]: error: $XDG_CONFIG_HOME and $HOME are not set
... systemd[1]: nix-daemon.service: Main process exited, code=exited, status=1/FAILURE
... systemd[1]: nix-daemon.service: Unit entered failed state.
... systemd[1]: nix-daemon.service: Failed with result 'exit-code'.
... systemd[1]: nix-daemon.service: Start request repeated too quickly.
... systemd[1]: Failed to start Nix Daemon.
... systemd[1]: nix-daemon.service: Failed with result 'exit-code'.
2017-04-29 11:33:55 +02:00
Domen Kožar ae568847f5
Dockerfile: 1.11.2 -> 1.11.7 2017-03-11 19:39:13 +01:00
Shea Levy 689b825627 nix-daemon.plist: Set XDG_CACHE_HOME 2017-03-05 18:15:44 -05:00
Eelco Dolstra fb2dd32100 SSL_CERT_FILE -> NIX_SSL_CERT_FILE
This prevents collisions with the "native" OpenSSL, in particular on
OS X.

Fixes #921.
2016-10-13 17:09:10 +02:00
Eelco Dolstra 7c33ed691c nix-daemon.service: Set $XDG_CACHE_HOME
Nix requires either $HOME or $XDG_CACHE_HOME to be set.
2016-08-31 11:55:20 +02:00
Eelco Dolstra eff80419c7 launchd: Set $SSL_CERT_FILE
Otherwise in particular https://cache.nixos.org won't work in the
daemon.
2016-08-12 15:00:51 +02:00
Aneesh Agrawal c8608c488c Dockerfile: Add alpine dependencies (#1011)
* Dockerfile: add GNU tar native dependency

`builtins.fetchTarball` requires GNU tar to be available in the $PATH in
order to unpack the fetched tarball (there is a FIXME comment for this),
which Alpine does not ship by default (it ships BusyBox tar).

* Dockerfile: add GNU bash native dependency

`nix-shell` defaults to invoking `bash` from the $PATH for the subshell.
In theory this can be overriden with the NIX_BUILD_SHELL environment
variable, but this does not work properly. `nix-shell` generates and
passes a script (`$rcFile`) to be executed by the subshell which uses
bashisms (`source` and `shopt`). Additionally, in interactive mode,
`nix-shell` passes the `--rcfile` argument to the shell, which is
another bashism.

Because `bash` is thus de-facto required, add `bash` as a native package
dependency to make it available for `nix-shell`.
2016-08-04 12:32:27 +02:00
Domen Kožar c660eb61f1 Dockerfile: specify NIX_PATH 2016-07-20 16:58:01 +02:00
Eelco Dolstra a647c163ca Merge pull request #894 from adevress/systemV-support
SystemV init file for BSD systems, old Linux distributions (RHEL 6) a…
2016-05-03 11:12:07 +02:00
Adrien Devresse a86fb15a15 SystemV init file for BSD systems, old Linux distributions (RHEL 6) and Linux dist without systemd 2016-05-02 22:25:28 +02:00
Thomas Tuegel a828fe5b46 nix-mode: set syntax and font properties for multiline strings 2016-05-01 13:44:48 -05:00
Domen Kožar c588f79e4d Dockerfile: 1.9 -> 1.11.2, add more users 2016-03-16 21:26:09 +00:00
Pascal Wittmann 5f1a3201ec emacs mode: match keywords on the start/end of symbols
If keywords are matched on the start/end of words then
keywords are also matched if they are surrounded by dashes
or underscores. For example the keyword with is highlighted
in geany-with-vte. When matching on the start/end of symbols
the keyword is only highlighted if it is not part of an other
identifier.
2015-10-10 21:20:49 +02:00
Jaka Hudoklin 5845ffdf13 Add Dockerfile 2015-07-17 11:06:50 +02:00
Eelco Dolstra 3fac75bf29 Also remove misc/vim/README.md 2015-05-19 11:01:53 +02:00
Hoang Xuan Phu 46a56ea622 point to https://nixos.org/wiki/Vim_configuration instead 2015-05-19 11:01:41 +02:00
Eelco Dolstra 3cc9977118 Typo 2014-11-04 10:31:17 +01:00
Eelco Dolstra bbf294cceb Add a launchd configuration file to run nix-daemon 2014-11-04 10:30:22 +01:00
Robert Helgesson eca29bd72d Derive Emacs nix-mode from prog-mode.
Emacs 24.1 introduced the notion of "basic major modes" and among these
is prog-mode, see section "23.2.5 Basic Major Modes" in the Emacs
manual. The prog-mode basic major mode is recommended as a base for
derived major modes that are intended for editing source code.
2014-09-17 13:35:12 +02:00
Eelco Dolstra de8be7c3e0 Install systemd and Upstart stuff only on Linux 2014-07-16 11:53:47 +02:00
Steve Purcell 61c464f252 Add autoloads, make code more concise & idiomatic
- Use define-derived-mode to declare nix-mode
- Use autoloads to ensure nix-mode is usable (and enabled) without needing `require`
- Use set + make-local-variable instead of longer 2-step equivalent
2014-06-12 12:34:58 +02:00
Ricky Elrod 36662eb562 Prepare nix-mode to be uploaded to marmalade
Signed-off-by: Ricky Elrod <ricky@elrod.me>
2014-05-13 12:58:13 +02:00
Eelco Dolstra 20668b1363 Install an Upstart service 2014-05-02 13:14:10 +02:00
Eelco Dolstra 76cbf55a6d Ensure that systemd units to into lib, not lib64
http://hydra.nixos.org/build/10170940
2014-04-08 13:51:34 +02:00
Eelco Dolstra 84d6936371 Install systemd units 2014-04-07 11:50:55 +02:00
Eelco Dolstra 0c6d62cf27 Remove Automakefiles 2014-02-01 13:54:38 +01:00
Eelco Dolstra ac8c2ef1aa Build/install manual 2014-02-01 11:30:21 +01:00
Eelco Dolstra e35d6f78dc Rename nix-worker to nix-daemon 2012-10-03 17:59:23 -04:00
Eelco Dolstra 95c74eae26 Allow dashes in identifiers
In Nixpkgs, the attribute in all-packages.nix corresponding to a
package is usually equal to the package name.  However, this doesn't
work if the package contains a dash, which is fairly common.  The
convention is to replace the dash with an underscore (e.g. "dbus-lib"
becomes "dbus_glib"), but that's annoying.  So now dashes are valid in
variable / attribute names, allowing you to write:

  dbus-glib = callPackage ../development/libraries/dbus-glib { };

and

  buildInputs = [ dbus-glib ];

Since we don't have a negation or subtraction operation in Nix, this
is unambiguous.
2012-09-27 15:49:20 -04:00
Michel Alexandre Salim 221626e715 fixes to nix-worker systemd service descriptor: - remove commented-out lines - register the file for distribution in Makefile.am 2012-05-31 08:59:36 -04:00
Michel Alexandre Salim a7ed1f67ee On systems with SystemD, install the service descriptor for nix-worker, and enable and start it 2012-05-31 08:59:36 -04:00
Eelco Dolstra 510033e783 * Handle <path> syntax. 2011-08-06 18:54:29 +00:00
Eelco Dolstra 0a623a10c7 * Allow a default value in attribute selection by writing
x.y.z or default

  (as originally proposed in
  https://mail.cs.uu.nl/pipermail/nix-dev/2009-September/002989.html).

  For instance, an expression like

    stdenv.lib.attrByPath ["features" "ckSched"] false args

  can now be written as

    args.features.ckSched or false
2011-07-13 12:19:57 +00:00
Florian Friesdorf 8fcaf3e9c6 make nix-mode provide 'nix-mode
this enables (require 'nix-mode)
2011-02-14 03:11:56 +00:00
Eelco Dolstra a2fc3a53ba * Highlight URLs containing "=" properly. 2009-06-18 10:04:14 +00:00
Eelco Dolstra d53603c928 * Attributes names in attrsets can contain dots now. 2009-06-18 09:56:50 +00:00
Marc Weber 6f8c96d123 vim syntax: support for indented strings ('' .. '') 2009-01-28 12:14:53 +00:00
Marc Weber 4ff1335b2e small udpate 2007-12-12 02:12:58 +00:00
Marc Weber 764b0115d5 Very basic nix vim syntax highlighting 2007-12-10 21:17:29 +00:00
Eelco Dolstra ac19b333b3 * Finally, a real "let" syntax: `let x = ...; ... z = ...; in ...'. 2006-10-02 15:52:44 +00:00
Eelco Dolstra b5988004d6 * Support for srcdir != builddir (NIX-41). 2006-05-12 11:47:45 +00:00
Eelco Dolstra b113edeab7 * A flag `--keep-going / -k' to keep building goals if one fails, as
much as possible.  (This is similar to GNU Make's `-k' flag.)

* Refactoring to implement this: previously we just bombed out when
  a build failed, but now we have to clean up.  In particular this
  means that goals must be freed quickly --- they shouldn't hang
  around until the worker exits.  So the worker now maintains weak
  pointers in order not to prevent garbage collection.

* Documented the `-k' and `-j' flags.
2004-06-25 15:36:09 +00:00
Eelco Dolstra bafb2357d1 * README for the Emacs mode (written a while ago, but forgot to commit). 2004-06-20 19:08:59 +00:00
Eelco Dolstra e8411948ff * A Nix mode for Emacs. 2004-06-04 14:31:57 +00:00