Open ldorigo opened 2 years ago
I also tried putting the three directories inside a common systemd/
directory and doing:
- link:
~/.config/systemd/user/:
glob: true
path: systemd/**
But it doesn't work - it only links the directories, so systemd/services
and systemd/timers
, not the files in those directories. So the documentation is wrong (docs say "** matches any file, recursively").
And doing:
- link:
~/.config/systemd/user/:
glob: true
path: systemd/**/*
Also doesn't work, it does link all the files but still within the folder structure (so it creates ~/.config/systemd/user/services/a.service
, ~/.config/systemd/user/services/b.service
, etc.)
I took a look at the source code, seems like this is due to a limitation of Yaml/Json - the destination paths are used as keys, and there can't be duplicate keys. This means it's not completely trivial to solve it, I see two possibilities:
Links
plugin. But I'm not familiar enough with the codebase to see possible pitfalls.
So my example would become:
- link:
~/.config/systemd/user:
path:
- services/*
- timers/*
glob: true
I think (1) is better - (2) is very specific to this usecase and could be confusing, while (1) is quite explicit (you need to pass a list of directories by hand). If you approve I can submit a PR later.
Wanted to get this working so I added a PR, let me know if there's any problems with it
Related to this point: note to self, maybe we should add an explanation of this to the documentation, that the yaml key: value
pairs don't support duplicate keys.
I only skimmed the PR… just wanted to drop my usual work around for duplicated YAML keys:
- link:
~/.config/systemd/user:
path: services/*
glob: true
- link:
~/.config/systemd/user:
path: timers/*
glob: true
Hi, I have two directories in my dotfiles:
/services
(systemd services that need to start on boot) and/timers
(systemd timers with corresponding units). I want both to be linked into~/.config/systemd/user
.I tried doing:
But it looks like it only links the second one (timers), not the first. Any workaround? (I can't just put them all into the same folder because I am also starting them up with dotbot - for services I need to start/enable the .service file, and for timers only the
.timer
file).