mirror of
https://github.com/tuxdotrs/nix-config.git
synced 2026-02-04 08:16:48 +05:30
feat(canopus): add vfio kernel modules
This commit is contained in:
@@ -103,40 +103,48 @@
|
|||||||
kernelPackages = pkgs.linuxPackages_zen;
|
kernelPackages = pkgs.linuxPackages_zen;
|
||||||
supportedFilesystems = ["ntfs"];
|
supportedFilesystems = ["ntfs"];
|
||||||
|
|
||||||
initrd.systemd = {
|
initrd = {
|
||||||
enable = lib.mkForce true;
|
kernelModules = [
|
||||||
|
"vfio_pci"
|
||||||
|
"vfio"
|
||||||
|
"vfio_iommu_type1"
|
||||||
|
];
|
||||||
|
|
||||||
services.wipe-my-fs = {
|
systemd = {
|
||||||
wantedBy = ["initrd.target"];
|
enable = lib.mkForce true;
|
||||||
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
|
|
||||||
|
|
||||||
if [[ -e /btrfs_tmp/root ]]; then
|
services.wipe-my-fs = {
|
||||||
mkdir -p /btrfs_tmp/old_roots
|
wantedBy = ["initrd.target"];
|
||||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
after = ["initrd-root-device.target"];
|
||||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
before = ["sysroot.mount"];
|
||||||
fi
|
unitConfig.DefaultDependencies = "no";
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
script = ''
|
||||||
|
mkdir /btrfs_tmp
|
||||||
|
mount /dev/disk/by-partlabel/disk-primary-root /btrfs_tmp
|
||||||
|
|
||||||
delete_subvolume_recursively() {
|
if [[ -e /btrfs_tmp/root ]]; then
|
||||||
IFS=$'\n'
|
mkdir -p /btrfs_tmp/old_roots
|
||||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||||
done
|
fi
|
||||||
btrfs subvolume delete "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
delete_subvolume_recursively() {
|
||||||
delete_subvolume_recursively "$i"
|
IFS=$'\n'
|
||||||
done
|
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
|
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||||
umount /btrfs_tmp
|
delete_subvolume_recursively "$i"
|
||||||
'';
|
done
|
||||||
|
|
||||||
|
btrfs subvolume create /btrfs_tmp/root
|
||||||
|
umount /btrfs_tmp
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user