Compare commits

..

4 Commits

Author SHA1 Message Date
tux
f71dcfb43c feat(hyprland): use iGPU 2025-12-25 16:54:07 +05:30
tux
61f4af216e feat(canopus): add vfio kernel modules 2025-12-25 16:53:26 +05:30
tux
bb1dce3b3a feat: add libvirt to persist dir 2025-12-25 16:51:14 +05:30
tux
8667f72e87 feat: enable spice usb redirection 2025-12-25 16:49:15 +05:30
3 changed files with 43 additions and 29 deletions

View File

@@ -103,40 +103,48 @@
kernelPackages = pkgs.linuxPackages_zen;
supportedFilesystems = ["ntfs"];
initrd.systemd = {
enable = lib.mkForce true;
initrd = {
kernelModules = [
"vfio_pci"
"vfio"
"vfio_iommu_type1"
];
services.wipe-my-fs = {
wantedBy = ["initrd.target"];
after = ["initrd-root-device.target"];
before = ["sysroot.mount"];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = ''
mkdir /btrfs_tmp
mount /dev/disk/by-partlabel/disk-primary-root /btrfs_tmp
systemd = {
enable = lib.mkForce true;
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi
services.wipe-my-fs = {
wantedBy = ["initrd.target"];
after = ["initrd-root-device.target"];
before = ["sysroot.mount"];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = ''
mkdir /btrfs_tmp
mount /dev/disk/by-partlabel/disk-primary-root /btrfs_tmp
delete_subvolume_recursively() {
IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i"
done
btrfs subvolume delete "$1"
}
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i"
done
delete_subvolume_recursively() {
IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i"
done
btrfs subvolume delete "$1"
}
btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp
'';
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i"
done
btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp
'';
};
};
};
@@ -393,6 +401,7 @@
"/var/lib/docker"
"/var/lib/waydroid"
"/var/lib/iwd"
"/var/lib/libvirt"
"/etc/NetworkManager/system-connections"
];
files = [

View File

@@ -35,6 +35,10 @@
spotify = "wezterm start --class wezterm-floating -e spotify_player";
filemanager = "wezterm start --class wezterm-floating -e superfile";
in {
# See https://wiki.hyprland.org/Configuring/Multi-GPU
# @TODO: use card by path instead off symlink
env = "AQ_DRM_DEVICES,/dev/dri/card2:/dev/dri/card1";
#-- Output
# See https://wiki.hyprland.org/Configuring/Monitors
monitor = "eDP-1,2560x1440@90,0x0,1";

View File

@@ -10,6 +10,7 @@
swtpm.enable = true;
};
};
spiceUSBRedirection.enable = true;
};
users.users.${username}.extraGroups = ["libvirtd"];