anchor.diff:          '';
       };
   
  -  units = pkgs.runCommand "units" { preferLocalBuild = true; }
  -    ''
  +  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/system/$i
  +        fn=${systemd}/example/systemd/${type}/$i
           if ! [ -e $fn ]; then echo "missing $fn"; false; fi
           if [ -L $fn ]; then
             cp -pd $fn $out/
  
positive.code:         startSession = true;
        };
  
      # Provide systemd user units. FIXME: Should make this definable,
      # just like the system units.
      environment.etc."systemd/user".source = "${systemd}/example/systemd/user";
  
      environment.etc."tmpfiles.d/x11.conf".source = "${systemd}/example/tmpfiles.d/x11.conf";
  
      environment.etc."tmpfiles.d/nixos.conf".text =
  
negative.code:                    (v: let n = escapeSystemdPath v.where;
                         in nameValuePair "${n}.automount" (automountToUnit n v)) cfg.automounts);
  
      systemd.user.units =
        mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.user.services;
  
      system.requiredKernelConfig = map config.lib.kernelConfig.isEnabled [
        "CGROUPS" "AUTOFS4_FS" "DEVTMPFS"
      ];
  