diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index bbf016194efe..63d8385eeb36 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -752,6 +752,11 @@ github = "calbrecht"; name = "Christian Albrecht"; }; + callahad = { + email = "dan.callahan@gmail.com"; + github = "callahad"; + name = "Dan Callahan"; + }; calvertvl = { email = "calvertvl@gmail.com"; github = "calvertvl"; diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 8a9a936d3b20..c0ba2485b082 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -284,6 +284,7 @@ ./services/hardware/acpid.nix ./services/hardware/actkbd.nix ./services/hardware/bluetooth.nix + ./services/hardware/bolt.nix ./services/hardware/brltty.nix ./services/hardware/freefall.nix ./services/hardware/fwupd.nix diff --git a/nixos/modules/services/hardware/bolt.nix b/nixos/modules/services/hardware/bolt.nix new file mode 100644 index 000000000000..32b60af06037 --- /dev/null +++ b/nixos/modules/services/hardware/bolt.nix @@ -0,0 +1,34 @@ +# Thunderbolt 3 device manager + +{ config, lib, pkgs, ...}: + +with lib; + +{ + options = { + + services.hardware.bolt = { + + enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable Bolt, a userspace daemon to enable + security levels for Thunderbolt 3 on GNU/Linux. + + Bolt is used by GNOME 3 to handle Thunderbolt settings. + ''; + }; + + }; + + }; + + config = mkIf config.services.hardware.bolt.enable { + + environment.systemPackages = [ pkgs.bolt ]; + services.udev.packages = [ pkgs.bolt ]; + systemd.packages = [ pkgs.bolt ]; + + }; +} diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 7544ba4638ac..31ff60019aea 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -151,6 +151,7 @@ in { services.colord.enable = mkDefault true; services.packagekit.enable = mkDefault true; hardware.bluetooth.enable = mkDefault true; + services.hardware.bolt.enable = mkDefault true; services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center services.udev.packages = [ pkgs.gnome3.gnome-settings-daemon ]; systemd.packages = [ pkgs.gnome3.vino ]; diff --git a/pkgs/development/python-modules/python-dbusmock/default.nix b/pkgs/development/python-modules/python-dbusmock/default.nix new file mode 100644 index 000000000000..bee0cab0a3f5 --- /dev/null +++ b/pkgs/development/python-modules/python-dbusmock/default.nix @@ -0,0 +1,59 @@ +{ lib, buildPythonPackage, fetchPypi, + nose, dbus, dbus-python, pygobject3, + which, pyflakes, pycodestyle, bluez, networkmanager +}: + +buildPythonPackage rec { + pname = "python-dbusmock"; + version = "0.18.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "1hj02p65cic4jdc6a5xf1hx8j5icwy7dcrm5kg91lkjks4gwpg5h"; + }; + + prePatch = '' + sed -i -e 's|pyflakes3|pyflakes|g' tests/test_code.py; + ''; + + # TODO: Get the rest of these tests running? + # This is a mocking library used as a check dependency for a single derivation. + # That derivation's tests pass. Maybe not worth the effort to fix these... + NOSE_EXCLUDE = lib.concatStringsSep "," [ + "test_bluez4" # NixOS ships BlueZ5 + # These appear to fail because they're expecting to run in an Ubuntu chroot? + "test_everything" # BlueZ5 OBEX + "test_polkitd" + "test_consolekit" + "test_api" + "test_logind" + "test_notification_daemon" + "test_ofono" + "test_gnome_screensaver" + "test_cli" + "test_timedated" + "test_upower" + # Very slow, consider disabling? + # "test_networkmanager" + ]; + + checkInputs = [ + nose dbus dbus-python which pycodestyle pyflakes + pygobject3 bluez bluez.test networkmanager + ]; + + checkPhase = '' + runHook preCheck + export PATH="$PATH:${bluez.test}/test"; + nosetests -v + runHook postCheck + ''; + + meta = with lib; { + description = "Mock D-Bus objects for tests"; + homepage = https://github.com/martinpitt/python-dbusmock; + license = licenses.lgpl3Plus; + maintainers = with maintainers; [ callahad ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/os-specific/linux/bolt/0001-skip-mkdir.patch b/pkgs/os-specific/linux/bolt/0001-skip-mkdir.patch new file mode 100644 index 000000000000..0853bcea9167 --- /dev/null +++ b/pkgs/os-specific/linux/bolt/0001-skip-mkdir.patch @@ -0,0 +1,12 @@ +diff --git a/scripts/meson-install.sh b/scripts/meson-install.sh +index 859ae81..05a1c58 100644 +--- a/scripts/meson-install.sh ++++ b/scripts/meson-install.sh +@@ -7,5 +7,5 @@ fi + + BOLT_DBDIR=$1 + +-echo "Creating database dir: ${BOLT_DBDIR}" +-mkdir -p "${DESTDIR}/${BOLT_DBDIR}" ++# echo "Creating database dir: ${BOLT_DBDIR}" ++# mkdir -p "${DESTDIR}/${BOLT_DBDIR}" diff --git a/pkgs/os-specific/linux/bolt/default.nix b/pkgs/os-specific/linux/bolt/default.nix new file mode 100644 index 000000000000..f57fb1310c67 --- /dev/null +++ b/pkgs/os-specific/linux/bolt/default.nix @@ -0,0 +1,61 @@ +{ stdenv, meson, ninja, pkgconfig, fetchFromGitLab, + python3, umockdev, gobject-introspection, dbus, + asciidoc, libxml2, libxslt, docbook_xml_dtd_45, docbook_xsl, + glib, systemd, polkit +}: + +stdenv.mkDerivation rec { + pname = "bolt"; + version = "0.7"; + + src = fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + owner = "bolt"; + repo = "bolt"; + rev = "${version}"; + sha256 = "0xn2c31kcjh1j76gq1qrcxwjyjyqnsxygkfrvh3xk07qc92f99xd"; + }; + + nativeBuildInputs = [ + meson ninja pkgconfig + asciidoc libxml2 libxslt docbook_xml_dtd_45 docbook_xsl + ] ++ stdenv.lib.optional (!doCheck) python3; + + buildInputs = [ + glib systemd polkit + ]; + + doCheck = true; + + preCheck = '' + export LD_LIBRARY_PATH=${umockdev.out}/lib/ + ''; + + checkInputs = [ + dbus umockdev gobject-introspection + (python3.withPackages + (p: [ p.pygobject3 p.dbus-python p.python-dbusmock ])) + ]; + + # meson install tries to create /var/lib/boltd + patches = [ ./0001-skip-mkdir.patch ]; + + postPatch = '' + patchShebangs tests/test-integration + ''; + + mesonFlags = [ + "-Dlocalstatedir=/var" + ]; + + PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "${placeholder "out"}/lib/systemd/system"; + PKG_CONFIG_UDEV_UDEVDIR = "${placeholder "out"}/lib/udev"; + + meta = with stdenv.lib; { + description = "Thunderbolt 3 device management daemon"; + homepage = https://gitlab.freedesktop.org/bolt/bolt; + license = licenses.lgpl21Plus; + maintainers = [ maintainers.callahad ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1bbbbdcea03e..0f1ab70d6178 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14281,6 +14281,8 @@ in inherit (python3Packages) bedup; + bolt = callPackage ../os-specific/linux/bolt { }; + bridge-utils = callPackage ../os-specific/linux/bridge-utils { }; busybox = callPackage ../os-specific/linux/busybox { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 24c2110403d8..0077482ab17e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -720,6 +720,8 @@ in { python-binance = callPackage ../development/python-modules/python-binance { }; + python-dbusmock = callPackage ../development/python-modules/python-dbusmock { }; + python-engineio = callPackage ../development/python-modules/python-engineio { }; python-hosts = callPackage ../development/python-modules/python-hosts { };