diff --git a/pkgs/games/factorio/default.nix b/pkgs/games/factorio/default.nix index 0226acf1604..e5527c9d4ef 100644 --- a/pkgs/games/factorio/default.nix +++ b/pkgs/games/factorio/default.nix @@ -104,10 +104,15 @@ let ]; }) (_: { # This preHook hides the credentials from /proc - preHook = '' - echo -n "${username}" >username - echo -n "${token}" >token - ''; + preHook = + if username != "" && token != "" then '' + echo -n "${username}" >username + echo -n "${token}" >token + '' else '' + # Deliberately failing since username/token was not provided, so we can't fetch. + # We can't use builtins.throw since we want the result to be used if the tar is in the store already. + exit 1 + ''; failureHook = '' cat <