From 2fc520d699a853089cba5fb7c733db0c3789dc7b Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Wed, 16 Apr 2014 01:08:14 +0200
Subject: [PATCH] Simplify assertion

---
 nixos/modules/system/boot/systemd.nix | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 4705ceb8086a..1e4963c7ca6f 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -631,8 +631,7 @@ in
   config = {
 
     assertions = mapAttrsToList (name: service: {
-      assertion = !hasAttr "Type" service.serviceConfig || service.serviceConfig.Type != "oneshot"
-        || !hasAttr "Restart" service.serviceConfig || service.serviceConfig.Restart == "no";
+      assertion = service.serviceConfig.Type or "" == "oneshot" -> service.serviceConfig.Restart or "no" == "no";
       message = "${name}: Type=oneshot services must have Restart=no";
     }) cfg.services;