Skip to content
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

dunst service: init [wip, stalled] #19183

Closed
wants to merge 17 commits into from
Closed

dunst service: init [wip, stalled] #19183

wants to merge 17 commits into from

Conversation

langston-barrett
Copy link
Contributor

@langston-barrett langston-barrett commented Oct 3, 2016

Motivation for this change

Dunst is a notification server, it should be run all the time 💬

I'm having some trouble getting this working. When I run the command listed in the unit file, it works just fine (with correct settings). However, when I start the unit, it immediately fails without any log output. Could someone with a bit more experience with user units take a look? [edit: this seems to have been fixed by adding Type=dbus]

Bumped into #7326 while creating this... might have to get around to fixing that if I can.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • OS X
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

  • user level service
  • modelled on redshift

@mention-bot
Copy link

@siddharthist, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @bjornfor and @offlinehacker to be potential reviewers.

@joachifm
Copy link
Contributor

joachifm commented Oct 3, 2016

See also #11167

@langston-barrett
Copy link
Contributor Author

langston-barrett commented Oct 3, 2016

I might go ahead and steal commits (if that's alright, @matthiasbeyer) from #11167, looks like it's a more complete rendering of the config file.

 * add plain_text option
 * add a hint of documentation
 * remove unused uid, gid
 * make new service based on upstream, uses Type=dbus
 * don't require dmenu
 * add extraConfig option
 * add package option
@langston-barrett
Copy link
Contributor Author

I think this just needs documentation and a little more testing. Will get back on it tomorrow!

@langston-barrett
Copy link
Contributor Author

Looks like while the notification server is running, it isn't respecting our configuration. When I run the service manually using the command in the unit file, it does respect the configuration. Any ideas @matthiasbeyer? BTW, I'm happy to grant you commit access to my fork if you'd like to work collaboratively on polishing this up.

@matthiasbeyer
Copy link
Contributor

Ah, you already did this! Awesome! Feel free to reuse any of my commits or revert, remove or squash them as you like!

@matthiasbeyer
Copy link
Contributor

BTW, I'm happy to grant you commit access to my fork if you'd like to work collaboratively on polishing this up.

No, I'm happy with either sending you commits to cherry-pick or (what's more likely) let you do the stuff (helping where I can, but my semester starts tomorrow and I'm not sure I can help that much anyways).

description = "Extra configuration to append to the config file.";
};

package = mkOption {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't used and also the override mechanism should be enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@groxxda It is used, check the ExecStart. I modelled it after Redshift, where this is used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but you don't use it for environment.systemPackages.
I still think this option is not necessary (same applies to redshift)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

environment.systemPackages = [ pkgs.dunst ];
systemd.user.services.dunst = {
description = "Dunst: lightweight and customizable notification daemon";
wantedBy = [ "default.target" ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

graphical.target seems like a better fit to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe default.target is used for user services because there is no standard graphical.target, unlike for system services. Havent' checked if we provide such a thing, though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh your absolutely right. i didn't know this difference for user services. sorry for the trouble..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this also makes it a little bit awkward to deal with user services for which a graphical target would make sense (i.e., what happens if user logs into console only).

Restart = "always";
RestartSec = 3;
};
environment.DISPLAY = ":${toString (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought our x would already set this in the user env, but it may be DM specific

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@groxxda This was also modelled after some other services.

dunst = { config, pkgs, ... }: {
services.xserver.enable = true;
services.dunst.enable = true;
environment.systemPackages = [ pkgs.libnotify ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the service itself work without libnotify?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but not the test (which uses notify-send)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay thanks for the explanation 👍

@markus1189
Copy link
Contributor

So what is the current status of this pr? I would be very much interested ;)

@langston-barrett
Copy link
Contributor Author

@markus1189 I'm not working on it anymore since I wasn't able to solve the mentioned issues.

@matthiasbeyer
Copy link
Contributor

I would be interested as well. Can someone sum up what we need to do to get this into the repository?

@Mic92
Copy link
Member

Mic92 commented Jan 3, 2017

@siddharthist can you squash everything into one commit at least for review?

@matthiasbeyer
Copy link
Contributor

@Mic92 seems like @siddharthist does not have his nixpkgs repository anymore. I'm trying to investiate here.

@matthiasbeyer
Copy link
Contributor

@Mic92 please have a look at the "add-dunst-service" branch in my nixpkgs fork. I squashed the commits from this PR and did some formatting of the source. I guess we can start with it, but I do not know how to test services, so it would be nice to get some help.

@Mic92
Copy link
Member

Mic92 commented Jan 3, 2017

@matthiasbeyer I left some notes.

@matthiasbeyer
Copy link
Contributor

@Mic92 yes I added what you've suggested. How can I test whether the service performs correctly? ("test" as in "try out" rather than in "test script").

@langston-barrett
Copy link
Contributor Author

@Mic92 @matthiasbeyer I've been working considerably less on nixpkgs recently, my apologies for not getting back to you sooner. Essentially, I never got dunst starting reliably, and couldn't figure out what was wrong. You're obviously welcome to use anything I've done here if it's helpful.

@langston-barrett
Copy link
Contributor Author

@matthiasbeyer I used to just check out the appropriate branch, and sudo nixos-rebuild switch. However, there is an issue with systemd user services and not getting updated correctly (say, if you make changes to the service definition and rebuild again), but I can't really remember what it is...

@matthiasbeyer
Copy link
Contributor

I guess this one is stalled 😢

@langston-barrett langston-barrett changed the title dunst service: init [wip] dunst service: init [wip, stalled] Jan 30, 2017
@xaverdh xaverdh mentioned this pull request Mar 24, 2019
10 tasks

config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.dunst ];
systemd.user.services.dunst = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, is this systemd service actually used for you? If you are in an X session with a running dunst, and run

$ systemctl --user status dunst.service

does it show as active or inactive? I suspect it will show inactive since this is something I've been having difficulties with in Home Manager.

@c0bw3b
Copy link
Contributor

c0bw3b commented May 18, 2019

Closing this one.
There is more recent work in #58209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet