diff --git a/flake.lock b/flake.lock index e379543..52c32d1 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/home/apps.nix b/home/apps.nix index f84fe39..7b2b733 100644 --- a/home/apps.nix +++ b/home/apps.nix @@ -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"; diff --git a/nixos/device.nix b/nixos/device.nix index e941fc6..1638dba 100644 --- a/nixos/device.nix +++ b/nixos/device.nix @@ -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 = { diff --git a/nixos/vm.nix b/nixos/vm.nix index 5af0611..612d735 100644 --- a/nixos/vm.nix +++ b/nixos/vm.nix @@ -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 + # + # 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; }; } \ No newline at end of file diff --git a/win10.xml b/win10.xml index 768b440..6db8aa3 100644 --- a/win10.xml +++ b/win10.xml @@ -8,7 +8,21 @@ 16777216 16777216 - 16 + + + + + 8 + + + + + + + + + + hvm /run/libvirt/nix-ovmf/OVMF_CODE.fd @@ -38,7 +52,8 @@ - + + @@ -56,12 +71,18 @@ /run/libvirt/nix-emulators/qemu-system-x86_64 - - + +
+ + + + +
+ @@ -167,16 +188,24 @@
+ + + + + +
+ +
- +
@@ -191,12 +220,16 @@
+ + +
+ - - + + - +
@@ -204,7 +237,7 @@