As you may know, there’s a factorio package in the nixpkgs. From my understanding and a few talks with LLMs, I know there’re 2 ways to use it: Overwriting the package with your username and factorio token (But the token will leak to the nix store and will be visible in your config) or manually putting factorio tarball in the nix store (which is not ideal from the nixos philosophy perspective.
I could be fine with my token being in the nix store, so I crafted this setup:
In my opinion, factorio should rewritten to use requireFile and require manually adding the tarball to the store, exactly how it is done with all the other packages that require logging in before download.
An alternative that definitely leaks your token and also is resistant against updates, would be to install steam and play factorio through steam.
IIRC factorio can be installed in 2 ways, with requireFile as you described and with user credentials. Former is against nixos philosophy and common sense and latter is unsafe.
Steam installation isn’t better than the requireFile way, but it requires you to install one more proprietary package on your system.
Write a wrapper script around nixos-rebuild that populates the required store path for requireFile (using credentials from the running environment, however you prefer to do that) before building.
If you don’t mind your factorio credentials going onto your disk world-readable, so long as they stay out of the public config, you can use git-crypt to store them in the config so they’re available at eval time, but not to the public.
I do not see how the former is against the philosophy. It clearly states “I need this but can not get it for you, you have to help me”. The NixOS philosophy is not a “oneclick” install. It is describing what you want want as an endresult, without having to (necessarily) care how to achieve some things.