From fff8abc77b4b73dbeed8c2fbc909c00a3f86ee70 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 26 Oct 2024 23:29:53 -0400 Subject: [PATCH 1/2] 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. --- pkgs/by-name/fa/factorio/package.nix | 73 ++++++++++++++-------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/pkgs/by-name/fa/factorio/package.nix b/pkgs/by-name/fa/factorio/package.nix index 82952186d86ee..665c9b729c387 100644 --- a/pkgs/by-name/fa/factorio/package.nix +++ b/pkgs/by-name/fa/factorio/package.nix @@ -40,46 +40,44 @@ let mods = args.mods or [ ]; - helpMsg = '' - - ===FETCH FAILED=== - Please ensure you have set the username and token with config.nix, or - /etc/nix/nixpkgs-config.nix if on NixOS. - - Your token can be seen at https://factorio.com/profile (after logging in). It is - not as sensitive as your password, but should still be safeguarded. There is a - link on that page to revoke/invalidate the token, if you believe it has been - leaked or wish to take precautions. - - Example: - { - packageOverrides = pkgs: { - factorio = pkgs.factorio.override { - username = "FactorioPlayer1654"; - token = "d5ad5a8971267c895c0da598688761"; + helpMsg = + { dlName, storeName }: + '' + + ===FETCH FAILED=== + Please ensure you have set the username and token with config.nix, or + /etc/nix/nixpkgs-config.nix if on NixOS. + + Your token can be seen at https://factorio.com/profile (after logging in). It is + not as sensitive as your password, but should still be safeguarded. There is a + link on that page to revoke/invalidate the token, if you believe it has been + leaked or wish to take precautions. + + Example: + { + packageOverrides = pkgs: { + factorio = pkgs.factorio.override { + username = "FactorioPlayer1654"; + token = "d5ad5a8971267c895c0da598688761"; + }; }; - }; - } + } - Alternatively, instead of providing the username+token, you may manually - download the release through https://factorio.com/download , then add it to - the store using e.g.: + Alternatively, instead of providing the username+token, you may manually + download the release through https://factorio.com/download , then add it to + the store using e.g.: - releaseType=alpha - version=0.17.74 - nix-prefetch-url file://\''$HOME/Downloads/factorio_\''${releaseType}_x64_\''${version}.tar.xz --name factorio_\''${releaseType}_x64-\''${version}.tar.xz + nix-prefetch-url file://\''$HOME/Downloads/${dlName} --name ${storeName} - Note the ultimate "_" is replaced with "-" in the --name arg! + If you go this route you might want to tell Nix to explicitly hold on to the + source tarball. Otherwise it could get GC'd from the Nix store and you'd + have to redownload it next time the package wants to rebuild to use a newer + dependency. E.g. if you're using NixOS: - If you go this route you might want to tell Nix to explicitly hold on to the - source tarball. Otherwise it could get GC'd from the Nix store and you'd - have to redownload it next time the package wants to rebuild to use a newer - dependency. E.g. if you're using NixOS: - - system.extraDependencies = [ - factorio.src - ]; - ''; + system.extraDependencies = [ + factorio.src + ]; + ''; desktopItem = makeDesktopItem { name = "factorio"; @@ -155,7 +153,10 @@ let ''; failureHook = '' cat < Date: Sat, 26 Oct 2024 23:35:02 -0400 Subject: [PATCH 2/2] factorio: note that credentials will be world-readable in help msg --- pkgs/by-name/fa/factorio/package.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/fa/factorio/package.nix b/pkgs/by-name/fa/factorio/package.nix index 665c9b729c387..917c7a2bfb3ab 100644 --- a/pkgs/by-name/fa/factorio/package.nix +++ b/pkgs/by-name/fa/factorio/package.nix @@ -48,10 +48,12 @@ let Please ensure you have set the username and token with config.nix, or /etc/nix/nixpkgs-config.nix if on NixOS. - Your token can be seen at https://factorio.com/profile (after logging in). It is - not as sensitive as your password, but should still be safeguarded. There is a - link on that page to revoke/invalidate the token, if you believe it has been - leaked or wish to take precautions. + Your token can be seen at https://factorio.com/profile (after logging in). + Beware this will add the credentials to the Nix store, which is + world-readable on the local machine. It is not as sensitive as your + password, but should still be safeguarded. There is a link on that page to + revoke/invalidate the token, if you believe it has been leaked or wish to + take precautions. Example: {