1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-26 00:18:30 +02:00
Commit Graph

48 Commits

Author SHA1 Message Date
Robert Helgesson
708cb61e82
systemd: support sd-switch
This adds support for sd-switch, a tool to perform systemd generation
switches. It can be activated by setting

    systemd.startServices = "sd-switch";
2020-12-13 22:00:30 +01:00
Vojtěch Káně
b6ed605d4a
systemd: support mount units 2020-12-10 23:16:51 +01:00
Sandro Jäckel
275d1b5212
systemd: allow creating slices 2020-12-05 09:18:17 +01:00
Sandro
aaa5329d39
systemd: Fix example (#1639)
missing `;`
2020-12-04 18:39:05 +01:00
Robert Helgesson
28eb093a1e
systemd: use listsAsDuplicateKeys
This causes list values to be emitted as a list of key-value pairs
instead of a single key-value pair where the value is space separated.

This is useful, e.g., for socket units that would like to specify more
than one `ListenStream=` address.
2020-10-25 22:55:06 +01:00
Niclas
4ebb7d1715
systemd: fix systemd spelling (#1373)
Systemdaemons are lowercased and get suffixed with a d
2020-09-06 11:28:40 +02:00
Robert Helgesson
223e3c38a1
Revert "systemd: use sd-switch"
This reverts commit 9c0fe3957b.
2020-08-04 19:38:14 +02:00
Robert Helgesson
9c0fe3957b
systemd: use sd-switch
This makes the systemd module use the sd-switch application to perform
the unit switch during a generation activation.

Since the closure of sd-switch is relatively lightweight we
unconditionally pull it in as a dependency. We simultaneously remove
the `systemd.user.startServices` option and perform the switch action
automatically.

PR #1388
2020-08-04 01:01:10 +02:00
Cole Helbling
8369624512
systemd: don't page failed user units
Otherwise, the pager (typically `less`) pauses execution of
`home-manager switch` until the pager is dismissed, if the content is
larger than would fit on the screen.

PR #1175
2020-04-23 23:40:58 +02:00
Robert Helgesson
6e4b9af080
Switch to extended Nixpkg's lib
This change makes use of the `extend` function inside `lib` to inject
a new `hm` field containing the Home Manager library functions. This
simplifies use of the Home Manager library in the modules and reduces
the risk of accidental infinite recursion.

PR #994
2020-01-21 20:47:04 +01:00
arcnmx
8abaa025ec systemd: fix degraded warning 2019-12-15 14:58:43 -08:00
Robert Helgesson
9781f3766d
systemd: perform reload even in degraded state
This fixes #355, fixes #798, and fixes #909.
2019-11-24 18:55:01 +01:00
Robert Helgesson
875eea1330
systemd: fix unit examples
Closes #823
2019-08-29 19:12:39 +02:00
Robert Helgesson
12cb82af91
systemd: make the unit option type more robust
This should allow more sensible merging behavior. In particular, with
this change it is possible to use, for example, `mkForce` for greater
control of merging.

Fixes #543
2019-04-12 01:02:12 +02:00
Olli Helenius
1fdb16866b
systemd: add support for session variables
Via environment.d(5).
2019-03-24 17:23:50 +01:00
Douglas Wilson
74811679b7
systemd: sanitize unit derivation names
To allow a few special characters such as "@".

This is taken from

    c414e5bd08/nixos/modules/system/boot/systemd-lib.nix (L14)
2019-02-19 23:43:47 +01:00
Alex Brandt
7575e119d6
systemd: add more detail to user unit documentation
The current documentation does not provide guidance to users on how
systemd units are defined in Home Manager. A user may expect the
configuration to be similar to NixOS, when it actually differs.

Fixes #418
2018-10-18 23:39:28 +02:00
Olli Helenius
299e01722f
Add support for systemd path units 2018-07-01 18:04:06 +02:00
Cornelius Mika
73b8aa8bcc
systemd: merge unit definitions recursively
This removes the need for monolithic unit definitions and allows
users to modify existing units.

Example:
```
{
  systemd.user.services.owncloud-client.Unit.OnFailure = "my-notify-service";
}
```
2018-05-10 20:13:58 +02:00
Robert Helgesson
e307ceeee7
systemd: replace use of who command
Curiously the `who` command sometimes does not list logged-in users,
resulting in systemd not being reloaded. Instead we use

    systemctl --user is-system-running

to more directly detect whether systemd is running.
2018-02-20 22:04:29 +01:00
Robert Helgesson
1bc59f7290
allow Home Manager to be used as a NixOS module
This is a NixOS module that is intended to be imported into a NixOS
system configuration. It allows the system users to be set up directly
from the system configuration.

The actual profile switch is performed by a oneshot systemd unit per
configured user that acts much like the regular `home-manager switch`
command.

With this implementation, the NixOS module does not work properly with
the `nixos-rebuild build-vm` command. This can be solved by using the
`users.users.<name?>.packages` option to install packages but this
does not work flawlessly with certain Nixpkgs packages. In particular,
for programs using the Qt libraries.
2018-02-07 20:50:01 +01:00
Robert Helgesson
f0d207f380
Add dag library to config.lib
Also replace all imports of `dag.nix` by the entry in `config.lib`.
2017-12-26 17:27:21 +01:00
Silvan Mosberger
8d360c5a57
systemd: remove filename hack 2017-12-12 18:05:04 +01:00
Cornelius Mika
8759a5a63e
systemd: add option to automatically start services 2017-12-11 18:25:49 +01:00
Cornelius Mika
52bdbc42bb
systemd: move activation script to separate file
This makes the following commit more readable.
2017-12-11 18:08:33 +01:00
Robert Helgesson
2ff09158f3
systemd: fix systemctl command
The command's path should be taken from the configuration, not be
assumed to be in `PATH`.
2017-12-11 16:58:50 +01:00
Robert Helgesson
bc2f2ad546
systemd: honor RefuseManualStart and RefuseManualStop
Fixes https://github.com/rycee/home-manager/issues/140
2017-11-16 15:37:53 +01:00
Robert Helgesson
7a9c873093
files: add special handling of systemd files
Unfortunately systemd derives nonsensical unit names when the unit
file is a link to a link to a file. This commit ensures that any file
whose target path matches the pattern `*/systemd/user/*` will be
reachable with only one link hop.

This also reverts f52ec0df7c, which
contained a temporary fix. This commit is an improvements in that it
is more explicit and also handles unit files given directly as a home
file source.
2017-11-12 00:56:34 +01:00
Robert Helgesson
f52ec0df7c
systemd: force copying of unit files
This is done by exploiting the fact that home files will be copied if
the executable bit of the source file and the target file is
different. This should be considered a hack until some nicer solution
is found.
2017-11-09 17:14:37 +01:00
Robert Helgesson
d70715a635
use xdg.configFile for files in XDG config home 2017-10-29 01:59:34 +02:00
Robert Helgesson
30b9d7f00e
Use only tools from Nixpkgs in activation script
Note, we still pull in the user's `PATH` in case the user has defined
their own activation blocks that depend on additional tools.
Eventually this will be deprecated and removed.

See #99.
2017-10-20 19:04:33 +02:00
Robert Helgesson
a8e08d14bb
Mark rycee as maintainer for a bunch of modules 2017-09-26 23:40:31 +02:00
Robert Helgesson
742d1889c5
lib: make dag.nix take lib as argument 2017-09-21 13:19:29 +02:00
Robert Helgesson
61042c7606
lib: use generators from Nixpkgs 2017-09-21 13:18:33 +02:00
Cornelius Mika
286d678785
systemd: don't fail on activation when services changed
The diff command exits with status 1 when detecting differences.
Because of 'set -e', this caused the activation to fail.
2017-08-23 20:07:06 +02:00
Robert Helgesson
acf813cadc
systemd: add support for socket units 2017-06-29 01:06:08 +02:00
Robert Helgesson
f60a1ed689
systemd: handle non-Linux systems better
This commit causes an error to be printed if running under a non-Linux
system when a systemd service, target, or timer is active.

It will also prevent running systemd during activation if running
under a non-Linux system.
2017-05-16 22:05:02 +02:00
Robert Helgesson
8fab2a5d9b
Add basic directed acyclic graph data structure
Also make use of this instead of Nixpkgs's strings-with-deps library
in activation script generation.
2017-05-04 00:39:36 +02:00
Robert Helgesson
4f1eec8180
Avoid undefined variables in activation script 2017-03-29 00:11:01 +02:00
Robert Helgesson
deaa6d3dd4
Add configurable verbosity during activation 2017-01-21 12:27:50 +01:00
Robert Helgesson
550d0e81c9
systemd: handle missing service directories
Before it suggested to restart a service `*.service`, which is quite
silly.
2017-01-18 09:27:28 +01:00
Robert Helgesson
f35b9a9970
Add initial section of activation script
The initial section creates some useful variables for use by later
activation sections.
2017-01-16 20:33:53 +01:00
Robert Helgesson
b1f84ada60
Support dry run in activation script
If the `DRY_RUN` variable is set then no actual change should be
performed. Only printing what actions would be taken.
2017-01-16 00:16:22 +01:00
Robert Helgesson
4efbf0e090
systemd: minor activation output fix 2017-01-15 23:42:03 +01:00
Robert Helgesson
8a196bb62b
systemd: fix quoting in glob pattern 2017-01-15 23:42:02 +01:00
Robert Helgesson
06a24c37e5
systemd: add support for creating target files 2017-01-15 23:41:52 +01:00
Robert Helgesson
43fd747ba7
Use a generation directory
Before we put only user files in the generation directory but that was
quite limiting. In particular, we lost track of the activation script.
2017-01-15 23:41:20 +01:00
Robert Helgesson
d7d02c3ce8
Initial import 2017-01-14 13:15:24 +01:00