-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add multiple accounts support to himalaya-watch #5069
Comments
@soywod you probably want to add such a template service to |
I thought about this last time, it is a very good point!
You can name the default account with the special string "default", so technically you can have a unit
I like your idea of template unit, it fits well the need in my opinion.
This may be a pain point. What about letting users mapping their own names? Instead of
In which form do you see this addition? As a template file in |
O.O Then I'll add that to the module's documentation.
That would work if we are not using a systemd template, the template passes everthing after the @ to the unit (i.e.
In |
I am using `--account %i` so it is required for it to be the account
name (which is why I thought about not using the template service).
I understand better. How do you imagine the version without template?
In `assets` so that other packages can make use of it benefiting
people not using NixOS.
It makes sense, feel free to send a git patch whenever you want :)
|
I imagine enumerating the accounts and creating a unit for each one of them.
Already did c: |
I imagine enumerating the accounts and creating a unit for each one of
them.
But you would not have the same issue with the unit names?
Already did c:
How fast :D thanks a lot!
|
I was planning to assing them sequential numbers:
It's not very nice, but it fixes the issue... |
Just did a quick search, and there is You can do I don't know how to hook it into nix, but it should probably be added to the himalaya docs if you ship the template service. |
Just did a quick search, and there is `systemd-escape`.
So great!
I don't know how to hook it into nix, […]
Good point, I don't see how to call this program from within Nix code. I
tried to search for modules in nixpkgs solving this issue but I did not
find anything relevant.
I have 2 ideas coming to my mind:
1. We let the user setting up the unit name in a set "{ account-name =
unit-name; }", this way we can build multiple services
"himalaya-watch.<unit-name>.service",
or,
The "unit name prefix" must consist of one or more valid characters
(ASCII letters, digits, ":", "-", "_", ".", and "\")
2. we develop our own Nix function to escape unit names, for example
replacing all invalid chars by "-". This way we can use systemd
templates. We can just explain in the doc that unit names are
kebab-case-like version of account names.
but it should probably be added to the himalaya docs if you ship the
template service.
Totally agree, we can even add an example with systemd-escape.
|
As discussed in <nix-community/home-manager#5069>. I set `ExecStart=%install_dir%/himalaya` so when packaging himalaya people nee to explicitly set the path to himalaya (i.e. `sed 's:%install_dir%:/usr/bin:' assets/himalaya-watch@.service`). This is done automatically in `install.sh` if `$PREFIX` is `/usr`, Otherwise the packager should handle it themselves For `nix` it would be (`sed 's:%install_dir%:$out/bin:' assets/himalaya-watch@.service`). I don't know where it should be placed (probably `$out/share/systemd/user` as nix will add that to `$XDG_DATA_DIRS` which is searched by `systemctl --user`. I swear I checked the address like 4 times before sending the email, I have no idea how I managed to mess it up T-T. I was wondering why the formatting was so messed up in sr.ht.
The new
I would love your feedback. I open the issue as draft, as I also plan to integrate |
I'm struggling to find time, but I'll take a look when I can! |
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 you are the original author of the issue
If you are not the original author of the issue
Memorandum on closing issuesDon'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. |
I fully forgot about this; himalaya 1.0.0-beta4 has an open bug with some email accounts which affects me so I wasn't able to test it. Sorry about the radio silence. |
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 you are the original author of the issue
If you are not the original author of the issue
Memorandum on closing issuesDon'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. |
While |
You can re-open, the |
I'll reopen it then c: I'll check v1 when it come out |
The Side note, as stated in #5297 (comment), HM does not play well with template units, so we will probably fall back to one unit per registered account. |
Description
Currently
services.himalaya-watch
only supports selecting a single account to watch for changes, I have multiple accounts using himalaya and I would like to watch all of them.I tried my hand at a patch, but the way I set it up you cannot replicate the behavior of choosing the primary account by default (you need to specify all by name):
himalaya-watch patch
This would remove the need for the
enable
option too (it would be enabled ifaccounts
is non-empty). Currently it uses template unit, so theenable
option does allow for people to dynamically enable more accounts usingsystemctl --user enable --now himalaya-watch@$account.service
, but I am thinking it should be better to directly write the services instead of using a template unit.Another thing I am considering is how to escape characters; right now my accounts are named after the email address I use (i.e.
jalil@example.org
) and if I remember correctly, systemd wants those characters (.
and@
) to be escaped and hex encoded (himalaya-watch@jalil\x40example\x46org.service
).The text was updated successfully, but these errors were encountered: