From 39030211af56d9186821eef7daaa18db486bc028 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Aug 2012 18:56:12 -0400 Subject: [PATCH] Add a unitConfig option to set the [Unit] section of units --- modules/system/boot/systemd-unit-options.nix | 12 +++++++++++- modules/system/boot/systemd.nix | 10 ++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/system/boot/systemd-unit-options.nix b/modules/system/boot/systemd-unit-options.nix index 34b37f4d0ba..ec769ad69f9 100644 --- a/modules/system/boot/systemd-unit-options.nix +++ b/modules/system/boot/systemd-unit-options.nix @@ -71,12 +71,22 @@ with pkgs.lib; ''; }; + unitConfig = mkOption { + default = ""; + type = types.string; + description = '' + Contents of the [Unit] section of the unit. + See systemd.unit + 5 for details. + ''; + }; + serviceConfig = mkOption { default = ""; type = types.string; description = '' Contents of the [Service] section of the unit. - See systemd.unit + See systemd.service 5 for details. ''; }; diff --git a/modules/system/boot/systemd.nix b/modules/system/boot/systemd.nix index 2a586090dd1..5f7ea7d3c9b 100644 --- a/modules/system/boot/systemd.nix +++ b/modules/system/boot/systemd.nix @@ -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