Merge pull request #56046 from callahad/bolt

Add and enable Bolt to support Thunderbolt 3 settings in GNOME
This commit is contained in:
Tor Hedin Brønner 2019-02-20 21:43:02 +01:00 committed by GitHub
commit bba6de611a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 177 additions and 0 deletions

View File

@ -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";

View File

@ -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

View File

@ -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 ];
};
}

View File

@ -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 ];

View File

@ -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;
};
}

View File

@ -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}"

View File

@ -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;
};
}

View File

@ -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 { };

View File

@ -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 { };