Commit graph

68 commits

Author SHA1 Message Date
William A. Kennington III 08e74f2791 systemd: Add ability to define networks 2014-11-26 11:22:02 -08:00
Vladimír Čunát 2cf17b0802 Merge recent master into staging
Hydra nixpkgs: ?compare=1156478
2014-10-23 17:40:41 +02:00
William A. Kennington III f020a26164 nixos/systemd: Also escape \ characters 2014-10-19 16:34:53 -07:00
Domen Kožar 2fa662c957 systemd: replace @ when generating unit command name 2014-10-19 17:20:37 +02:00
Domen Kožar 0854836fd2 systemd: include name of the unit when generating nix store path 2014-10-19 15:49:55 +02:00
Eelco Dolstra a85dcf4a00 Merge remote-tracking branch 'origin/master' into staging
Conflicts:
	pkgs/development/libraries/libav/default.nix
	pkgs/shells/bash/bash-4.2-patches.nix
	pkgs/stdenv/generic/default.nix
2014-10-07 00:09:37 +02:00
Eelco Dolstra 97220c973f Replace hasAttr/getAttr calls with the ? and . operators
For NixOS evaluation, this gives a ~21% reduction in the number of
values allocated and a ~4% speedup. It's also more readable.
2014-10-05 01:11:06 +02:00
Eelco Dolstra 91ec6e0d90 Merge remote-tracking branch 'origin/master' into staging 2014-09-18 22:28:35 +02:00
William A. Kennington III 4d193b7262 systemd: Support reload scripts 2014-09-15 20:04:49 -07:00
Eelco Dolstra c23bf4ec74 systemd: Update to 216 2014-08-23 23:28:03 +02:00
Eelco Dolstra 7c4591d010 Don't barf if /var/log doesn't support ACLs
http://hydra.nixos.org/build/13462892
2014-08-18 14:21:45 +02:00
Emery Hemingway 63d259df32 nixos: tmp on tmpfs option
/tmp cleaning is done by systemd rather than stage-2-init
enableEmergencyMode moved from systemd to seperate module
new option to mount tmp on tmpfs
new option to enable additional units shipped with systemd
2014-07-30 16:19:26 +02:00
Eelco Dolstra 9956b97b2f Check for systemd environment variables that are too long
Issue #3403. For the case of $PATH being too long, we could call
buildEnv automatically.
2014-07-30 10:28:05 +02:00
Eelco Dolstra 1a1442db74 Don't restart systemd-journal-flush
It only needs to be started during boot. Starting it at other times
shouldn't hurt, except that if systemd-journald is restarting at the
same time, the latter might not have a SIGUSR1 signal handler
installed yet, so it might be killed by systemd-journal-flush. (At
least that's my theory about the dead systemd-journald instances in
the build farm...)
2014-07-17 21:01:25 +02:00
Eelco Dolstra 3b2609deec Don't restart systemd-remount-fs
It's only needed during early boot (in fact, it's probably not needed
at all on NixOS). Restarting it is expensive because it does a sync()
of the root file system.
2014-07-11 23:34:58 +02:00
Paul Colomiets 11e25f1a3e Implement per-user socket units 2014-06-20 17:41:14 -04:00
Evgeny Egorochkin b415876bdb systemd service: fix issues with escaping when unit name contains '-'
systemd escaping rules translate this into a string containing '\'
which is treated by some code paths as quoted, and by others as unquoted
causing the affected units to fail.
2014-06-11 04:08:13 +03:00
Eelco Dolstra bddd10d75c switch-to-configuration: Don't restart instances of user@.service
Restarting user@ instances is bad because it causes all user services
(such as ssh-agent.service) to be restarted. Maybe one day we can have
switch-to-configuration restart user units in a fine-grained way, but
for now we should just ignore user systemd instances.

Backport: 14.04
2014-05-20 11:12:56 +02:00
Eelco Dolstra 728d3476ba systemd: Require some more kernel features 2014-04-30 13:53:12 +02:00
Eelco Dolstra d621300665 Revert "Don't mount /sys/fs/fuse/connections and /sys/kernel/config"
This reverts commit 6eaced3582. Doesn't
work very well, e.g. if you actually have the FUSE module loaded. And
in any case it's already fixed in NixOps.
2014-04-28 09:19:01 +02:00
Eelco Dolstra 6eaced3582 Don't mount /sys/fs/fuse/connections and /sys/kernel/config
These fail to mount if you don't have the appropriate kernel support,
and this confuses NixOps' ‘check’ command. We should teach NixOps not
to complain about non-essential mount points, but in the meantime it's
better to turn them off.
2014-04-28 08:16:27 +02:00
Eelco Dolstra da444ff26f Turn assertion about oneshot services into a warning 2014-04-22 23:53:21 +02:00
Eelco Dolstra fa3826dcf4 Ignore *.wants in systemd.packages for now 2014-04-22 17:38:53 +02:00
Mathijs Kwik bf841cd892 Revert "systemd: oneshot units should be allowed to restart on failure/abort"
This reverts commit c1e638abb6.

As pointed out by wkennington, upstream disallows all cases as of v207
2014-04-18 21:42:22 +02:00
Eelco Dolstra febb15f722 systemd: Enable keeping backlight / rfkill state across reboots 2014-04-18 19:37:15 +02:00
Eelco Dolstra 1e540af43b Fix broken upstream user unit symlinks 2014-04-18 17:38:06 +02:00
Eelco Dolstra 64b968f81f Remove debug line 2014-04-18 02:31:10 +02:00
Eelco Dolstra 12f06ae499 Doh 2014-04-18 01:36:43 +02:00
Eelco Dolstra e34a1589fe Add support for user units
With ‘systemd.user.units’ and ‘systemd.user.services’, you can specify
units used by per-user systemd instances.  For example,

  systemd.user.services.foo =
    { description = "foo";
      wantedBy = [ "default.target" ];
      serviceConfig.ExecStart = "${pkgs.foo}/bin/foo";
    };

declares a unit ‘foo.service’ that gets started automatically when the
user systemd instance starts, and is stopped when the user systemd
instance stops.

Note that there is at most one systemd instance per user: it's created
when a user logs in and there is no systemd instance for that user
yet, and it's removed when the user fully logs out (i.e. has no
sessions anymore). So if you're simultaneously logged in via X11 and a
virtual console, you get only one copy of foo.
2014-04-18 00:38:40 +02:00
Eelco Dolstra 073351a5cf Refactor unit option declarations
This gets rid of some duplication.
2014-04-17 23:35:05 +02:00
Eelco Dolstra 2ad6933a22 Remove special handling of systemd-journal-gatewayd 2014-04-17 19:05:29 +02:00
Eelco Dolstra 179acfb664 Allow upstream systemd units to be extended
If you define a unit, and either systemd or a package in
systemd.packages already provides that unit, then we now generate a
file /etc/systemd/system/<unit>.d/overrides.conf. This makes it
possible to use upstream units, while allowing them to be customised
from the NixOS configuration. For instance, the module nix-daemon.nix
now uses the units provided by the Nix package. And all unit
definitions that duplicated upstream systemd units are finally gone.

This makes the baseUnit option unnecessary, so I've removed it.
2014-04-17 18:52:31 +02:00
Eelco Dolstra 560a1103ad Add option ‘systemd.tmpfiles.rules’
This allows specifying rules for systemd-tmpfiles.

Also, enable systemd-tmpfiles-clean.timer so that stuff is cleaned up
automatically 15 minutes after boot and every day, *if* you have the
appropriate cleanup rules (which we don't have by default).
2014-04-17 16:14:56 +02:00
Mathijs Kwik c1e638abb6 systemd: oneshot units should be allowed to restart on failure/abort 2014-04-17 15:20:39 +02:00
Eelco Dolstra 317a81ada2 Enable systemd-tmpfiles 2014-04-17 13:23:06 +02:00
Eelco Dolstra 518f710547 Fix module loading in systemd-udevd 2014-04-17 12:26:12 +02:00
Eelco Dolstra 89155dbc01 systemd: Enable user systemd instances 2014-04-17 12:03:04 +02:00
Eelco Dolstra e8af68d2dc Make machinectl work 2014-04-16 10:48:14 +02:00
Eelco Dolstra 2fc520d699 Simplify assertion 2014-04-16 01:08:14 +02:00
William A. Kennington III eda854d50f systemd: Add an assertion to guarantee oneshot units do not have restart set
This prevents insidious errors once systemd begins handling the unit. If
the unit is loaded at boot, any errors of this nature are logged to the
console before the journal service is running. This makes it very hard
to diagnose the issue. Therefore, this assertion helps guarantee the
mistake is not made.
2014-04-16 01:05:56 +02:00
Eelco Dolstra ee9c068b0c systemd: Update to 212
Note that systemd no longer depends on dbus, so we're rid of the
cyclic dependency problem between systemd and dbus.

This commit incorporates from wkennington's systemd branch
(203dcff45002a63f6be75c65f1017021318cc839,
1f842558a95947261ece66f707bfa24faf5a9d88).
2014-04-16 00:59:26 +02:00
Eelco Dolstra 29027fd1e1 Rewrite ‘with pkgs.lib’ -> ‘with lib’
Using pkgs.lib on the spine of module evaluation is problematic
because the pkgs argument depends on the result of module
evaluation. To prevent an infinite recursion, pkgs and some of the
modules are evaluated twice, which is inefficient. Using ‘with lib’
prevents this problem.
2014-04-14 16:26:48 +02:00
Eelco Dolstra d2155649af Merge branch 'containers'
Fixes #2105.
2014-04-10 15:55:51 +02:00
aszlig 9d8a8126e9
systemd: Add support for path units.
This allows to define systemd.path(5) units, for example like this:

{
  systemd = let
    description = "Set Key Permissions for xyz.key";
  in {
    paths.set-key-perms = {
      inherit description;
      before = [ "network.target" ];
      wantedBy = [ "multi-user.target" ];
      pathConfig.PathChanged = "/run/keys/xyz.key";
    };

    services.set-key-perms = {
      inherit description;
      serviceConfig.Type = "oneshot";
      script = "chown myspecialkeyuser /run/keys/xyz.key";
    };
  };
}

The example here is actually useful in order to set permissions for the
NixOps keys target to ensure those permisisons aren't reset whenever the
key file is reuploaded.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-03-31 12:33:25 +02:00
Eelco Dolstra 511b86d22d Add an option to reload rather than restart changed units 2014-03-17 15:02:53 +01:00
Shea Levy 0c12dd3ded Merge branch 'pkgs/systemd/journald_http_gateway' of git://github.com/offlinehacker/nixpkgs
systemd: python support & journal http gateway

Conflicts:
	nixos/modules/misc/ids.nix
2014-03-14 19:16:59 -04:00
Shea Levy 59a060523e Don't override the baseUnit's PATH by default 2014-03-12 20:03:14 -04:00
Eelco Dolstra e1984f029d autovt@.service really has to be a symlink 2014-03-13 00:19:10 +01:00
Eelco Dolstra f198c40608 Don't depend on the text of disabled units
This prevents pulling in unnecessary dependencies.
2014-03-12 18:52:11 +01:00
Eelco Dolstra 207c881df9 Don't include superfluous lines in generated units 2014-03-12 18:52:11 +01:00