Skip to content

Commit

Permalink
Add support for USB removable media
Browse files Browse the repository at this point in the history
- Enable passthrough of USB drives to the GUIVM.
- Add a new service to enable auto-mounting.
- Add a simple file manager to the GUIVM.

Signed-off-by: Yuri Nesterov <[email protected]>
  • Loading branch information
nesteroff authored and brianmcgillion committed Oct 1, 2024
1 parent 26f4f7b commit 34ade48
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 2 deletions.
1 change: 1 addition & 0 deletions modules/common/services/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
./namespaces.nix
./yubikey.nix
./bluetooth.nix
./disks.nix
];
}
7 changes: 7 additions & 0 deletions modules/common/services/desktop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ in
icon = "${pkgs.sticky-notes}/share/icons/hicolor/scalable/apps/com.vixalien.sticky.svg";
}

{
name = "File Manager";
description = "File manager application";
path = "${pkgs.pcmanfm}/bin/pcmanfm";
icon = "${pkgs.icon-pack}/system-file-manager.svg";
}

{
name = "Network Settings";
description = "Manage Network & Wi-Fi Settings";
Expand Down
52 changes: 52 additions & 0 deletions modules/common/services/disks.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{
config,
lib,
pkgs,
...
}:
let
cfg = config.ghaf.services.disks;
yaml = pkgs.formats.yaml { };
inherit (lib)
mkIf
mkEnableOption
mkOption
types
;
in
{
options.ghaf.services.disks = {
enable = mkEnableOption "Enable disk mount daemon";

fileManager = mkOption {
type = types.str;
default = "xdg-open";
description = "The program to open mounted directories";
};
};
config = mkIf cfg.enable {

services.udisks2.enable = true;

environment.etc."udiskie.yml".source = yaml.generate "udiskie.yml" {
program_options = {
automount = true;
tray = "auto";
notify = true;
};
};

systemd.user.services.udiskie = {
enable = true;
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.udiskie}/bin/udiskie -c /etc/udiskie.yml -f ${cfg.fileManager} --appindicator";
};
after = [ "ghaf-session.target" ];
partOf = [ "ghaf-session.target" ];
wantedBy = [ "ghaf-session.target" ];
};
};
}
1 change: 1 addition & 0 deletions modules/desktop/graphics/ghaf-launcher.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pkgs.writeShellApplication {
runtimeInputs = [
pkgs.coreutils
pkgs.nwg-drawer
pkgs.util-linux
];
bashOptions = [ ];
text = ''
Expand Down
2 changes: 0 additions & 2 deletions modules/hardware/common/usb/vhotplug.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ let
disable = true;
}
{
# Currently disabled to leave USB drives connected to the host
class = 8;
sublass = 6;
description = "Mass Storage - SCSI (USB drives)";
disable = true;
}
];
evdevPassthrough = {
Expand Down
2 changes: 2 additions & 0 deletions modules/microvm/virtualization/microvm/guivm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ let
"Videos"
];
};
services.disks.enable = true;
services.disks.fileManager = "${pkgs.pcmanfm}/bin/pcmanfm";
};

systemd.services."waypipe-ssh-keygen" =
Expand Down
1 change: 1 addition & 0 deletions packages/icon-pack/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ let
"thorium-browser.svg"
"utilities-terminal.svg"
"yast-vpn.svg"
"system-file-manager.svg"
];
in
runCommand "icon-pack"
Expand Down

0 comments on commit 34ade48

Please sign in to comment.