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 <[email protected]>
  • Loading branch information
mbssrc authored and brianmcgillion committed May 9, 2024
1 parent 46f1557 commit 48eab62
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 23 deletions.
49 changes: 43 additions & 6 deletions modules/desktop/graphics/hardware.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,50 @@
# Copyright 2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{lib, ...}:
with lib; {
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 = {
networkDevice = mkOption {
type = types.anything;
default = {};
description = ''
Network device interface for use with graphics stack.
networkDevices = mkOption {
description = "Network PCI Devices";
type = types.listOf pciDevSubmodule;
default = [];
example = literalExpression ''
[{
path = "0000:00:14.3";
vendorId = "8086";
productId = "51f1";
}]
'';
};
};
Expand Down
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,14 +7,14 @@
...
}: let
cfg = config.ghaf.graphics.labwc;
inherit (config.ghaf.graphics.hardware) networkDevice;
inherit (config.ghaf.graphics.hardware) networkDevices;
inherit (import ../../../lib/icons.nix {inherit pkgs lib;}) svgToPNG;

launchpad-icon = svgToPNG "launchpad" ../../../assets/icons/svg/launchpad.svg "38x38";
admin-icon = svgToPNG "admin" ../../../assets/icons/svg/admin-cog.svg "24x24";
ghaf-icon = svgToPNG "ghaf-white" ../../../assets/icons/svg/ghaf-white.svg "24x24";

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-installer/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
in {
imports = [
"${toString modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
../../modules/common/hardware/ax88179_178a.nix
../../modules/hardware/x86_64-generic/modules/ax88179_178a.nix
];

ghaf.hardware.ax88179_178a.enable = true;
Expand Down
1 change: 1 addition & 0 deletions targets/lenovo-x1/everything.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
}: let
powerControl = pkgs.callPackage ../../packages/powercontrol {};
in {
security.polkit.extraConfig = powerControl.polkitExtraConfig;
time.timeZone = "Asia/Dubai";

# Enable pulseaudio support for host as a service
Expand Down
6 changes: 3 additions & 3 deletions 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 Expand Up @@ -151,7 +151,7 @@

microvm.qemu = {
extraArgs =
[
[
# Lenovo X1 Lid button
"-device"
"button"
Expand All @@ -165,7 +165,7 @@
"-audiodev"
"pa,id=pa1,server=unix:/run/pulse/native"
]
++ lib.optionals configH.ghaf.hardware.fprint.enable configH.ghaf.hardware.fprint.qemuExtraArgs;
++ lib.optionals configH.ghaf.hardware.fprint.enable configH.ghaf.hardware.fprint.qemuExtraArgs;
};
};
in
Expand Down

0 comments on commit 48eab62

Please sign in to comment.