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

Add networkd notify #21593

Closed
wants to merge 2 commits into from

Conversation

matthiasbeyer
Copy link
Contributor

Motivation for this change

I want to have this... so I started to implement a package for it.

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
    • macOS
    • 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.

This is one of the first services I write, so please tell me what to improve etc. It is not tested yet, though (as I do not know how to).

@matthiasbeyer
Copy link
Contributor Author

Waiting for wavexx/networkd-notify#1


installPhase = ''
mkdir -p $out/bin
ls
Copy link
Member

Choose a reason for hiding this comment

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

leftover?

{ stdenv, pythonPackages, fetchFromGitHub }:

pythonPackages.buildPythonPackage rec {
name = "networkd-notify-${version}";
Copy link
Member

Choose a reason for hiding this comment

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

Please use the following notation for unstable packages:

name = "networkd-notify-unstable-2016-05-17";

mkdir -p $out/bin
ls
cp networkd-notify $out/bin/
chmod +x $out/bin/networkd-notify
Copy link
Member

Choose a reason for hiding this comment

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

install -m755 networkd-notify $out/bin/networkd-notify


systemd.services.networkd-notify = {
description = "networkd desktop notification";
wantedBy = [ "multi-user.target" ];
Copy link
Member

@Mic92 Mic92 Jan 3, 2017

Choose a reason for hiding this comment

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

Does a system service running as root find a user dbus session? (I have not tried it out yet - but it surprises me).
How is the service supposed to work? There is no ExecStart here. I think you probably want a user service here.

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 I don't know how to do it :-)

Copy link
Member

Choose a reason for hiding this comment

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

You need to run it as a user service:

systemd.user.services.networkd-notify vs systemd.services.networkd-notify

That also means multi-user.target is not available. With systemd 232 soon entering master, that should instead be graphical-session.target.

@matthiasbeyer
Copy link
Contributor Author

I also need some help with the package itself. I was told that "gi" (the dependency) is the "python Gobject-Introspection package", though I do not find it in nixpkgs (python-gobject2/3 does not work). Ideas?

@@ -16,6 +16,7 @@ pythonPackages.buildPythonPackage rec {
phases = [ "unpackPhase" "installPhase" ];

installPhase = ''
mkdir -p $out/bin/
install -m755 networkd-notify $out/bin/networkd-notify
Copy link
Member

Choose a reason for hiding this comment

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

you can also use "-D" for install instead of the "mkdir".

@matthiasbeyer
Copy link
Contributor Author

Done. I still don't know what the "python-gobject" thing should be ... so there's still a dependency missing here.

@7c6f434c
Copy link
Member

Hm, maybe factor out just the package so that it can be merged? Or is the service also working by now?


systemd.services.networkd-notify = {
description = "networkd desktop notification";
wantedBy = [ "multi-user.target" ];
Copy link
Member

Choose a reason for hiding this comment

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

You need to run it as a user service:

systemd.user.services.networkd-notify vs systemd.services.networkd-notify

That also means multi-user.target is not available. With systemd 232 soon entering master, that should instead be graphical-session.target.

propagatedBuildInputs = with pythonPackages; [ dbus-python ];

phases = [ "unpackPhase" "installPhase" ];

Copy link
Member

Choose a reason for hiding this comment

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

Any reason not to run fixupPhase to patch the interpreter?

Copy link
Member

Choose a reason for hiding this comment

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

Upstream also has a number of hardcoded file names - we probably need to replace those /usr/bin/networkctl and /usr/bin/iwconfig.

sha256 = "006d8qmmk0jg0a3fbl2q934wmmhx9n7c156i34i9zgzapdhhacq6";
};

propagatedBuildInputs = with pythonPackages; [ dbus-python ];
Copy link
Member

Choose a reason for hiding this comment

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

Upstream mentions other dependencies:

The following software is currently required for networkd-notify:
Python (3.x or 2.7)
PyGObject/PyGI (python-gi)
Python D-Bus (python-dbus)
wireless-tools

@matthiasbeyer
Copy link
Contributor Author

Stalled.

@matthiasbeyer matthiasbeyer deleted the add-networkd-notify branch October 14, 2017 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants