anchor.diff:  
     nix = cfg.package.out;
   
  -  isNix112 = versionAtLeast (getVersion nix) "1.12pre";
  +  isNix20 = versionAtLeast (getVersion nix) "2.0pre";
   
     makeNixBuildUser = nr:
       { name = "nixbld${toString nr}";
  
positive.code: 
    nixConf =
      let
        # If we're using sandbox for builds, then provide /bin/sh in
        # the sandbox as a bind-mount to bash. This means we also need to
        # include the entire closure of bash.
        sh = pkgs.stdenv.shell;
        binshDeps = pkgs.writeReferencesToFile sh;
      in
        pkgs.runCommand "nix.conf" {extraOptions = cfg.extraOptions; } ''
          extraPaths=$(for i in $(cat ${binshDeps}); do if test -d $i; then echo $i; fi; done)
          cat > $out <<END
          # WARNING: this file is generated from the nix.* options in
          # your NixOS configuration, typically
          # /etc/nixos/configuration.nix.  Do not edit it!
          build-users-group = nixbld
          build-max-jobs = ${toString (cfg.maxJobs)}
          build-cores = ${toString (cfg.buildCores)}
          build-use-sandbox = ${if (builtins.isBool cfg.useSandbox) then boolToString cfg.useSandbox else cfg.useSandbox}
          build-sandbox-paths = ${toString cfg.sandboxPaths} /bin/sh=${sh} $(echo $extraPaths)
          binary-caches = ${toString cfg.binaryCaches}
          trusted-binary-caches = ${toString cfg.trustedBinaryCaches}
          binary-cache-public-keys = ${toString cfg.binaryCachePublicKeys}
          auto-optimise-store = ${boolToString cfg.autoOptimiseStore}
          ${optionalString cfg.requireSignedBinaryCaches ''
            signed-binary-caches = *
          ''}
          trusted-users = ${toString cfg.trustedUsers}
          allowed-users = ${toString cfg.allowedUsers}
          $extraOptions
          END
        '';
  
negative.code:       { NIX_PATH = concatStringsSep ":" cfg.nixPath;
        };
  
      environment.extraInit = optionalString (!isNix20)
        ''
          # Set up secure multi-user builds: non-root users build through the
          # Nix daemon.
  