Skip to content

Commit 9855f26

Browse files
authored
factorio: use real instead of sample in download help; warn about credentials in store (#351555)
2 parents a5af1da + 5c358db commit 9855f26

File tree

1 file changed

+39
-36
lines changed

1 file changed

+39
-36
lines changed

pkgs/by-name/fa/factorio/package.nix

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,46 +40,46 @@ let
4040

4141
mods = args.mods or [ ];
4242

43-
helpMsg = ''
44-
45-
===FETCH FAILED===
46-
Please ensure you have set the username and token with config.nix, or
47-
/etc/nix/nixpkgs-config.nix if on NixOS.
48-
49-
Your token can be seen at https://factorio.com/profile (after logging in). It is
50-
not as sensitive as your password, but should still be safeguarded. There is a
51-
link on that page to revoke/invalidate the token, if you believe it has been
52-
leaked or wish to take precautions.
53-
54-
Example:
55-
{
56-
packageOverrides = pkgs: {
57-
factorio = pkgs.factorio.override {
58-
username = "FactorioPlayer1654";
59-
token = "d5ad5a8971267c895c0da598688761";
43+
helpMsg =
44+
{ dlName, storeName }:
45+
''
46+
47+
===FETCH FAILED===
48+
Please ensure you have set the username and token with config.nix, or
49+
/etc/nix/nixpkgs-config.nix if on NixOS.
50+
51+
Your token can be seen at https://factorio.com/profile (after logging in).
52+
Beware this will add the credentials to the Nix store, which is
53+
world-readable on the local machine. It is not as sensitive as your
54+
password, but should still be safeguarded. There is a link on that page to
55+
revoke/invalidate the token, if you believe it has been leaked or wish to
56+
take precautions.
57+
58+
Example:
59+
{
60+
packageOverrides = pkgs: {
61+
factorio = pkgs.factorio.override {
62+
username = "FactorioPlayer1654";
63+
token = "d5ad5a8971267c895c0da598688761";
64+
};
6065
};
61-
};
62-
}
66+
}
6367
64-
Alternatively, instead of providing the username+token, you may manually
65-
download the release through https://factorio.com/download , then add it to
66-
the store using e.g.:
68+
Alternatively, instead of providing the username+token, you may manually
69+
download the release through https://factorio.com/download , then add it to
70+
the store using e.g.:
6771
68-
releaseType=alpha
69-
version=0.17.74
70-
nix-prefetch-url file://\''$HOME/Downloads/factorio_\''${releaseType}_x64_\''${version}.tar.xz --name factorio_\''${releaseType}_x64-\''${version}.tar.xz
72+
nix-prefetch-url file://\''$HOME/Downloads/${dlName} --name ${storeName}
7173
72-
Note the ultimate "_" is replaced with "-" in the --name arg!
74+
If you go this route you might want to tell Nix to explicitly hold on to the
75+
source tarball. Otherwise it could get GC'd from the Nix store and you'd
76+
have to redownload it next time the package wants to rebuild to use a newer
77+
dependency. E.g. if you're using NixOS:
7378
74-
If you go this route you might want to tell Nix to explicitly hold on to the
75-
source tarball. Otherwise it could get GC'd from the Nix store and you'd
76-
have to redownload it next time the package wants to rebuild to use a newer
77-
dependency. E.g. if you're using NixOS:
78-
79-
system.extraDependencies = [
80-
factorio.src
81-
];
82-
'';
79+
system.extraDependencies = [
80+
factorio.src
81+
];
82+
'';
8383

8484
desktopItem = makeDesktopItem {
8585
name = "factorio";
@@ -155,7 +155,10 @@ let
155155
'';
156156
failureHook = ''
157157
cat <<EOF
158-
${helpMsg}
158+
${helpMsg {
159+
dlName = if candidateHashFilenames != [ ] then builtins.head candidateHashFilenames else name;
160+
storeName = name;
161+
}}
159162
EOF
160163
'';
161164
})

0 commit comments

Comments
 (0)