mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
systemd: add a name option to all systemd units
This allows us to set things like dependencies in a way that we can catch typos at eval time. So instead of ```nix systemd.services.foo.wants = [ "bar.service" ]; ``` we can write ```nix systemd.services.foo.wants = [ config.systemd.services.bar.name ]; ``` which will throw an error if no such service has been defined. Not all cases can be done like this (eg template services), but in a lot of cases this will allow to avoid typos. There is a matching option on the unit option (`systemd.units."foo.service".name`) as well.
This commit is contained in:
parent
b432281d97
commit
9258f57625
8 changed files with 124 additions and 63 deletions
|
@ -65,6 +65,14 @@ in rec {
|
|||
'';
|
||||
};
|
||||
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
The name of this systemd unit, including its extension.
|
||||
This can be used to refer to this unit from other systemd units.
|
||||
'';
|
||||
};
|
||||
|
||||
overrideStrategy = mkOption {
|
||||
default = "asDropinIfExists";
|
||||
type = types.enum [ "asDropinIfExists" "asDropin" ];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue