summaryrefslogtreecommitdiffstats
path: root/pkgs/games/factorio
diff options
context:
space:
mode:
authorPavol Rusnak <pavol@rusnak.io>2020-11-24 23:33:55 +0100
committerGitHub <noreply@github.com>2020-11-24 23:33:55 +0100
commit2b884eb9f698e8ef0bd45fa682a030c8a0e0ad2f (patch)
tree7e2f8d38a05a1b90a4bcb8ef78314b735e46e205 /pkgs/games/factorio
parent0c6fc3c05e1dc3a27676a3c95432da0754a1e2bf (diff)
parent86aa2a57d3a60d68af8689c4a1eb4da306f90c98 (diff)
Merge pull request #104732 from lukegb/factorio-fail-if-no-creds
factorio: fail fetch early if no credentials provided
Diffstat (limited to 'pkgs/games/factorio')
-rw-r--r--pkgs/games/factorio/default.nix13
1 files changed, 9 insertions, 4 deletions
diff --git a/pkgs/games/factorio/default.nix b/pkgs/games/factorio/default.nix
index 0e2592de919e..6feac05309ca 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 <<EOF
${helpMsg}