|
40 | 40 |
|
41 | 41 | mods = args.mods or [ ]; |
42 | 42 |
|
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 | + }; |
60 | 65 | }; |
61 | | - }; |
62 | | - } |
| 66 | + } |
63 | 67 |
|
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.: |
67 | 71 |
|
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} |
71 | 73 |
|
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: |
73 | 78 |
|
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 | + ''; |
83 | 83 |
|
84 | 84 | desktopItem = makeDesktopItem { |
85 | 85 | name = "factorio"; |
|
155 | 155 | ''; |
156 | 156 | failureHook = '' |
157 | 157 | cat <<EOF |
158 | | - ${helpMsg} |
| 158 | + ${helpMsg { |
| 159 | + dlName = if candidateHashFilenames != [ ] then builtins.head candidateHashFilenames else name; |
| 160 | + storeName = name; |
| 161 | + }} |
159 | 162 | EOF |
160 | 163 | ''; |
161 | 164 | }) |
|
0 commit comments