Skip to content

Commit

Permalink
Add report page into control panel
Browse files Browse the repository at this point in the history
MAC address shared with GUIVM
Report page is added into settings of control panel
Github configuration is added to submit a report

Signed-off-by: Berk Arslan <[email protected]>
  • Loading branch information
Nerox9 committed Dec 10, 2024
1 parent f41d773 commit 06722b0
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 7 deletions.
10 changes: 7 additions & 3 deletions modules/common/logging/hw-mac-retrieve.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{ hostConfig }:
{ hostConfig }:
{
config,
lib,
Expand All @@ -13,7 +13,7 @@ let
macCommand = "${pkgs.hwinfo}/bin/hwinfo --network --only /class/net/wlp0s5f0 | ${pkgs.gawk}/bin/awk '/Permanent HW Address/ {print $4}'";
macAddressPath = config.ghaf.logging.identifierFilePath;
in
{
{
options.ghaf.logging.identifierFilePath = lib.mkOption {
description = ''
This configuration option used to specify the identifier file path.
Expand All @@ -29,7 +29,11 @@ in
# TODO: Remove hw-mac.service and replace with givc rpc later
systemd.services."hw-mac" = {
description = "Retrieve MAC address from net-vm";
wantedBy = if hostConfig.ghaf.virtualization.microvm.guivm.enable then [ "ewwbar.service" ] else [ "alloy.service" ];
wantedBy =
if hostConfig.ghaf.virtualization.microvm.guivm.enable then
[ "ewwbar.service" ]
else
[ "alloy.service" ];
requires = [ "network-online.target" ];
serviceConfig = {
Type = "oneshot";
Expand Down
2 changes: 1 addition & 1 deletion modules/microvm/virtualization/microvm/adminvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let
internalIP = 10;
})
# We need to retrieve mac address and start log aggregator
(import ../../../common/logging/hw-mac-retrieve.nix { hostConfig=config; })
(import ../../../common/logging/hw-mac-retrieve.nix { hostConfig = config; })
../../../common/logging/logs-aggregator.nix
./common/storagevm.nix
(
Expand Down
39 changes: 36 additions & 3 deletions modules/microvm/virtualization/microvm/guivm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ let

# To push logs to central location
../../../common/logging/client.nix
(import ../../../common/logging/hw-mac-retrieve.nix { hostConfig=config; })

(import ../../../common/logging/hw-mac-retrieve.nix { hostConfig = config; })

(
{ lib, pkgs, ... }:
Expand Down Expand Up @@ -180,7 +180,20 @@ let
pkgs.eww
pkgs.wlr-randr
]
++ [ pkgs.ctrl-panel ]
++ [
pkgs.ctrl-panel
(pkgs.writeShellApplication {
name = "github-config";
text = ''
mkdir -p "$HOME"/.config/ctrl-panel
cat > "$HOME"/.config/ctrl-panel/config.toml << EOF
token = "${cfg.githubToken}"
owner = "${cfg.githubOwner}"
repo = "${cfg.githubRepo}"
EOF
'';
})
]
++ (lib.optional (
config.ghaf.profiles.debug.enable && config.ghaf.virtualization.microvm.idsvm.mitmproxy.enable
) pkgs.mitmweb-ui)
Expand All @@ -193,6 +206,7 @@ let
sessionVariables = {
XDG_PICTURES_DIR = "$HOME/Pictures";
XDG_VIDEOS_DIR = "$HOME/Videos";
GITHUB_CONFIG = "$HOME/.config/ctrl-panel/config.toml";
};
};

Expand Down Expand Up @@ -308,6 +322,25 @@ in
Context Identifier (CID) of the GUIVM VSOCK
'';
};

githubOwner = lib.mkOption {
type = lib.types.str;
description = ''
Github owner account of the bug reporter issue
'';
};
githubRepo = lib.mkOption {
type = lib.types.str;
description = ''
Github repo of the bug reporter issue
'';
};
githubToken = lib.mkOption {
type = lib.types.str;
description = ''
Personal token of the bug reporter Github account
'';
};
};

config = lib.mkIf cfg.enable {
Expand Down
3 changes: 3 additions & 0 deletions modules/reference/profiles/laptop-x86.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ in
guivm = {
enable = true;
extraModules = cfg.guivmExtraModules;
githubToken = "xxxxxxxxxxxxxxxxxxxx";
githubOwner = "yyyyy";
githubRepo = "zzzzzz";
};

audiovm = {
Expand Down

0 comments on commit 06722b0

Please sign in to comment.