Skip to content

Commit fff8abc

Browse files
committed
factorio: use actual args instead of sample in download help
Makes it easier for the user since they should no longer have to manually replace things. Remove the note about the name as it may no longer be true, and the user now has to care less since the values are more easily copy-pastable.
1 parent 88195a9 commit fff8abc

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

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

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,46 +40,44 @@ 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). It is
52+
not as sensitive as your password, but should still be safeguarded. There is a
53+
link on that page to revoke/invalidate the token, if you believe it has been
54+
leaked or wish to take precautions.
55+
56+
Example:
57+
{
58+
packageOverrides = pkgs: {
59+
factorio = pkgs.factorio.override {
60+
username = "FactorioPlayer1654";
61+
token = "d5ad5a8971267c895c0da598688761";
62+
};
6063
};
61-
};
62-
}
64+
}
6365
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.:
66+
Alternatively, instead of providing the username+token, you may manually
67+
download the release through https://factorio.com/download , then add it to
68+
the store using e.g.:
6769
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
70+
nix-prefetch-url file://\''$HOME/Downloads/${dlName} --name ${storeName}
7171
72-
Note the ultimate "_" is replaced with "-" in the --name arg!
72+
If you go this route you might want to tell Nix to explicitly hold on to the
73+
source tarball. Otherwise it could get GC'd from the Nix store and you'd
74+
have to redownload it next time the package wants to rebuild to use a newer
75+
dependency. E.g. if you're using NixOS:
7376
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-
'';
77+
system.extraDependencies = [
78+
factorio.src
79+
];
80+
'';
8381

8482
desktopItem = makeDesktopItem {
8583
name = "factorio";
@@ -155,7 +153,10 @@ let
155153
'';
156154
failureHook = ''
157155
cat <<EOF
158-
${helpMsg}
156+
${helpMsg {
157+
dlName = if candidateHashFilenames != [ ] then builtins.head candidateHashFilenames else name;
158+
storeName = name;
159+
}}
159160
EOF
160161
'';
161162
})

0 commit comments

Comments
 (0)