New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/systemd: Allow to override serviceConfig #41446
Conversation
This has been reported by @qknight in his Stack Overflow question: https://stackoverflow.com/q/50678639 The correct way to override a single value would be to use something like this: systemd.services.nagios.serviceConfig.Restart = lib.mkForce "no"; However, this doesn't work because the check is applied for the attrsOf type and thus the attribute values might still contain the attribute set created by mkOverride. The unitOption type however did already account for this, but at this stage it's already too late. So now the actual value is unpacked while checking the values of the attribute set, which should allow us to override values in serviceConfig. Signed-off-by: aszlig <aszlig@nix.build> Cc: @edolstra, @qknight
Hi all, is there currently a possible workaround while we wait for this fix to be released? |
@4levels: This has been merged more than a year ago already. |
Hi @aszlig, this surprises me as I'm still running in exactly the same issue as described in the SO question here: https://stackoverflow.com/questions/50678639/how-to-change-the-serviceconfig-of-a-service-defined-in-nixpkgs-from-configurati If I try to set the I'm using the 19.03 channel.. I'm already setting a lot of |
Did you try to override just the restart option, as suggested by OP?
|
Ok, I managed to get around it, like so:
where the So if I do it in one go, this works. If I try however to set the kibana serviceconfig afterwards, I'm stuck.
|
@4levels: Mhm, as @jtojnar mentioned, (import "${fetchTarball channel:nixos-19.03}/nixos" {
configuration = { lib, ... }: {
systemd.services.kibana.serviceConfig.ExecStart = lib.mkForce "foo";
};
}).config.system.build.units."kibana.service" |
Hi @aszlig, I guess it's because I'm already setting the |
This has been reported by @qknight in his Stack Overflow question:
https://stackoverflow.com/q/50678639
The correct way to override a single value would be to use something like this:
However, this doesn't work because the check is applied for the
attrsOf
type and thus the attribute values might still contain the attribute set created bymkOverride
.The
unitOption
type however did already account for this, but at this stage it's already too late.So now the actual value is unpacked while checking the values of the attribute set, which should allow us to override values in
serviceConfig
.Cc: @edolstra, @qknight