Skip to content

Commit

Permalink
Minor fixes addressing comments
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Bluhm <manuel@ssrc.tii.ae>
  • Loading branch information
mbssrc committed Apr 29, 2024
1 parent a900108 commit 6fb31b1
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 24 deletions.
58 changes: 48 additions & 10 deletions modules/desktop/graphics/hardware.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,52 @@
# Copyright 2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{lib, ...}:
with lib; {
options.ghaf.graphics.hardware = {
networkDevice = mkOption {
type = types.anything;
default = {};
description = ''
Network device interface for use with graphics stack.
'';
with lib;
let
pciDevSubmodule = types.submodule {
options = {
path = mkOption {
type = types.str;
description = ''
PCI device path
'';
};
vendorId = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
PCI Vendor ID (optional)
'';
};
productId = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
PCI Product ID (optional)
'';
};
name = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
PCI device name (optional)
'';
};
};
};
};
}
in {
options.ghaf.graphics.hardware = {
networkDevices = mkOption {
description = "Network PCI Devices";
type = types.listOf pciDevSubmodule;
default = [];
example = literalExpression ''
[{
path = "0000:00:14.3";
vendorId = "8086";
productId = "51f1";
}]
'';
};
};
}
4 changes: 2 additions & 2 deletions modules/desktop/graphics/waybar.config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
...
}: let
cfg = config.ghaf.graphics.labwc;
inherit (config.ghaf.graphics.hardware) networkDevice;
inherit (config.ghaf.graphics.hardware) networkDevices;

ghaf-icon = pkgs.runCommand "ghaf-icon-24x24" {} ''
mkdir -p $out/share/icons/hicolor/24x24/apps
Expand All @@ -17,7 +17,7 @@
$out/share/icons/hicolor/24x24/apps/ghaf-icon-24x24.png
'';

wifiDevice = lib.lists.findFirst (d: d.name != null) null networkDevice;
wifiDevice = lib.lists.findFirst (d: d.name != null) null networkDevices;
wifi-signal-strength = pkgs.callPackage ../../../packages/wifi-signal-strength {wifiDevice = wifiDevice.name;};
ghaf-launcher = pkgs.callPackage ./ghaf-launcher.nix {inherit config pkgs;};
timeZone =
Expand Down
1 change: 0 additions & 1 deletion modules/hardware/lenovo-x1/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{
imports = [
./definitions
./ax88179_178a.nix
./modules/fprint.nix
];
}
13 changes: 3 additions & 10 deletions modules/hardware/lenovo-x1/definitions/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ in {
# 2. USB camera "passthrough" is handled by qemu and thus available on host. If peripheral VM is implemented,
# the entire host controller should be passthrough'd using the PCI bus (14.0). In x1, bluetooth and fingerprint
# reader are on this bus.
services.udev.extraRules = let
mapMouseRules =
builtins.map (d: '' SUBSYSTEM=="input", ATTRS{name}=="${d}", KERNEL=="event*", GROUP="kvm", SYMLINK+="mouse"
'');
mapTouchpadRules =
builtins.map (d: '' SUBSYSTEM=="input", ATTRS{name}=="${d}", KERNEL=="event*", GROUP="kvm", SYMLINK+="touchpad"
'');
in ''
services.udev.extraRules = ''
# Laptop keyboard
SUBSYSTEM=="input", ATTRS{name}=="AT Translated Set 2 keyboard", GROUP="kvm"
# Laptop TrackPoint
Expand All @@ -62,8 +55,8 @@ in {
# Lenovo X1 integrated fingerprint reader
KERNEL=="3-6", SUBSYSTEM=="usb", ATTR{busnum}=="3", ATTR{devnum}=="2", GROUP="kvm"
# Mouse and Touchpad
${lib.strings.concatStrings (mapMouseRules hwDefinition.mouse)}
${lib.strings.concatStrings (mapTouchpadRules hwDefinition.touchpad)}
${lib.strings.concatMapStringsSep "\n" (d: ''SUBSYSTEM=="input", ATTRS{name}=="${d}", KERNEL=="event*", GROUP="kvm", SYMLINK+="mouse"'') hwDefinition.mouse}
${lib.strings.concatMapStringsSep "\n" (d: ''SUBSYSTEM=="input", ATTRS{name}=="${d}", KERNEL=="event*", GROUP="kvm", SYMLINK+="touchpad"'') hwDefinition.touchpad}
'';
};
}
1 change: 1 addition & 0 deletions modules/hardware/x86_64-generic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
./kernel/host/pkvm
./x86_64-linux.nix
./modules/tpm2.nix
./modules/ax88179_178a.nix
];
}
File renamed without changes.
2 changes: 1 addition & 1 deletion targets/lenovo-x1/guivmExtraModules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
};

guivmExtraConfigurations = {
ghaf.graphics.hardware.networkDevice = configH.ghaf.hardware.definition.network.pciDevices;
ghaf.graphics.hardware.networkDevices = configH.ghaf.hardware.definition.network.pciDevices;
ghaf.profiles.graphics.compositor = "labwc";
ghaf.graphics.launchers = let
hostAddress = "192.168.101.2";
Expand Down

0 comments on commit 6fb31b1

Please sign in to comment.