Open devurandom opened 6 months ago
It seems like HM doesn't have built-in support for drop-in files, so I've been creating them like this:
xdg.configFile."systemd/user/my.service.d/overrides.conf".text = ''
[Service]
EnvironmentFile=.../env
'';
Thanks! It worked:
xdg.configFile."systemd/user/my.service.d/99-env.conf" = let
envFile = pkgs.writeTextDir "override.env" ''
VAR_A=1
VAR_B=2
'';
in {
text = ''
[Service]
EnvironmentFile=${envFile}/override.env
'';
};
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Description
NixOS allows defining
foo.service.d
drop in files usingsystemd.user.services.<name>.overrideStrategy
. How do I do the same with home-manager?I tried various things, but do not get the result I would expect, a
~/.config/systemd/user/foo.service.d/override.conf
file containing:causes:
creates
~/.config/systemd/user/foo.service
:which overrides the whole
foo.service
installed by NixOS.creates
~/.config/systemd/user/foo.service
:which again overrides the whole
foo.service
installed by NixOS.causes:
I also skimmed through https://github.com/nix-community/home-manager/blob/44677a1c96810a8e8c4ffaeaad10c842402647c1/modules/systemd.nix but could not figure out how systemd service drop-ins are supposed to work.
My
flake.nix
: