I want to use nixos’s services.terraria to start a terraria server, but I want to use pkgs.tshock as the server exec. In the sourceterraria.nix I see this:
systemd.services.terraria = {
description = "Terraria Server Service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
User = "terraria";
Group = "terraria";
Type = "forking";
GuessMainPID = true;
UMask = 7;
ExecStart = "${tmuxCmd} new -d ${pkgs.terraria-server}/bin/TerrariaServer ${lib.concatStringsSep " " flags}";
ExecStop = "${stopScript} $MAINPID";
};
};
Sure you can set systemd.services.terraria.serviceConfig.ExecStart directly, but you need to provide it as a list and “clear” the existing command by setting "" as the first command in the list.
is a bit cleaner. No need to use counterintuitive systemd-specific features just to clear a list that’s properly encoded
Defining too much with let is arguably a bit of a code smell for exactly this reason, values defined in let blocks cannot be interacted with downstream. You can only touch stuff that ends up in the options or config attrsets.
If you want to expose this value (perhaps through a read-only option, or maybe by adding support for changing the binary by adding a services.terraria.package option so that you can just change the terraria package the module uses), I’m sure a PR is welcome.