virtiofsd: Implement

This commit is contained in:
PapaTutuWawa 2022-02-11 14:01:52 +01:00
parent 91298bbfe5
commit 1fa05e9822
4 changed files with 122 additions and 6 deletions

View File

@ -16,7 +16,7 @@
};
"/mnt/Storage" = {
device = "/dev/disk/by-label/storage";
fsType = "ext4";
fsType = "btrfs";
};
};
@ -46,7 +46,16 @@
primaryScreen = "C27F398";
enable = true;
};
sway.enable = true;
sway = {
enable = true;
extraSessionCommands = ''
# Pick the dGPU as the first one
#DGPU_DRM_NODE=$(ls /sys/bus/pci/devices/0000:01:00.0/drm | grep card)
#IGPU_DRM_NODE=$(ls /sys/bus/pci/devices/0000:08:00.0/drm | grep card)
#WLR_DRM_DEVICES=/dev/dri/$DGPU_DRM_NODE:/dev/dri/$IGPU_DRM_NODE
'';
};
alacritty.enable = true;
emacs.enable = true;
firefox.enable = true;
@ -66,6 +75,16 @@
services = {
gamemode.enable = true;
gnome.enable = true;
greetd = {
enable = true;
/*
swayExtra = ''
output HDMI-A-3 transform 90 anticlockwise
workspace 1 output HDMI-A-3
'';
*/
};
kanshi = let
horizontal = "Samsung Electric Company C27F398 H4ZR101145";
vertical = "Goldstar Company Ltd IPS235 305NDPHKN600";
@ -181,7 +200,7 @@
libinput.enable = true;
displayManager.gdm = {
wayland = true;
enable = true;
enable = false;
};
};
};

View File

@ -0,0 +1,53 @@
{ lib, config, ... }:
let
cfg = config.ptw.services.greetd;
in {
options.ptw.services.greetd = {
enable = lib.mkEnableOption "Enable greetd with gtkgreet";
swayExtra = lib.mkOption {
description = "Extra options to include in the sway config";
default = "";
};
};
config = lib.mkIf cfg.enable {
users.users.greeter = {
isSystemUser = lib.mkForce false;
isNormalUser = true;
createHome = true;
uid = 992;
};
services = {
greetd = {
enable = true;
restart = true;
settings = {
default_session = let
swayConfig = pkgs.writeText "login-sway-config" ''
exec ${pkgs.greetd.gtkgreet}/bin/gtkgreet -l; ${pkgs.sway}/bin/swaymsg exit;
bindsym Mod4+shift+e exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
input "*" {
xkb_layout de
}
${cfg.swayExtra}
include /etc/sway/config.d/*
'';
in {
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
user = "greeter";
};
};
};
};
};
}

View File

@ -83,10 +83,22 @@ in {
services.udev.packages = with pkgs; [ evdev-proxy ];
systemd = {
services.libvirtd.path = with pkgs; [ vfio-isolate systemd bash ];
services = {
libvirtd.path = with pkgs; [ vfio-isolate systemd bash ];
virtiofsd = {
description = "vhost-user virtio-fs device backend written in Rust";
wantedBy = [ "default.target" "libvirtd.service" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.virtiofsd}/bin/virtiofsd --socket-path=/tmp/vfsd.sock --shared-dir /mnt/Storage/Games --announce-submounts --inode-file-handles=mandatory";
Restart = "always";
};
};
};
user.services.evdev-proxy = {
description = "Creates virtual device to proxy evdev devices events";
#wantedBy = [ "default.target" ];
wantedBy = [ "default.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.evdev-proxy}/bin/evdev-proxy";

View File

@ -0,0 +1,32 @@
{
lib
, rustPlatform
, pkgconfig, libcap_ng, libseccomp
, fetchFromGitLab
}:
rustPlatform.buildRustPackage rec {
pname = "virtiofsd";
version = "1.1.0";
src = fetchFromGitLab {
owner = "virtio-fs";
repo = "virtiofsd";
rev = "a31ad19efc302836a364fd6d79bda63160404b01";
sha256 = "12nxm40sjx2jzl1j2czzanmk9b922dvfh64ndvgf5z4g4cviv33x";
};
cargoSha256 = "sha256-uRPmZE/xc0yeurBZ4rnrZua5d4lbPwStMUacFgbquuk=";
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ libcap_ng libseccomp ];
meta = with lib; {
description = "vhost-user virtio-fs device backend written in Rust";
homepage = "https://gitlab.com/virtio-fs/virtiofsd";
license = licenses.bsd3;
maintainers = [];
platforms = platforms.linux;
};
}