Commit Graph

107 Commits

Author SHA1 Message Date
Eelco Dolstra
0fc68a3d1d Rewrite switch-to-configuration in Perl
This will make it more efficient to do systemd dependency graph
processing (if necessary).
2012-08-02 15:11:29 -04:00
Eelco Dolstra
d4fec178fd Merge remote-tracking branch 'origin/master' into systemd 2012-08-02 13:44:16 -04:00
Eelco Dolstra
6576d81ff1 Fix "please: command not found" in switch-to-configuration 2012-07-30 15:19:30 -04:00
Eelco Dolstra
b52117c34d Treat init-script as a boot loader 2012-07-25 11:30:16 -04:00
Eelco Dolstra
b15e1fbb08 Boot loader refactoring
- Renamed system.build.menuBuilder to system.build.installBootLoader.

- ‘install-grub.pl’ (formerly grub-menu-builder.pl) now generates the
  GRUB menu *and* installs GRUB (if necessary).

- ‘switch-to-configuration.sh’ has no boot loader specific knowledge
  anymore.  It just calls installBootLoader.
2012-07-25 10:47:32 -04:00
Eelco Dolstra
f0c82f4543 Pass the ‘--recheck’ flag to grub-install 2012-07-24 19:22:19 -04:00
Eelco Dolstra
f07f221f0e Replace grub-menu-builder with a much faster version
The old GRUB menu builder script is quite slow, typically taking
several seconds.  This is a real annoyance since it's run every time
you switch to a new configuration.  Therefore this patch replaces the
Bash script with a much faster Perl script.  In a VirtualBox test, the
execution time went from 2.7s to 0.1s.  The Perl version is also more
correct because it uses XML to get the GRUB configuration (through
builtins.toXML), so there are no shell escaping issues.

The new script currently lacks support for subconfigurations defined
through "nesting.children".
2012-07-24 19:16:27 -04:00
Eelco Dolstra
0edf138fc7 switch-to-configuration: Initial systemd support
It reloads the configuration, but doesn't (re)start jobs yet.
2012-07-20 18:25:36 -04:00
Eelco Dolstra
0b865edb16 switch-to-configuration: require a reboot going from Upstart to systemd 2012-07-20 16:23:52 -04:00
Eelco Dolstra
44d091674b Merge branch 'master' of github.com:NixOS/nixos into systemd
Conflicts:
	modules/config/networking.nix
	modules/services/networking/ssh/sshd.nix
	modules/services/ttys/agetty.nix
	modules/system/boot/stage-2-init.sh
	modules/system/upstart-events/shutdown.nix
2012-07-16 17:27:11 -04:00
Eelco Dolstra
73532c3855 Global replace /var/run/current-system -> /run/current-system 2012-07-16 11:34:21 -04:00
Eelco Dolstra
f21aa7d22c First attempt at using systemd
Basic booting works.  Systemd starts agetty instances on tty1 and
tty2.  Shutdown and journald also work.
2012-06-04 12:51:48 -04:00
Eelco Dolstra
a6892051ef * Allow building with boot.loader.grub.enable set to "false".
svn path=/nixos/trunk/; revision=34218
2012-05-23 15:52:29 +00:00
Mathijs Kwik
be69799f35 better workaround for building nested child configurations
svn path=/nixos/trunk/; revision=34164
2012-05-18 06:17:08 +00:00
Mathijs Kwik
7fca5408f3 Revert "Provided a workaround for grub's missing-devices check, so nested child configurations can still build."
This reverts commit a89e8831e3d95bcf3ddc19ee34b938db7e8aa572.

svn path=/nixos/trunk/; revision=34163
2012-05-18 06:17:05 +00:00
Eelco Dolstra
f889ebc488 * Allow runtime changes to boot.devShmSize and friends.
svn path=/nixos/trunk/; revision=34160
2012-05-17 19:33:55 +00:00
Mathijs Kwik
88b3c4b82e Provided a workaround for grub's missing-devices check, so nested child configurations can still build.
svn path=/nixos/trunk/; revision=34153
2012-05-17 10:17:32 +00:00
Eelco Dolstra
3dd0718939 * Give an error at evaluation time if boot.loader.grub.device or
boot.loader.grub.devices are not set, rather than complaining about
  it when it's too late.

svn path=/nixos/trunk/; revision=34081
2012-05-14 01:53:47 +00:00
Eelco Dolstra
03f2847054 * Set preferLocalBuild on a few trivial top-level derivations. These
tend to cause a lot of unnecessary I/O to the build machines.

svn path=/nixos/trunk/; revision=33936
2012-04-26 15:19:23 +00:00
Eelco Dolstra
e3879fe365 * Store the NixOS version in the top-level derivation.
* Change the name of the top-level derivation from "system" to
  "nixos-<version>".
* Show the NixOS version in the GRUB boot menu instead of the kernel
  version.

svn path=/nixos/trunk/; revision=33785
2012-04-14 17:09:59 +00:00
Lluís Batlle i Rossell
9fb07d4036 Making a reference single-quoted for grubDevices, as after substitution, there
will be doublequoted elements.

Suggested by Kirelagin.


svn path=/nixos/trunk/; revision=33403
2012-03-25 12:36:43 +00:00
Eelco Dolstra
43b5ced96c * Ignore SIGHUP and write errors on stderr to ensure that
switch-to-configuration runs to completion (e.g. if the tty we're on
  got killed).

svn path=/nixos/trunk/; revision=33382
2012-03-23 13:37:22 +00:00
Eelco Dolstra
293e3a784d * Ensure a consitent umask in the activation script (reported by
Lluís).

svn path=/nixos/trunk/; revision=33347
2012-03-22 10:17:10 +00:00
Eelco Dolstra
fcc2e985a2 * Handle jobs that fail while a post-start script is waiting for them.
svn path=/nixos/trunk/; revision=33269
2012-03-19 18:07:05 +00:00
Eelco Dolstra
b1fd71038e * Slight speedup. It's amazing how quickly shell scripts become
slow: calling basename in a loop somewhere has a noticable impact on
  performance.  We really shouldn't use bash scripts.

svn path=/nixos/trunk/; revision=33242
2012-03-18 19:05:44 +00:00
Eelco Dolstra
8ca2aff772 * Get rid of some grep hackery on the Upstart jobs.
svn path=/nixos/trunk/; revision=33240
2012-03-18 18:53:50 +00:00
Eelco Dolstra
4acc48fc2d * Mark tasks such as mount-failed as not to be restarted.
svn path=/nixos/trunk/; revision=33237
2012-03-18 18:04:49 +00:00
Eelco Dolstra
21393eed1e * Use the --quiet flag.
svn path=/nixos/trunk/; revision=33225
2012-03-18 02:36:44 +00:00
Eelco Dolstra
86d8d62d16 * Allow Upstart jobs to declare that they shouldn't be restarted by
switch-to-configuration.  E.g. the X server shouldn't be restarted
  because that kills all the X clients.

svn path=/nixos/trunk/; revision=33223
2012-03-18 02:10:39 +00:00
Eelco Dolstra
3495a773f9 * Improved Upstart job handling in switch-to-configuration. It no
longer compares the current configuration to the previous
  configuration, but instead compares the current Upstart state to the
  intended state.  Thus, if the switch script is interrupted, running
  nixos-rebuild again will resume starting/stopping Upstart jobs where
  the previous run left off.

  We determine if an Upstart job has changed by having the pre-start
  script of each Upstart job put a symlink to its .conf file in
  /var/run/upstart-jobs.  So if this symlink differs from the target
  of /etc/init/<job>.conf, then the job has changed.  This also
  prevents multiple restarts of dependent jobs.  E.g., if job B has
  "start on started A" and "stop on stopping A", then restarting A
  will cause B to be restarted, so B shouldn't B restarted a second
  time.

  We only start jobs that are not running if 1) they're tasks that
  have been previously run (like mountall); or 2) they're jobs that
  have a "start on" condition.  This seems a reasonable heuristic.

svn path=/nixos/trunk/; revision=33222
2012-03-18 01:53:35 +00:00
Shea Levy
8ad872ca03 Revert r33139
I didn't end up needing it and there's a better way to do what I wanted if I
did.

svn path=/nixos/trunk/; revision=33150
2012-03-16 12:01:08 +00:00
Shea Levy
b89a65e54c Allow multiple definitions of boot.loader.kernelFile as long as they are all the same
svn path=/nixos/trunk/; revision=33139
2012-03-16 03:20:12 +00:00
Shea Levy
001fcad421 First shot at EFI booting.
Note: This feature is INCOMPLETE. Moreover, when runEfibootmgr is true it will
MODIFY NVRAM and, on Apple systems, possibly brick your firmware. PLEASE be
careful while further testing is performed

svn path=/nixos/trunk/; revision=33047
2012-03-13 19:27:59 +00:00
Eelco Dolstra
b6d43e1aca * Fix Amazon image generation (broken by r32913).
svn path=/nixos/trunk/; revision=33032
2012-03-13 13:17:43 +00:00
Eelco Dolstra
7281a851b3 * Create a /usr/bin/env symlink. This allows scripts from other
distributions with shebang lines such as

    #! /usr/bin/env python

  to work correctly.

svn path=/nixos/trunk/; revision=33011
2012-03-12 10:41:39 +00:00
Lluís Batlle i Rossell
9e980235bd Properly filter a possible lack of "grub.device", in case of using only "grub.devices".
svn path=/nixos/trunk/; revision=33009
2012-03-12 09:42:24 +00:00
Lluís Batlle i Rossell
13ac0a309b Allow a way to install grub to multiple devices (for /boot on soft raid arrays).
svn path=/nixos/trunk/; revision=32913
2012-03-08 21:37:30 +00:00
Eelco Dolstra
1d5d7036d0 * Add a module for managing cgroups.
svn path=/nixos/trunk/; revision=30551
2011-11-24 18:28:45 +00:00
Eelco Dolstra
aac71e8f95 * Add a module for DRBD.
svn path=/nixos/trunk/; revision=30202
2011-11-03 02:14:57 +00:00
Peter Simons
20b364f4de Reverting revisions 30103-30106: "always set nixpkgs.config.{state,store}Dir", etc.
After the change from revision 30103, nixos-rebuild suddenly consumed
freaky amounts of memory. I had to abort the process after it had
allocated well in excess of 30GB(!) of RAM. I'm not sure what is causing
this behavior, but undoing that assignment fixes the problem. The other
two commits needed to be revoked, too, because they depend on 30103.

svn path=/nixos/trunk/; revision=30127
2011-10-30 15:19:58 +00:00
Shea Levy
09cf6ce70c find modules | fgrep .nix | fgrep -v .svn | fgrep -v nixpkgs.nix | xargs sed -i -e 's|/nix/var|${config.nixpkgs.config.nix.stateDir}|g' -e 's|/nix/store|${config.nixpkgs.config.nix.storeDir}|g'
Don't assume /nix/store or /nix/var in NixOS modules, this is configurable

svn path=/nixos/trunk/; revision=30104
2011-10-29 21:03:57 +00:00
Eelco Dolstra
9076456b15 * Don't restart udevtrigger from the switch script. It's triggered by
udev.

svn path=/nixos/trunk/; revision=29962
2011-10-21 16:22:38 +00:00
Peter Simons
eb6e1310b8 strip trailing whitespace; no functional change
svn path=/nixos/trunk/; revision=29285
2011-09-14 18:20:50 +00:00
Eelco Dolstra
c41b01ea23 * Canonicalize boot.loader.grub.device before calling grub-install to
ensure that values such as /dev/disk/by-id/ata-WDC... work.

svn path=/nixos/trunk/; revision=27519
2011-06-22 18:22:58 +00:00
Eelco Dolstra
7579933824 * Don't mount /dev/cgroup with the "ns" subsystem. If it's mounted,
then every unshare(CLONE_NEWNS) system call causes a new entry to be
  created in /dev/cgroup/<pid>, which is not removed automatically.
  This can cause subsequent calls to unshare() to fail if the PID has
  wrapped around.  Worse, a large number of entries in /dev/cgroup
  causes a very substantial system slowdown: doing 10,000
  fork()/unshare(CLONE_NEWNS)/exit() calls took 21s without the "ns"
  subsystem, but 2m43s with it, and the system slows down permanently
  until the entries in /dev/cgroup are removed (going to a load of > 6
  on my laptop).

  This is particularly important for Nix because its chroot feature
  uses unshare(CLONE_NEWNS).  (http://yellowgrass.org/issue/Nix/219)

svn path=/nixos/trunk/; revision=27216
2011-05-11 09:33:24 +00:00
Eelco Dolstra
e46fca2185 * Mount /dev/cgroup to enable cgroup support.
svn path=/nixos/trunk/; revision=26112
2011-02-25 14:31:15 +00:00
Eelco Dolstra
cda2e41c01 * Added a "xendomains" job to automatically start the domains defined
in /etc/xen/auto at boot time, to save all running domains during
  shutdown, and to restore all saved domains at boot time.

svn path=/nixos/trunk/; revision=24121
2010-10-06 16:07:16 +00:00
Eelco Dolstra
c4f910f550 * Substitute the path of the system derivation directly in the stage 2
init script.  This removes the need for the `systemConfig' boot
  parameter; `init=<stage-2-init>' is enough.  However, the GRUB menu
  builder still needs to add `systemConfig' to the kernel command line
  for compatibility with old configurations.

svn path=/nixos/trunk/; revision=23775
2010-09-13 22:10:25 +00:00
Eelco Dolstra
4046056cdc * In the activation script, don't require the path to the "system"
derivation on the command line.

svn path=/nixos/trunk/; revision=23770
2010-09-13 18:19:15 +00:00
Eelco Dolstra
f729f12e4e Some cleanups in the activation script:
* Moved some scriptlets to the appropriate modules.
* Put the scriptlet that sets the default path at the start, since it
  never makes sense not to have it there.  It no longer needs to be
  declared as a dependency.
* If a scriptlet has no dependencies, it can be denoted as a plain
  string (i.e., `noDepEntry' is not needed anymore).

svn path=/nixos/trunk/; revision=23762
2010-09-13 15:41:38 +00:00