anchor.diff:        '';
       };
     };
  +
   in stdenv.mkDerivation (releases.${releaseType})
  
positive.code: , username ? "" , password ? ""
  }:
  
  assert releaseType == "alpha" || releaseType == "headless" || releaseType == "demo";
  
  with stdenv.lib;
  let
    version = if releaseType != "demo" then "0.15.33" else "0.15.33";
  
    arch = if stdenv.system == "x86_64-linux" then {
      inUrl = "linux64";
      inTar = "x64";
    } else if stdenv.system == "i686-linux" then {
      inUrl = "linux32";
      inTar = "i386";
    } else abort "Unsupported platform";
  
    authenticatedFetch = callPackage ./fetch.nix { inherit username password; };
  
    fetch = rec {
      url = "https://www.factorio.com/get-download/${version}/${releaseType}/${arch.inUrl}";
      name = "factorio_${releaseType}_${arch.inTar}-${version}.tar.xz";
      x64 = {
        headless =           fetchurl { inherit name url; sha256 = "17x0dlmfd7jwmpmn5i8wag28rl01iysqz3ri6g6msxjnvj5l6byn"; };
        alpha    = authenticatedFetch { inherit name url; sha256 = "1m2r0n99ngqq47s9fzr09d347i15an6x9v1qlij8yf8w7lyrdy4z"; };
        demo     =           fetchurl { inherit name url; sha256 = "03nwn4838yhqq0r76pf2m4wxi32rsq0knsxmq3qq4ycji89q1dyc"; };
      };
      i386 = {
        headless = abort "Factorio 32-bit headless binaries are not available for download.";
        alpha    = abort "Factorio 32-bit client is not available for this version.";
        demo     = abort "Factorio 32-bit demo binaries are not available for download.";
      };
    };
  
    configBaseCfg = ''
      use-system-read-write-data-directories=false
  
negative.code:         wrapProgram $out/bin/factorio                                \
            --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath \
            --run "$out/share/factorio/update-config.sh"               \
            --argv0 ""                                                 \
            --add-flags "-c \$HOME/.factorio/config.cfg"               \
            ${if mods!=[] then "--add-flags --mod-directory=${modDir}" else ""}
  
            # TODO Currently, every time a mod is changed/added/removed using the
            # modlist, a new derivation will take up the entire footprint of the
  