feat: looking glass, fonts, more comments and documentation

This commit is contained in:
Evar 2025-01-20 03:16:11 -05:00
parent 05d7340746
commit d094ec0247
5 changed files with 236 additions and 67 deletions

80
flake.lock generated
View file

@ -6,11 +6,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1735485506,
"narHash": "sha256-7CWr3Q83KnGiLUn0oaboafLMOXQ0X9/fjFRVY1xopbM=",
"lastModified": 1737224637,
"narHash": "sha256-FAytebF/lOl8ESnf3iaIEFCLw0+4uU/Tthb08B169hA=",
"owner": "Aylur",
"repo": "ags",
"rev": "251d39413543264361898b02035775aa3e46fe52",
"rev": "92bdcb227dc390e2edb122b5bb182b38456b6a5e",
"type": "github"
},
"original": {
@ -47,11 +47,11 @@
]
},
"locked": {
"lastModified": 1735172721,
"narHash": "sha256-rtEAwGsHSppnkR3Qg3eRJ6Xh/F84IY9CrBBLzYabalY=",
"lastModified": 1737052425,
"narHash": "sha256-sRX9eWJEThJ/0ZErG7LhHO9cFa3EIZloKA5NaLFfaF4=",
"owner": "aylur",
"repo": "astal",
"rev": "6c84b64efc736e039a8a10774a4a1bf772c37aa2",
"rev": "897c6d810acfd31e6cc55df7692755b177a84fcb",
"type": "github"
},
"original": {
@ -67,11 +67,11 @@
]
},
"locked": {
"lastModified": 1735048446,
"narHash": "sha256-Tc35Y8H+krA6rZeOIczsaGAtobSSBPqR32AfNTeHDRc=",
"lastModified": 1737038063,
"narHash": "sha256-rMEuiK69MDhjz1JgbaeQ9mBDXMJ2/P8vmOYRbFndXsk=",
"owner": "nix-community",
"repo": "disko",
"rev": "3a4de9fa3a78ba7b7170dda6bd8b4cdab87c0b21",
"rev": "bf0abfde48f469c256f2b0f481c6281ff04a5db2",
"type": "github"
},
"original": {
@ -106,11 +106,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1733312601,
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
"lastModified": 1736143030,
"narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
"rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de",
"type": "github"
},
"original": {
@ -124,11 +124,11 @@
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1735381016,
"narHash": "sha256-CyCZFhMUkuYbSD6bxB/r43EdmDE7hYeZZPTCv0GudO4=",
"lastModified": 1737299337,
"narHash": "sha256-0NBrY2A7buujKmeCbieopOMSbLxTu8TFcTLqAbTnQDw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "10e99c43cdf4a0713b4e81d90691d22c6a58bdf2",
"rev": "f8ef4541bb8a54a8b52f19b52912119e689529b3",
"type": "github"
},
"original": {
@ -139,11 +139,11 @@
},
"impermanence": {
"locked": {
"lastModified": 1734945620,
"narHash": "sha256-olIfsfJK4/GFmPH8mXMmBDAkzVQ1TWJmeGT3wBGfQPY=",
"lastModified": 1736688610,
"narHash": "sha256-1Zl9xahw399UiZSJ9Vxs1W4WRFjO1SsNdVZQD4nghz0=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "d000479f4f41390ff7cf9204979660ad5dd16176",
"rev": "c64bed13b562fc3bb454b48773d4155023ac31b7",
"type": "github"
},
"original": {
@ -180,11 +180,11 @@
]
},
"locked": {
"lastModified": 1735443188,
"narHash": "sha256-AydPpRBh8+NOkrLylG7vTsHrGO2b5L7XkMEL5HlzcA8=",
"lastModified": 1737257306,
"narHash": "sha256-lEGgpA4kGafc76+Amnz+gh1L/cwUS2pePFlf22WEyh8=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "55ab1e1df5daf2476e6b826b69a82862dcbd7544",
"rev": "744d330659e207a1883d2da0141d35e520eb87bd",
"type": "github"
},
"original": {
@ -195,11 +195,11 @@
},
"nixos-facter-modules": {
"locked": {
"lastModified": 1734596637,
"narHash": "sha256-MRqwVAe3gsb88u4ME1UidmZFVCx+FEnoob0zkpO9DMY=",
"lastModified": 1736931726,
"narHash": "sha256-aY55yiifyo1XPPpbpH0kWlV1g2dNGBlx6622b7OK8ks=",
"owner": "numtide",
"repo": "nixos-facter-modules",
"rev": "536472754982bf03079b4b4e0261838a760587c0",
"rev": "fa11d87b61b2163efbb9aed7b7a5ae0299e5ab9c",
"type": "github"
},
"original": {
@ -210,11 +210,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1735388221,
"narHash": "sha256-e5IOgjQf0SZcFCEV/gMGrsI0gCJyqOKShBQU0iiM3Kg=",
"lastModified": 1737306472,
"narHash": "sha256-+X9KAryvDsIE7lQ0FdfiD1u33nOVgsgufedqspf77N4=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "7c674c6734f61157e321db595dbfcd8523e04e19",
"rev": "cb3173dc5c746fa95bca1f035a7e4d2b588894ac",
"type": "github"
},
"original": {
@ -225,11 +225,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1734649271,
"narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=",
"lastModified": 1737062831,
"narHash": "sha256-Tbk1MZbtV2s5aG+iM99U8FqwxU/YNArMcWAv6clcsBc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507",
"rev": "5df43628fdf08d642be8ba5b3625a6c70731c19c",
"type": "github"
},
"original": {
@ -241,14 +241,14 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1733096140,
"narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=",
"lastModified": 1735774519,
"narHash": "sha256-CewEm1o2eVAnoqb6Ml+Qi9Gg/EfNAxbRx1lANGVyoLI=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz"
}
},
"nixpkgs_2": {
@ -269,11 +269,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1734649271,
"narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=",
"lastModified": 1736012469,
"narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507",
"rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d",
"type": "github"
},
"original": {
@ -285,11 +285,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1735268880,
"narHash": "sha256-7QEFnKkzD13SPxs+UFR5bUFN2fRw+GlL0am72ZjNre4=",
"lastModified": 1737110817,
"narHash": "sha256-DSenga8XjPaUV5KUFW/i3rNkN7jm9XmguW+qQ1ZJTR4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7cc0bff31a3a705d3ac4fdceb030a17239412210",
"rev": "041c867bad68dfe34b78b2813028a2e2ea70a23c",
"type": "github"
},
"original": {

View file

@ -65,6 +65,8 @@
enableUpdateCheck = false;
userSettings = {
"window.menuBarVisibility" = "toggle";
"editor.fontFamily" = "'SF Mono', 'Droid Sans Mono', 'monospace', monospace";
"terminal.external.linuxExec" = "fish";
# instead of dling a copy of rust analyzer, use the one from where we launched vscode
"rust-analyzer.server.path" = "rust-analyzer";

View file

@ -34,25 +34,28 @@
in
lib.mkIf affected ["amdgpu.dcdebugmask=0x400"];
# TODO: EasyEffects apparently massively slows down shutdown,
# so I'm disabling it until we can figure out why / fix it.
environment.systemPackages = lib.mkMerge [
(with pkgs; [
fw-ectool
framework-tool
])
# Show EasyEffects status in GNOME
(lib.mkIf config.services.xserver.desktopManager.gnome.enable [
pkgs.gnomeExtensions.easyeffects-preset-selector
])
# (lib.mkIf config.services.xserver.desktopManager.gnome.enable [
# pkgs.gnomeExtensions.easyeffects-preset-selector
# ])
];
# The FWL benefits from modifying its speakers
home-manager.sharedModules = [
{
services.easyeffects.enable = true;
}
];
# home-manager.sharedModules = [
# {
# services.easyeffects.enable = true;
# }
# ];
# EasyEffects needs this
programs.dconf.enable = true;
# programs.dconf.enable = true;
# RGB LED Matrix
services.hardware.openrgb = {

View file

@ -10,6 +10,11 @@ let
"1002:ab30" # Audio
];
in {
# https://astrid.tech/2022/09/22/0/nixos-gpu-vfio/ Was a huge gem to find with regard to getting this setup working.
# Absolutely great.
#
# Web Archive: http://web.archive.org/web/20241229020334/https://astrid.tech/2022/09/22/0/nixos-gpu-vfio/
options.vfio.enable = with lib;
mkEnableOption "Configure the machine for VFIO";
@ -26,6 +31,18 @@ in {
config = let cfg = config.vfio;
in {
# Useful:
# https://nixos.mayflower.consulting/blog/2020/06/17/windows-vm-performance/
# TODO: The bridge interface is necessary in order to
# have network discovery in the virtual machine. However,
# this will cause a massive slowdown in startup time
# on the host machine while ethernet is not connected.
# Should fix this, but for now it's fine.
#
# Emily used systemd-analyze a lot in order to help triage
# which got us to an alright point.
# TODO: Right now, I need to manually start
# the network bridge interface with systemctl start network-addresses-winvm0.service,
# and potentially toggle the link state in the vm config
@ -36,17 +53,70 @@ in {
};
};
environment.systemPackages = [
# For sharing filesystems
# I followed https://www.heiko-sieger.info/sharing-files-between-the-linux-host-and-a-windows-vm-using-virtiofs/
# when I was setting up the windows VM (though I already had the guest tools installed). Worked like a charm!
# Note that I temporarily need to add the following to the guest OS filesystem xml
# <binary path="/run/current-system/sw/bin/virtiofsd"/>
# due to this issue https://github.com/NixOS/nixpkgs/issues/347942
pkgs.virtiofsd
pkgs.looking-glass-client
pkgs.scream
];
# These are needed, since I'm not currently trying to
# reserve a static IP for the bridge interface
networking.interfaces.eth0.useDHCP = true;
networking.interfaces.winvm0.useDHCP = true;
programs.virt-manager.enable = true;
users.groups.libvirtd.members = ["evar"];
hardware.graphics.enable = true;
virtualisation.libvirtd.enable = true;
virtualisation.libvirtd.qemu.swtpm.enable = true; # for TPM 2.0 support
virtualisation.spiceUSBRedirection.enable = true;
# Trying to ensure the bridge network doesn't cause us to wait
# on boot
systemd.services.network-addresses-eth0.before = lib.mkForce [ ];
systemd.services.network-addresses-winvm0.before = lib.mkForce [ ];
systemd.services.winvm0-netdev.before = lib.mkForce [ ];
programs.virt-manager.enable = true;
users.groups.libvirtd.members = ["evar"]; # let me do stuff with vms
# TODO: I don't currently have a satisfying way of passing through
# my huion tablet when I connect it. I'm pretty sure
# that really good blog post I found initially talks about this
# and provides a script for mounting/unmounting stuff dynamically
# that I could look into for this.
virtualisation.spiceUSBRedirection.enable = true; # allows usb passthrough
hardware.graphics.enable = true; # needed for display spice opengl
virtualisation.libvirtd = {
enable = true;
qemu.swtpm.enable = true; # for TPM 2.0 support
onBoot = "ignore"; # only start autostart vms, not just ones that were running
onShutdown = "shutdown"; # always shut down the vm's cleanly
};
# shared memory for looking glass
# see https://looking-glass.io/docs/B7-rc1/ivshmem_shm/
# or https://alexbakker.me/post/nixos-pci-passthrough-qemu-vfio.html
# note that the VM needs 64 MB for the shmem in side the
# xml for the full res of the FW laptop
systemd.tmpfiles.rules = [
"f /dev/shm/scream 0660 evar qemu-libvirtd -"
"f /dev/shm/looking-glass 0660 evar qemu-libvirtd -"
];
# service for hooking up scream for audio
systemd.user.services.scream-ivshmem = {
enable = true;
description = "Scream IVSHMEM";
serviceConfig = {
ExecStart = "${pkgs.scream}/bin/scream-ivshmem-pulse /dev/shm/scream";
Restart = "always";
};
wantedBy = [ "multi-user.target" ];
requires = [ "pulseaudio.service" ];
};
boot = {
initrd.kernelModules = [
@ -74,5 +144,55 @@ in {
("vfio-pci.ids=" + lib.concatStringsSep "," gpuIDs);
# ++ lib.optional cfg.applyACSpatch "pcie_acs_override=downstream,multifunction";
};
# Samba share. Primarily intended to be used via the
# bridged network adapter for speed
services.samba = {
enable = true;
openFirewall = true;
settings = {
global = {
"workgroup" = "WORKGROUP";
"server string" = "Atreus";
"netbios name" = "Atreus";
"security" = "user";
# don't show shares to people who aren't valid to see them
"access based share enum" = "yes";
# only allow authenticated users - this might break old windows apps
"restrict anonymous" = "2";
"use sendfile" = "yes";
#"max protocol" = "smb2";
# note: localhost is the ipv6 localhost ::1
"hosts allow" = "10. 127.0.0.1 localhost";
"hosts deny" = "0.0.0.0/0";
"guest account" = "nobody";
"map to guest" = "bad user";
};
"Virtio Shared" = {
"path" = "/home/evar/Virtio Shared";
"comment" = "Virtio shared directory";
"valid users" = "evar";
"read only" = "no";
"public" = "no";
"guest ok" = "no";
"browseable" = "yes";
};
};
};
services.samba-wsdd = {
enable = true;
openFirewall = true;
};
networking.firewall.enable = true;
networking.firewall.allowPing = true;
};
}

View file

@ -8,7 +8,21 @@
</metadata>
<memory unit="KiB">16777216</memory>
<currentMemory unit="KiB">16777216</currentMemory>
<vcpu placement="static">16</vcpu>
<memoryBacking>
<source type="memfd"/>
<access mode="shared"/>
</memoryBacking>
<vcpu placement="static">8</vcpu>
<cputune>
<vcpupin vcpu="0" cpuset="0"/>
<vcpupin vcpu="1" cpuset="1"/>
<vcpupin vcpu="2" cpuset="2"/>
<vcpupin vcpu="3" cpuset="3"/>
<vcpupin vcpu="4" cpuset="4"/>
<vcpupin vcpu="5" cpuset="5"/>
<vcpupin vcpu="6" cpuset="6"/>
<vcpupin vcpu="7" cpuset="7"/>
</cputune>
<os>
<type arch="x86_64" machine="pc-q35-9.2">hvm</type>
<loader readonly="yes" type="pflash" format="raw">/run/libvirt/nix-ovmf/OVMF_CODE.fd</loader>
@ -38,7 +52,8 @@
<vmport state="off"/>
</features>
<cpu mode="host-passthrough" check="none" migratable="on">
<topology sockets="1" dies="1" clusters="1" cores="8" threads="2"/>
<topology sockets="1" dies="1" clusters="1" cores="4" threads="2"/>
<feature policy="require" name="topoext"/>
</cpu>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
@ -56,12 +71,18 @@
<devices>
<emulator>/run/libvirt/nix-emulators/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2" cache="none" discard="unmap"/>
<source file="/var/lib/libvirt/images/win11.qcow2"/>
<driver name="qemu" type="raw" cache="none" discard="unmap"/>
<source file="/var/lib/libvirt/images/win11.raw"/>
<target dev="vda" bus="virtio"/>
<boot order="1"/>
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="raw" cache="none" discard="unmap"/>
<source file="/home/evar/Documents/Old NVME Clone/full_disk.raw"/>
<target dev="vdb" bus="virtio"/>
<address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
</disk>
<disk type="file" device="cdrom">
<driver name="qemu" type="raw"/>
<source file="/home/evar/Downloads/Win10_22H2_English_x64v1.iso"/>
@ -167,16 +188,24 @@
<controller type="virtio-serial" index="0">
<address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
</controller>
<filesystem type="mount" accessmode="passthrough">
<driver type="virtiofs"/>
<binary path="/run/current-system/sw/bin/virtiofsd"/>
<source dir="/home/evar/Virtio Shared"/>
<target dir="Virtio Shared"/>
<address type="pci" domain="0x0000" bus="0x0b" slot="0x00" function="0x0"/>
</filesystem>
<interface type="bridge">
<mac address="52:54:00:ef:ae:20"/>
<source bridge="winvm0"/>
<model type="virtio"/>
<link state="up"/>
<address type="pci" domain="0x0000" bus="0x09" slot="0x00" function="0x0"/>
</interface>
<interface type="network">
<mac address="52:54:00:15:1c:97"/>
<source network="default"/>
<model type="e1000e"/>
<model type="virtio"/>
<address type="pci" domain="0x0000" bus="0x0a" slot="0x00" function="0x0"/>
</interface>
<serial type="pty">
@ -191,12 +220,16 @@
<target type="virtio" name="org.qemu.guest_agent.0"/>
<address type="virtio-serial" controller="0" bus="0" port="2"/>
</channel>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
<address type="virtio-serial" controller="0" bus="0" port="1"/>
</channel>
<input type="mouse" bus="ps2"/>
<input type="keyboard" bus="ps2"/>
<graphics type="spice">
<listen type="none"/>
<graphics type="spice" port="-1" autoport="no">
<listen type="address"/>
<image compression="off"/>
<gl enable="yes" rendernode="/dev/dri/by-path/pci-0000:c4:00.0-render"/>
<gl enable="no"/>
</graphics>
<sound model="ich9">
<address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0"/>
@ -204,7 +237,7 @@
<audio id="1" type="none"/>
<video>
<model type="virtio" heads="1" primary="yes">
<acceleration accel3d="yes"/>
<acceleration accel3d="no"/>
</model>
<address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
</video>
@ -220,15 +253,26 @@
</source>
<address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
</hostdev>
<hostdev mode="subsystem" type="pci" managed="yes">
<hostdev mode="subsystem" type="usb" managed="yes">
<source>
<address domain="0x0000" bus="0xc6" slot="0x00" function="0x3"/>
<vendor id="0x320f"/>
<product id="0x5088"/>
</source>
<address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
<address type="usb" bus="0" port="2"/>
</hostdev>
<watchdog model="itco" action="reset"/>
<memballoon model="virtio">
<address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
</memballoon>
<shmem name="looking-glass">
<model type="ivshmem-plain"/>
<size unit="M">64</size>
<address type="pci" domain="0x0000" bus="0x10" slot="0x01" function="0x0"/>
</shmem>
<shmem name="scream">
<model type="ivshmem-plain"/>
<size unit="M">2</size>
<address type="pci" domain="0x0000" bus="0x10" slot="0x02" function="0x0"/>
</shmem>
</devices>
</domain>