Add a unitConfig option to set the [Unit] section of units

This commit is contained in:
Eelco Dolstra 2012-08-10 18:56:12 -04:00
parent e00967a54a
commit 39030211af
2 changed files with 17 additions and 5 deletions

View File

@ -71,12 +71,22 @@ with pkgs.lib;
''; '';
}; };
unitConfig = mkOption {
default = "";
type = types.string;
description = ''
Contents of the <literal>[Unit]</literal> section of the unit.
See <citerefentry><refentrytitle>systemd.unit</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> for details.
'';
};
serviceConfig = mkOption { serviceConfig = mkOption {
default = ""; default = "";
type = types.string; type = types.string;
description = '' description = ''
Contents of the <literal>[Service]</literal> section of the unit. Contents of the <literal>[Service]</literal> section of the unit.
See <citerefentry><refentrytitle>systemd.unit</refentrytitle> See <citerefentry><refentrytitle>systemd.service</refentrytitle>
<manvolnum>5</manvolnum></citerefentry> for details. <manvolnum>5</manvolnum></citerefentry> for details.
''; '';
}; };

View File

@ -26,6 +26,7 @@ let
"nss-user-lookup.target" "nss-user-lookup.target"
"syslog.target" "syslog.target"
"time-sync.target" "time-sync.target"
#"cryptsetup.target"
# Udev. # Udev.
"systemd-udevd-control.socket" "systemd-udevd-control.socket"
@ -177,6 +178,7 @@ let
Wants=${concatStringsSep " " def.wants} Wants=${concatStringsSep " " def.wants}
Before=${concatStringsSep " " def.before} Before=${concatStringsSep " " def.before}
After=${concatStringsSep " " def.after} After=${concatStringsSep " " def.after}
${def.unitConfig}
[Service] [Service]
Environment=PATH=${def.path} Environment=PATH=${def.path}
@ -207,7 +209,7 @@ let
mkdir -p $out mkdir -p $out
for i in ${toString upstreamUnits}; do for i in ${toString upstreamUnits}; do
fn=${systemd}/example/systemd/system/$i fn=${systemd}/example/systemd/system/$i
[ -e $fn ] if ! [ -e $fn ]; then echo "missing $fn"; false; fi
if [ -L $fn ]; then if [ -L $fn ]; then
cp -pd $fn $out/ cp -pd $fn $out/
else else
@ -217,7 +219,7 @@ let
for i in ${toString upstreamWants}; do for i in ${toString upstreamWants}; do
fn=${systemd}/example/systemd/system/$i fn=${systemd}/example/systemd/system/$i
[ -e $fn ] if ! [ -e $fn ]; then echo "missing $fn"; false; fi
x=$out/$(basename $fn) x=$out/$(basename $fn)
mkdir $x mkdir $x
for i in $fn/*; do for i in $fn/*; do
@ -239,7 +241,7 @@ let
ln -s ${cfg.defaultUnit} $out/default.target ln -s ${cfg.defaultUnit} $out/default.target
ln -s ../getty@tty1.service $out/multi-user.target.wants/ #ln -s ../getty@tty1.service $out/multi-user.target.wants/
''; # */ ''; # */
in in