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 {
default = "";
type = types.string;
description = ''
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.
'';
};

View file

@ -26,6 +26,7 @@ let
"nss-user-lookup.target"
"syslog.target"
"time-sync.target"
#"cryptsetup.target"
# Udev.
"systemd-udevd-control.socket"
@ -68,7 +69,7 @@ let
"systemd-update-utmp-shutdown.service"
# Kernel module loading.
"systemd-modules-load.service"
"systemd-modules-load.service"
# Filesystems.
"systemd-fsck@.service"
@ -177,6 +178,7 @@ let
Wants=${concatStringsSep " " def.wants}
Before=${concatStringsSep " " def.before}
After=${concatStringsSep " " def.after}
${def.unitConfig}
[Service]
Environment=PATH=${def.path}
@ -207,7 +209,7 @@ let
mkdir -p $out
for i in ${toString upstreamUnits}; do
fn=${systemd}/example/systemd/system/$i
[ -e $fn ]
if ! [ -e $fn ]; then echo "missing $fn"; false; fi
if [ -L $fn ]; then
cp -pd $fn $out/
else
@ -217,7 +219,7 @@ let
for i in ${toString upstreamWants}; do
fn=${systemd}/example/systemd/system/$i
[ -e $fn ]
if ! [ -e $fn ]; then echo "missing $fn"; false; fi
x=$out/$(basename $fn)
mkdir $x
for i in $fn/*; do
@ -239,7 +241,7 @@ let
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