Commit graph

171 commits

Author SHA1 Message Date
Jamey Sharp 8d40083690 nixos/stage-2: create empty machine-id at boot
Previously, the activation script was responsible for ensuring that
/etc/machine-id exists. However, the only time it could not already
exist is during stage-2-init, not while switching configurations,
because one of the first things systemd does when starting up as PID 1
is to create this file. So I've moved the initialization to
stage-2-init.

Furthermore, since systemd will do the equivalent of
systemd-machine-id-setup if /etc/machine-id doesn't have valid contents,
we don't need to do that ourselves.

We _do_, however, want to ensure that the file at least exists, because
systemd also uses the non-existence of this file to guess that this is a
first-boot situation. In that case, systemd tries to create some
symlinks in /etc/systemd/system according to its presets, which it can't
do because we've already populated /etc according to the current NixOS
configuration.

This is not necessary for any other activation script snippets, so it's
okay to do it after stage-2-init runs the activation script. None of
them declare a dependency on the "systemd" snippet. Also, most of them
only create files or directories in ways that obviously don't need the
machine-id set.
2018-09-30 10:45:35 -07:00
Jamey Sharp f449242e83 nixos/systemd: remove activation dependency
As far as I can tell, the systemd snippet hasn't depended on groups
being initialized since 5d02c02a9b in
2015, when a `setfacl` call was removed.
2018-09-29 23:37:38 -07:00
Frederik Rietdijk d9fa74ba78 Merge master into staging 2018-08-09 18:28:15 +02:00
Linus Heckemann adba92b5ef systemd: improve unit script drv naming
Also store scripts directly in the nix store rather than having the
superfluous /bin/ tree.
2018-08-08 14:29:41 +02:00
Jörg Thalheim 05daf390b3 systemd: 238 -> 239 2018-08-06 11:03:09 +02:00
Jörg Thalheim 81d5e441b2
Merge pull request #44202 from jerith666/journald-rate
journald: set rateLimitInterval and rateLimitBurst to upstream defaults
2018-07-30 13:47:01 +01:00
Matt McHenry a3c1ddda84 journald: set rateLimitInterval and rateLimitBurst to upstream defaults 2018-07-29 12:29:30 -04:00
Matthew Bauer ca0522a842
Merge pull request #41970 from aneeshusa/enable-building-systemd-without-libmicrohttpd
nixos/systemd: Allow building systemd without libmicrohttpd
2018-07-23 11:24:14 -04:00
volth 2e979e8ceb [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00
volth 87f5930c3f [bot]: remove unreferenced code 2018-07-20 18:48:37 +00:00
Silvan Mosberger 35c069ea02
nixos: systemd.globalEnvironment: fix type
Follow up fix of fb2a8d6669

https://github.com/NixOS/nixpkgs/pull/38356
https://github.com/NixOS/nixpkgs/pull/40416
2018-07-18 22:04:26 +02:00
Florian Klink fff5923686 nixos/modules: users.(extraUsers|extraGroup->users|group) 2018-06-30 03:02:58 +02:00
Aneesh Agrawal 76c4c7b9de nixos/systemd: Allow building systemd without libmicrohttpd 2018-06-13 22:55:06 -07:00
Daiderd Jordan 58fd592019
Merge pull request #38356 from Infinisil/fix/environment
nixos/systemd: Fix environment type -> allows overriding
2018-04-20 22:22:05 +02:00
Silvan Mosberger e9fc2558f9
nixos/systemd: Fix environment type -> allows overriding 2018-04-03 00:36:52 +02:00
Shea Levy 05e375d710
Merge remote-tracking branch 'origin/master' into staging 2018-03-28 09:36:47 -04:00
davidak 41676002b2 nixos/systemd: add option for cgroup accounting 2018-03-27 09:15:22 +02:00
Nikolay Amiantov 0ccab4946d systemd: 237 -> 238 2018-03-22 22:37:26 +03:00
Shea Levy fec543436d
nixos: Move uses of stdenv.shell to runtimeShell. 2018-03-01 14:38:53 -05:00
Franz Pletz eb862c48dd
systemd: 234 -> 237
Co-Authored-By: Florian Klink <flokli@flokli.de>
Co-Authored-By: Andreas Rammhold <andreas@rammhold.de>
2018-02-13 01:24:24 +01:00
Joerg Thalheim 23f398012b nixos: skip restarting systemd-logind to not break x11 2017-09-27 22:28:27 +01:00
Robin Gloster 43404d9acf
systemd-tmpfiles: fix docs
We have been doing this since 4e4161c212
2017-09-24 13:17:46 +02:00
Profpatsch 5d62d8775c modules/systemd: improve logind.extraConfig example
Since we have a .handleLidSwitch option now, give an other example.
2017-08-03 03:07:05 +02:00
Peter Hoeg 5cb11abc9e systemd: paths and slices are supported for user units too 2017-07-13 11:55:48 +08:00
Maximilian Bosch 23d1c7f474
services.logind: add options for lid-switch behavior 2017-05-23 18:57:57 +02:00
Eelco Dolstra e84d5b23e1
Allow systemd-fsck@.service to find fsck.*
Fixes "fsck.ext4 doesn't exist, not checking file system on ...".
2017-04-04 18:17:05 +02:00
Eelco Dolstra de51ad6cd1
Don't restart systemd-fsck@ units
Restarting them is useless since the filesystem is already
checked. Worse, restarting them causes the filesystem to be unmounted.

Also remove an override for systemd-rkill@.service which no longer
exists.
2017-04-04 16:40:18 +02:00
Franz Pletz 66f553974b
dhcpcd service: fix network-online.target integration
When dhcpcd instead of networkd is used, the network-online.target behaved
the same as network.target, resulting in broken services that need a working
network connectivity when being started.

This commit makes dhcpcd wait for a lease and makes it wanted by
network-online.target. In turn, network-online.target is now wanted by
multi-user.target, so it will be activated at every boot.
2017-02-23 16:07:40 +01:00
Kevin Cox da33c8a19d
systemd: Properly escape environment options.
Using toJSON on a string value works because the allowed JSON escape
sequences is almost a subset of the systemd allowed escape sequences.
The only exception is `\/` which JSON allows but systemd doesn't.
Luckily this sequence isn't required and toJSON don't produce it making
the result valid for systemd consumption.

Examples of things that this fixes are environment variables with double
quotes or newlines.
2017-02-20 22:20:13 -05:00
Nikolay Amiantov 6f7811143d systemd service: don't install systemd-hwdb-update 2017-02-08 21:42:07 +03:00
Antoine Eiche 9d30099b7f nixos/systemd: set r-x group permissions on /var/log/journal
This allows services such as systemd-journal-gateway to access the
systemd journal.

Closes #22288
2017-02-08 16:06:14 +03:00
Nikolay Amiantov 90bc1a8595 Merge pull request #22353 from abbradar/bluetooth
Bluetooth improvements
2017-02-05 13:18:48 +03:00
Nikolay Amiantov 8ef14f80e3 systemd service: add aliases option 2017-02-02 00:52:54 +03:00
Robin Gloster a38f1911d3
systemd: 231 -> 232
Includes adding some more upstream units and removing obsolete (-.slice) ones.
2017-01-26 17:52:52 +01:00
Markov Dmitry efd5508b89 systemd: add slice support 2016-12-20 10:49:08 +01:00
Alexander Ried 8bb4fc1039 systemd.timers: filter timers with empty startAt 2016-10-19 02:22:12 +02:00
Jörg Thalheim e5c6f35a49 Merge pull request #19069 from peterhoeg/targets
systemd: add user target support
2016-10-03 23:10:18 +02:00
Joachim F 7e80c42b0e Merge pull request #18511 from ericsagnes/feat/remove-optionSet
modules: optionSet -> submodule
2016-10-01 17:57:45 +02:00
Nikolay Amiantov ff0b8b2225 systemd-journald service: restart instead of stop and start
Also restart when configuration is changed.
2016-09-30 17:49:30 +03:00
Peter Hoeg 1049fd49ed systemd: add user target support
This allows us to define system user targets in addition to the existing
services, timers and sockets.

Furthermore, we add a top-level configuration keyword:

 - Documentation
2016-09-29 17:02:10 +08:00
Eelco Dolstra 32d00f50ec Merge pull request #18573 from peterhoeg/systemd_user_cfg
systemd: support setting defaults for user instances
2016-09-14 13:39:57 +02:00
Eric Sagnes 79f72966e6 systemd module: optionSet -> submodule 2016-09-13 12:56:36 +09:00
Franz Pletz c58654e2b7
treewide: fix fallout of ip-up deprecation
See #18319 for details. Starting network-online.target manually does not
work as it hangs indefinitely.

Additionally, don't treat avahi and dhcpcd special and sync their systemd units
with the respective upstream suggestion.
2016-09-11 08:13:04 +02:00
Peter Hoeg 23b76b23f5 support user config 2016-09-08 16:40:54 +08:00
Alexander Ried 53f3c2a278 systemd: add some missing upstream units 2016-09-05 15:03:46 +02:00
Alexander Ried 992c514a20 (network,remote-fs)-pre: remove duplicate wantedBy and before
this is part of (network,remote-fs).target, repectively
2016-09-05 15:03:35 +02:00
Christian Kauhaus 3530f3f20a systemd: make ctrl-alt-del target configurable. (#16911)
We currently only allow upstream's default of "reboot.target" due to the
way the symlinks are initialized. I made this configurable similar to the
default unit.
2016-07-19 09:42:53 +02:00
Bjørn Forsman 2eb8aab42c nixos/systemd: disable timer units with service
A disabled systemd service with a "startAt" attribute, like this:

  systemd.services.foo-service = {
    enable = false;
    startAt = "*-*-* 05:15:00";
    ...
  };

will cause the following errors in the system journal:

  systemd[1]: foo-service.timer: Refusing to start, unit to trigger not loaded.
  systemd[1]: Failed to start foo-service.timer.

Fix it by not generating the corresponding timer unit when the service
is disabled.
2016-07-11 22:42:47 +02:00
Guillaume Maudoux 86dfaafad2 systemd-logind: reload when logind.conf changed 2016-07-03 00:38:37 +02:00
Svein Ove Aas 93c160fabc systemd: Set KillUserProcesses=no in logind.conf
Full discussion at
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825394

NixOS is even more of a server OS than Debian, and I can think of no
reason to make users jump through this sort of hoop.
2016-06-06 11:51:51 +01:00