anchor.diff:        '';
       };
   
  +    systemd.user.units = mkOption {
  +      description = "Definition of systemd per-user units.";
  +      default = {};
  +      type = types.attrsOf types.optionSet;
  +      options = { name, config, ... }:
  +        { options = concreteUnitOptions;
  +          config = {
  +            unit = mkDefault (makeUnit name config);
  +          };
  +        };
  +    };
  +
  +    systemd.user.services = mkOption {
  +      default = {};
  +      type = types.attrsOf types.optionSet;
  +      options = [ serviceOptions unitConfig serviceConfig ];
  +      description = "Definition of systemd per-user service units.";
  +    };
  +
     };
   
   
  
positive.code:       message = "${name}: Type=oneshot services must have Restart=no";
      }) cfg.services;
  
      system.build.units = units;
  
      environment.systemPackages = [ systemd ];
  
      environment.etc."systemd/system".source = units;
  
      environment.etc."systemd/system.conf".text =
        ''
  
negative.code:         '';
      };
  
    generateUnits = type: units: upstreamUnits: upstreamWants:
      pkgs.runCommand "${type}-units" { preferLocalBuild = true; } ''
        mkdir -p $out
  
        # Copy the upstream systemd units we're interested in.
        for i in ${toString upstreamUnits}; do
          fn=${systemd}/example/systemd/${type}/$i
          if ! [ -e $fn ]; then echo "missing $fn"; false; fi
          if [ -L $fn ]; then
            cp -pd $fn $out/
  