Service config file outside of /etc?

EDIT: [Resolved]

I’m using gitlab-runner (nixpkgs/gitlab-runner.nix at 386234e2a61e1e8acf94dfa3a3d3ca19a6776efb · NixOS/nixpkgs · GitHub) on a build server running NixOS and have run into some trouble with configuration files that live outside of /etc.

This module writes a config file to /var/lib/... and it looks like if a change to configuration.nix results in a build of gitlab-runner that happens to be cached, nothing happens and the config file from the previous build remains.

I would like to avoid hacky workarounds of modifying arbitrary parameters or deleting cached builds to force a rebuild to deploy the new config file.

I’ve been using NixOS for a few months now but haven’t dug into file management yet past seeing that it’s not terribly simple outside of /etc so I’m unsure of how this is supposed to be happening. Is there a general way to manage files outside /etc correctly in a way that this behavior would not happen. Is anyone able to tell if this is an inherent issue with the gitlab-runner package or if there’s an alternate way of using the module that would be correct in this regard.

Thanks in advance for any help!


Of course 5 minutes after posting this, I realized the config file is generated in the service’s ExecStartPre phase instead of directly by nix. So the behavior that was confusing me was just based on other changes affecting whether the service started after nixos-rebuild.

Hosted by Flying Circus.