Skip to content

Instantly share code, notes, and snippets.

@mvnetbiz
mvnetbiz / subtractAttrs.nix
Created September 16, 2020 22:31
Recurisvely subtract attribute lists
a1: a2:
let
lib = (import <nixpkgs> {}).lib;
xor = a: b: (a && !b) || (!a && b);
subtractAttrs = a: b: with lib;
let
attrsAttrsNames = x: filter (e: (isAttrs x.${e})) (attrNames x);
bothAttrs = intersectLists (attrsAttrsNames a) (attrsAttrsNames b);
in
@mvnetbiz
mvnetbiz / configuration.nix
Last active August 12, 2023 06:07
VFIO PCI Passthrough Nix module
{
services.vfio-vm = {
enable = true;
pciIDs = [ "1002:67b0" "1002:aac8" "104c:8241"];
isolcpus = [ 1 2 5 6 ]; # core 2&3 + corresponding hyperthreads
hugePageSize = "1G";
hugePageCount = 20;
inputDevices = [
"/dev/input/by-id/usb-Logitech_G403_Prodigy_Gaming_Mouse_1274375E3330-event-mouse"
"/dev/input/by-id/usb-Corsair_Corsair_K65_RGB_Gaming_Keyboard_01031005AE3998A7534EC0CAF5001942-if01-event-kbd"