miku: Various things
This commit is contained in:
parent
44b9e944c5
commit
1b64ecf4d7
128
hosts/miku.nix
128
hosts/miku.nix
@ -1,4 +1,4 @@
|
|||||||
{ config, pkgs, modulesPath, lib, ... }:
|
{ config, pkgs, modulesPath, lib, fetchGit, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
unstable = (import ../modules/unstable.nix config);
|
unstable = (import ../modules/unstable.nix config);
|
||||||
@ -6,12 +6,12 @@ let
|
|||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./generic.nix
|
./generic.nix
|
||||||
../modules/hardware/generic.nix ../modules/hardware/video.nix
|
../modules/hardware/generic.nix ../modules/hardware/video.nix ../modules/hardware/desktop.nix
|
||||||
../modules/fonts.nix
|
../modules/fonts.nix
|
||||||
../modules/users/alexander.nix
|
../modules/users/alexander.nix
|
||||||
../modules/programs/zsh ../modules/programs/git ../modules/programs/mpv ../modules/programs/tmux ../modules/programs/emacs ../modules/programs/firefox ../modules/programs/gnome-terminal ../modules/programs/gnome ../modules/programs/i18n.nix ../modules/programs/gamemode ../modules/programs/nonvm
|
../modules/programs/zsh ../modules/programs/git ../modules/programs/mpv ../modules/programs/tmux ../modules/programs/emacs ../modules/programs/firefox ../modules/programs/gnome-terminal ../modules/programs/gnome ../modules/programs/i18n.nix ../modules/programs/gamemode ../modules/programs/nonvm
|
||||||
../modules/programs/distributed-build/builder.nix
|
../modules/programs/distributed-build/builder.nix
|
||||||
#./modules/programs/music
|
../modules/programs/music
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
@ -20,12 +20,40 @@ in {
|
|||||||
ref = "master";
|
ref = "master";
|
||||||
rev = "ce0e9482d53d69bedc8416d8a984d00e17607826";
|
rev = "ce0e9482d53d69bedc8416d8a984d00e17607826";
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
#(import (builtins.fetchTarball {
|
||||||
|
# url = "https://github.com/nix-community/NUR/archive/master.tar.gz";
|
||||||
|
# sha256 = "0r2pcc6sjxmhg1xxk23648wrwccv2c5v44cfwglx35az5y0hmr1f";
|
||||||
|
#}))
|
||||||
|
|
||||||
|
(final: prev:
|
||||||
|
let
|
||||||
|
# NOTE: This is a really messy solution
|
||||||
|
buildFHSUserEnvBubblewrap = prev.callPackage ../packages/build-support/build-fhs-userenv-bubblewrap {};
|
||||||
|
in {
|
||||||
|
steamPackages = prev.steamPackages.override {
|
||||||
|
buildFHSUserEnv = buildFHSUserEnvBubblewrap;
|
||||||
|
# Include gamemode in the FHS
|
||||||
|
#extraPkgs = (pkgs: with pkgs; [ gamemode ]);
|
||||||
|
};
|
||||||
|
|
||||||
|
steam = final.steamPackages.steam-fhsenv.overrideAttrs (old: {
|
||||||
|
specifyHomeDirs = true;
|
||||||
|
chdirTo = "/home/$USER";
|
||||||
|
});
|
||||||
|
steam-run = final.steam.run;
|
||||||
|
steam-run-native = (final.steam.override {
|
||||||
|
nativeOnly = true;
|
||||||
|
});
|
||||||
|
steamcmd = final.steamPackages.steamcmd;
|
||||||
|
})
|
||||||
|
|
||||||
customPkgs
|
customPkgs
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs.config.packageOverrides = pkgs: {
|
nixpkgs.config.packageOverrides = pkgs: {
|
||||||
nur = (import ../modules/nur.nix pkgs);
|
|
||||||
unstable = unstable;
|
unstable = unstable;
|
||||||
|
nur = (import ../modules/nur.nix pkgs);
|
||||||
};
|
};
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
@ -33,14 +61,13 @@ in {
|
|||||||
emacsPgtkGcc
|
emacsPgtkGcc
|
||||||
unstable.firmwareLinuxNonfree
|
unstable.firmwareLinuxNonfree
|
||||||
gajim
|
gajim
|
||||||
libvirt virt-manager qemu
|
libvirt virt-manager qemu scream
|
||||||
gamemode # Custom package
|
gamemode # Custom package
|
||||||
key-mapper # Custom package
|
key-mapper # Custom package
|
||||||
replaysorcery # Custom package
|
replaysorcery # Custom package
|
||||||
evdev-proxy # Custom package
|
evdev-proxy # Custom package
|
||||||
scream
|
vfio-isolate # Custom Package
|
||||||
steam
|
steam
|
||||||
linuxPackages_zen.vendor-reset
|
|
||||||
];
|
];
|
||||||
|
|
||||||
sessionVariables = {
|
sessionVariables = {
|
||||||
@ -73,31 +100,44 @@ in {
|
|||||||
[[device.Simple.selector]]
|
[[device.Simple.selector]]
|
||||||
EVDEVClass = {phys="\"key-mapper\""}
|
EVDEVClass = {phys="\"key-mapper\""}
|
||||||
'';
|
'';
|
||||||
"libvirt/hooks/qemu" = {
|
"libvirt/hooks/qemu".source = let
|
||||||
source = pkgs.writeText "qemu" ''
|
vfio-isolate-state = "/tmp/vfio-isolate-state";
|
||||||
#!/bin/sh
|
in pkgs.writeScript "qemu" ''
|
||||||
guest=$1
|
#!${pkgs.stdenv.shell}
|
||||||
phase=$2
|
guest=$1
|
||||||
state=$3
|
action=$2
|
||||||
what=$4
|
phase=$3
|
||||||
|
extra=$4
|
||||||
|
|
||||||
if [[ "$guest" = "win10" ]]; then
|
if [[ "$guest" = "win10" ]]; then
|
||||||
case "$phase" in
|
case "$action" in
|
||||||
"prepare")
|
prepare)
|
||||||
sudo -u alexander systemctl --user start evdev-proxy
|
# Only do this while in preparation
|
||||||
;;
|
[[ ! "$phase" = "prepare" ]] && exit 0
|
||||||
"start")
|
|
||||||
sudo -u alexander systemctl --user start scream
|
|
||||||
;;
|
|
||||||
"stopped")
|
|
||||||
sudo -u alexander systemctl --user stop scream
|
|
||||||
sudo -u alexander systemctl --user stop evdev-proxy
|
|
||||||
esac
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
|
|
||||||
mode = "0755";
|
sudo -u alexander systemctl --user start evdev-proxy.service
|
||||||
};
|
sudo -u alexander systemctl --user start scream.service
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
${pkgs.vfio-isolate}/bin/vfio-isolate \
|
||||||
|
-u ${vfio-isolate-state} \
|
||||||
|
cpu-governor performance "$GUEST_CORES" \
|
||||||
|
cpuset-create --cpus "$GUEST_CORES" /guest.slice \
|
||||||
|
cpuset-create --cpus C0,4 /host.slice \
|
||||||
|
move-tasks / /host.slice \
|
||||||
|
irq-affinity mask "$GUEST_CORES"
|
||||||
|
;;
|
||||||
|
stopped)
|
||||||
|
# Only run when the VM is fully stopped
|
||||||
|
[[ ! "$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 \
|
||||||
|
restore ${vfio-isolate-state}
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -139,9 +179,11 @@ in {
|
|||||||
"quiet"
|
"quiet"
|
||||||
];
|
];
|
||||||
kernelModules = [];
|
kernelModules = [];
|
||||||
extraModulePackages = [ pkgs.linuxPackages_zen.vendor-reset ];
|
extraModulePackages = [ pkgs.linuxPackages.vendor-reset ];
|
||||||
kernelPackages = pkgs.linuxPackages_zen;
|
# NOTE: A regression appears to have happend between 5.10 and 5.12
|
||||||
#kernelPackages = pkgs.linuxPackages_lqx;
|
# which leads to the RX590 to have the fence fallback timer on
|
||||||
|
# sdma0 time out (whatever this means). Maybe bisect?
|
||||||
|
#kernelPackages = pkgs.linuxPackages_zen;
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
@ -177,13 +219,23 @@ in {
|
|||||||
"/dev/rtc","/dev/hpet",
|
"/dev/rtc","/dev/hpet",
|
||||||
"/dev/input/by-id/usb-Logitech_USB_Receiver-if02-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/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/usb-Razer_Razer_BlackWidow_Ultimate-event-kbd"
|
||||||
]
|
]
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
# NOTE: Workaround for libvirt's SYSCONFDIR being set to /var/lib
|
||||||
|
# (See https://github.com/NixOS/nixpkgs/issues/51152#issuecomment-899374407)
|
||||||
|
system.activationScripts.libvirt-hooks.text = ''
|
||||||
|
ln -Tfs /etc/libvirt/hooks /var/lib/libvirt/hooks
|
||||||
|
'';
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
services.NetworkManager-wait-online.enable = false;
|
services = {
|
||||||
|
NetworkManager-wait-online.enable = false;
|
||||||
|
libvirtd.path = with pkgs; [ vfio-isolate systemd ];
|
||||||
|
};
|
||||||
|
|
||||||
user.services = {
|
user.services = {
|
||||||
scream = {
|
scream = {
|
||||||
description = "Audio receiver for the Scream virtual network sound card";
|
description = "Audio receiver for the Scream virtual network sound card";
|
||||||
@ -210,6 +262,8 @@ in {
|
|||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart = "${pkgs.key-mapper}/bin/key-mapper-service";
|
ExecStart = "${pkgs.key-mapper}/bin/key-mapper-service";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
|
# NOTE: The Tartarus may not be connected, so don't fail if we cannot set the preset
|
||||||
|
ExecPostStart = "${pkgs.key-mapper}/bin/key-mapper --command start --preset NOOP --device \"Razer Razer Tartarus V2\"; exit 0";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
replaysorcery = {
|
replaysorcery = {
|
||||||
|
Loading…
Reference in New Issue
Block a user