miku: Do a lot of things

This commit is contained in:
PapaTutuWawa 2022-02-14 18:34:04 +01:00
parent 1fa05e9822
commit fb4815a7dd
9 changed files with 45 additions and 46 deletions

View File

@ -17,6 +17,11 @@
"/mnt/Storage" = { "/mnt/Storage" = {
device = "/dev/disk/by-label/storage"; device = "/dev/disk/by-label/storage";
fsType = "btrfs"; fsType = "btrfs";
options = [
"noatime"
"nodev"
"nosuid"
];
}; };
}; };
@ -27,8 +32,7 @@
vfio-isolate # Custom Package vfio-isolate # Custom Package
steam-wrapped discord-wrapped # Custom package steam-wrapped discord-wrapped # Custom package
mumble mumble
piper piper trackma # Custom package
trackma # Custom package
anime-dl # Custom package anime-dl # Custom package
thunderbird thunderbird
#nwg-launchers #nwg-launchers
@ -53,7 +57,7 @@
#DGPU_DRM_NODE=$(ls /sys/bus/pci/devices/0000:01:00.0/drm | grep card) #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) #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 #export WLR_DRM_DEVICES=/dev/dri/$DGPU_DRM_NODE:/dev/dri/$IGPU_DRM_NODE
''; '';
}; };
alacritty.enable = true; alacritty.enable = true;
@ -74,9 +78,9 @@
}; };
services = { services = {
gamemode.enable = true; gamemode.enable = true;
gnome.enable = true; #gnome.enable = true;
greetd = { greetd = {
enable = true; enable = false;
/* /*
swayExtra = '' swayExtra = ''
output HDMI-A-3 transform 90 anticlockwise output HDMI-A-3 transform 90 anticlockwise
@ -122,7 +126,7 @@
swaync.enable = true; swaync.enable = true;
input-remapper = { input-remapper = {
enable = true; enable = true;
postStartCommand = "${pkgs.input-remapper}/bin/input-remapper-control --command start --preset NOOP --device \"Razer Razer Tartarus V2\"; exit 0"; postStartCommand = "${pkgs.input-remapper}/bin/input-remapper-control --command start --preset NOOP --device \"Razer Razer Tartarus V2\"";
}; };
}; };
system = { system = {
@ -166,7 +170,7 @@
}; };
kernelParams = [ kernelParams = [
"amd_iommu=on" "amd_iommu=on"
"iommu=pt" "iommu=on"
"sysrq_always_enabled=1" "sysrq_always_enabled=1"
"kvm.ignore_msrs=1" "kvm.ignore_msrs=1"
"kvm.report_ignored_msrs=N" "kvm.report_ignored_msrs=N"
@ -177,6 +181,7 @@
"nospec" "nospec"
"clocksource=tsc" "clocksource=tsc"
"tsc=reliable" "tsc=reliable"
"pci=noaer"
]; ];
extraModulePackages = [ pkgs.linuxPackages_zen.vendor-reset ]; extraModulePackages = [ pkgs.linuxPackages_zen.vendor-reset ];
@ -200,8 +205,9 @@
libinput.enable = true; libinput.enable = true;
displayManager.gdm = { displayManager.gdm = {
wayland = true; wayland = true;
enable = false; enable = true;
}; };
desktopManager.plasma5.enable = true;
}; };
}; };
@ -223,15 +229,6 @@
}; };
}; };
user.services = { user.services = {
scream = {
description = "Audio receiver for the Scream virtual network sound card";
#wantedBy = [ "default.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.scream}/bin/scream -i virbr0 -o pulse";
Restart = "always";
};
};
replaysorcery-kms = { replaysorcery-kms = {
description = "An open-source, instant-replay solution for Linux; KMS service"; description = "An open-source, instant-replay solution for Linux; KMS service";
#wantedBy = [ "default.target" ]; #wantedBy = [ "default.target" ];

View File

@ -28,6 +28,7 @@
./services/input-remapper ./services/input-remapper
./services/gamemode ./services/gamemode
./services/i18n ./services/i18n
./services/greetd
# User # User
#./users/default.nix #./users/default.nix

View File

@ -66,7 +66,7 @@ in {
desktopManager.gnome.enable = true; desktopManager.gnome.enable = true;
displayManager.gdm = { displayManager.gdm = {
enable = true; enable = false;
wayland = true; wayland = true;
}; };
}; };

View File

@ -35,6 +35,10 @@ let
in { in {
options.ptw.programs.sway = { options.ptw.programs.sway = {
enable = lib.mkEnableOption "Configure sway using HomeManager"; enable = lib.mkEnableOption "Configure sway using HomeManager";
extraSessionCommands = lib.mkOption {
description = "Commands to be run before sway is started. See programs.sway.extraSessionCommands";
default = "";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -61,10 +65,14 @@ in {
}; };
}; };
programs.sway.enable = true; programs.sway = {
enable = true;
extraSessionCommands = cfg.extraSessionCommands;
};
home-manager.users."${config.ptw.system.singleUser}" = { home-manager.users."${config.ptw.system.singleUser}" = {
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
extraSessionCommands = cfg.extraSessionCommands;
config = { config = {
bars = [ ]; bars = [ ];
startup = [ startup = [

View File

@ -1,4 +1,4 @@
{ lib, config, ... }: { lib, config, pkgs, ... }:
let let
cfg = config.ptw.services.greetd; cfg = config.ptw.services.greetd;

View File

@ -23,12 +23,9 @@ in {
"/dev/random", "/dev/urandom", "/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm", "/dev/kqemu", "/dev/ptmx", "/dev/kvm", "/dev/kqemu",
"/dev/rtc","/dev/hpet", "/dev/rtc","/dev/hpet",
"/dev/input/by-id/usb-Logitech_G700s_Rechargeable_Gaming_Mouse_93DF48160007-event-mouse",
"/dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse",
"/dev/input/by-id/usb-Razer_Razer_Tartarus_V2-event-kbd",
"/dev/input/by-id/virtual-event-EvdevProxyMouse", "/dev/input/by-id/virtual-event-EvdevProxyMouse",
"/dev/input/by-id/virtual-event-EvdevProxyTartarus", "/dev/input/by-id/virtual-event-EvdevProxyKeyboard",
"/dev/input/by-id/usb-Razer_Razer_BlackWidow_Ultimate-event-kbd" "/dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse"
] ]
''; '';
}; };

View File

@ -24,7 +24,7 @@ in {
USBIDClass = {vendor=0x046d, model=0xc07c, class="Mouse"} USBIDClass = {vendor=0x046d, model=0xc07c, class="Mouse"}
[[device]] [[device]]
[device.Simple] [device.Simple]
name = "EvdevProxyTartarus" name = "EvdevProxyKeyboard"
vendor = 0x1337 vendor = 0x1337
model = 0x1338 model = 0x1338
class = "Keyboard" class = "Keyboard"
@ -32,7 +32,9 @@ in {
# the mapped version of the Tartarus evdev node. # the mapped version of the Tartarus evdev node.
# (Useful for qemu) # (Useful for qemu)
[[device.Simple.selector]] [[device.Simple.selector]]
EVDEVClass = {phys="\"key-mapper\""} EVDEVClass = {phys="\"input-remapper\""}
[[device.Simple.selector]]
USBIDClass = {vendor=0x1532, model=0x011a, class="Keyboard"}
''; '';
"libvirt/hooks/qemu".source = let "libvirt/hooks/qemu".source = let
vfio-isolate-state = "/tmp/vfio-isolate-state"; vfio-isolate-state = "/tmp/vfio-isolate-state";
@ -43,16 +45,14 @@ in {
phase=$3 phase=$3
extra=$4 extra=$4
if [[ "$guest" = "win10" ]]; then echo "called with $1 $2 $3 $4" > /dev/stderr
if [[ "$guest" = "win10-gaming" ]]; then
case "$action" in case "$action" in
prepare) prepare)
# Only do this while in preparation # Only do this while in preparation
[[ ! "$phase" = "prepare" ]] && exit 0 [[ ! "$phase" = "prepare" ]] && exit 0
sudo -u alexander systemctl --user start evdev-proxy.service GUEST_CORES="C1-3,5-7"
sudo -u alexander systemctl --user start scream.service
sleep 2
${pkgs.vfio-isolate}/bin/vfio-isolate \ ${pkgs.vfio-isolate}/bin/vfio-isolate \
-u ${vfio-isolate-state} \ -u ${vfio-isolate-state} \
cpu-governor performance "$GUEST_CORES" \ cpu-governor performance "$GUEST_CORES" \
@ -64,9 +64,6 @@ in {
stopped) stopped)
# Only run when the VM is fully stopped # Only run when the VM is fully stopped
[[ ! "$phase" = "end" ]] && exit 0 [[ ! "$phase" = "end" ]] && exit 0
sudo -u alexander systemctl --user stop evdev-proxy.service
sudo -u alexander systemctl --user stop scream.service
${pkgs.vfio-isolate}/bin/vfio-isolate \ ${pkgs.vfio-isolate}/bin/vfio-isolate \
restore ${vfio-isolate-state} restore ${vfio-isolate-state}
esac esac
@ -85,15 +82,6 @@ in {
systemd = { systemd = {
services = { services = {
libvirtd.path = with pkgs; [ vfio-isolate systemd bash ]; 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 = { user.services.evdev-proxy = {

View File

@ -1,16 +1,17 @@
{ {
lib, stdenv, pkgs lib, stdenv, pkgs
, extraStartupArgs ? "" , extraStartupArgs ? ""
, upstreamElectron ? pkgs.electron
}: }:
pkgs.unstable.discord.overrideAttrs (old: let pkgs.discord.overrideAttrs (old: let
asar = pkgs.nodePackages.asar; asar = pkgs.nodePackages.asar;
gtk3 = pkgs.gtk3; gtk3 = pkgs.gtk3;
binaryName = "Discord"; binaryName = "Discord";
system-electron = "$out/opt/${binaryName}/system-electron.sh"; system-electron = "$out/opt/${binaryName}/system-electron.sh";
in rec { in rec {
version = "0.0.16"; version = "0.0.16";
nativeBuildInputs = with pkgs.unstable; old.nativeBuildInputs ++ [ electron asar ]; nativeBuildInputs = with pkgs.unstable; old.nativeBuildInputs ++ [ upstreamElectron asar ];
buildPhase = '' buildPhase = ''
${asar}/bin/asar e resources/app.asar resources/app ${asar}/bin/asar e resources/app.asar resources/app
rm resources/app.asar rm resources/app.asar

View File

@ -6,10 +6,13 @@ let
discord-system-electron = prev.callPackage ./applications/networking/instant-messengers/discord { discord-system-electron = prev.callPackage ./applications/networking/instant-messengers/discord {
# Wayland # Wayland
# NOTE: electron under Wayland has no window titlebars # NOTE: electron under Wayland has no window titlebars
upstreamElectron = prev.electron_16;
extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland"; extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland";
#extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer"; #extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer";
}; };
in { in {
inherit discord-system-electron;
input-remapper = prev.callPackage ./tools/games/input-remapper {}; input-remapper = prev.callPackage ./tools/games/input-remapper {};
vfio-isolate = prev.callPackage ./tools/virtualisation/vfio-isolate {}; vfio-isolate = prev.callPackage ./tools/virtualisation/vfio-isolate {};
mopidy-funkwhale = prev.callPackage ./applications/audio/mopidy/funkwhale.nix {}; mopidy-funkwhale = prev.callPackage ./applications/audio/mopidy/funkwhale.nix {};
@ -20,6 +23,7 @@ in {
replaysorcery = prev.callPackage ./tools/games/replaysorcery {}; replaysorcery = prev.callPackage ./tools/games/replaysorcery {};
evdev-proxy = prev.callPackage ./tools/virtualisation/evdev-proxy {}; evdev-proxy = prev.callPackage ./tools/virtualisation/evdev-proxy {};
virtiofsd = prev.callPackage ./tools/virtualisation/virtiofsd {};
anime4k = prev.callPackage ./misc/video/anime4k {}; anime4k = prev.callPackage ./misc/video/anime4k {};
anime-dl = prev.callPackage ./tools/video/animedl { anime-dl = prev.callPackage ./tools/video/animedl {
pySmartDL = pySmartDL; pySmartDL = pySmartDL;
@ -52,4 +56,7 @@ in {
payload-dumper = prev.callPackage tools/system/payload-dumper {}; payload-dumper = prev.callPackage tools/system/payload-dumper {};
psst = prev.callPackage tools/audio/psst {}; psst = prev.callPackage tools/audio/psst {};
wlrootsqt = prev.libsForQt5.callPackage ./wlrootsqt.nix {};
qtgreet = prev.libsForQt5.callPackage ./qtgreet.nix {};
} }