summary refs log tree commit diff
path: root/nixos/modules/system/boot/systemd-unit-options.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2014-03-31 12:23:27 +0200
committeraszlig <aszlig@redmoonstudios.org>2014-03-31 12:33:25 +0200
commit9d8a8126e982e8aacfcd76d07abb947cb60d7f21 (patch)
tree08939253d9791043cf0b180687db2e380b8420fc /nixos/modules/system/boot/systemd-unit-options.nix
parent6167da54ea35b78ec93daffaa1bb1033d2ac1a67 (diff)
downloadnixpkgs-9d8a8126e982e8aacfcd76d07abb947cb60d7f21.tar
nixpkgs-9d8a8126e982e8aacfcd76d07abb947cb60d7f21.tar.gz
nixpkgs-9d8a8126e982e8aacfcd76d07abb947cb60d7f21.tar.bz2
nixpkgs-9d8a8126e982e8aacfcd76d07abb947cb60d7f21.tar.lz
nixpkgs-9d8a8126e982e8aacfcd76d07abb947cb60d7f21.tar.xz
nixpkgs-9d8a8126e982e8aacfcd76d07abb947cb60d7f21.tar.zst
nixpkgs-9d8a8126e982e8aacfcd76d07abb947cb60d7f21.zip
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>
Diffstat (limited to 'nixos/modules/system/boot/systemd-unit-options.nix')
-rw-r--r--nixos/modules/system/boot/systemd-unit-options.nix17
1 files changed, 17 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix
index 113990814ef..d9dc6549f36 100644
--- a/nixos/modules/system/boot/systemd-unit-options.nix
+++ b/nixos/modules/system/boot/systemd-unit-options.nix
@@ -321,6 +321,23 @@ in rec {
   };
 
 
+  pathOptions = unitOptions // {
+
+    pathConfig = mkOption {
+      default = {};
+      example = { PathChanged = "/some/path"; Unit = "changedpath.service"; };
+      type = types.attrsOf unitOption;
+      description = ''
+        Each attribute in this set specifies an option in the
+        <literal>[Path]</literal> section of the unit.  See
+        <citerefentry><refentrytitle>systemd.path</refentrytitle>
+        <manvolnum>5</manvolnum></citerefentry> for details.
+      '';
+    };
+
+  };
+
+
   mountOptions = unitOptions // {
 
     what = mkOption {