update some stuff

This commit is contained in:
LordGrimmauld 2024-03-24 10:16:04 +01:00
parent 1ea696f57e
commit a10f8af167
6 changed files with 253 additions and 54 deletions

View File

@ -21,14 +21,18 @@
boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
kernelParams = [ "quiet" ];
kernelPackages = pkgs.linuxPackagesFor ( pkgs.linux_6_7 );
kernelParams = [ "quiet" "intel_iommu=on" "iommu=force" "pcie_acs_override=downstream" "pcie_aspm=off" ]; # "vfio-pci.ids=10de:1aeb,10de:2191,10de:1aed,10de:1aec" ];
kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_drm" "kvm-intel" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" "i2c-dev" ];
kernelPackages = pkgs.linuxPackages_zen;
};
# Enable flatpaks
services.flatpak.enable = true;
chaotic.mesa-git.enable = true;
services.ddccontrol.enable = true;
powerManagement.scsiLinkPolicy = "min_power";
hardware.i2c.enable = true;
grimmShared = {
enable = true;

View File

@ -56,6 +56,22 @@
"url": "https://flakehub.com/f/zhaofengli/attic/0.1.%2A.tar.gz"
}
},
"cachix": {
"locked": {
"lastModified": 1635350005,
"narHash": "sha256-tAMJnUwfaDEB2aa31jGcu7R7bzGELM9noc91L2PbVjg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1c1f5649bb9c1b0d98637c8c365228f57126f361",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-20.09",
"repo": "nixpkgs",
"type": "github"
}
},
"chaotic": {
"inputs": {
"attic": "attic",
@ -78,11 +94,11 @@
"yafas": "yafas"
},
"locked": {
"lastModified": 1710717798,
"narHash": "sha256-KrZbpo83wnKbUXy0hnmENJTNy/mOCF3Un+nml67e+dU=",
"lastModified": 1710954445,
"narHash": "sha256-vU2OGteZS6dMKZcu+btwsNN4HxIwhEb8dzP+h5NgKps=",
"owner": "chaotic-cx",
"repo": "nyx",
"rev": "cd5052eba475afc01072ebc239896a68edc17f95",
"rev": "2952a351037582a8aeb11be9cf57901d872bcf30",
"type": "github"
},
"original": {
@ -138,11 +154,11 @@
]
},
"locked": {
"lastModified": 1710562188,
"narHash": "sha256-KHlb4sK9fvp+9DoYWHLyaegoeLV7w8s7CsNMmNlKu1U=",
"lastModified": 1710821861,
"narHash": "sha256-Y+x3q7VkPpRok7Om2bwB2v1JDK/OCZmiFaBrIOJRojY=",
"owner": "girlbossceo",
"repo": "conduwuit",
"rev": "8d8467a4eafd264adb9c710e0638c08ae547dec4",
"rev": "7809f0a6aee6900de59b720bf966d4a0315276bc",
"type": "github"
},
"original": {
@ -214,6 +230,31 @@
"url": "https://flakehub.com/f/nix-community/fenix/0.1.%2A.tar.gz"
}
},
"ff_nightly": {
"inputs": {
"cachix": "cachix",
"flake-compat": "flake-compat_2",
"lib-aggregate": "lib-aggregate",
"mozilla": "mozilla",
"nixpkgs": [
"shared",
"nixpkgs"
]
},
"locked": {
"lastModified": 1710982600,
"narHash": "sha256-KC8V8aTUHZAORn0uJ5ENKkF8VIBvNmZvkF/O/nSaB1A=",
"owner": "nix-community",
"repo": "flake-firefox-nightly",
"rev": "6778dc738c3a40a63df286005d44d2ddf5903e47",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-firefox-nightly",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -230,6 +271,21 @@
}
},
"flake-compat_2": {
"locked": {
"lastModified": 1688025799,
"narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1696426674,
@ -247,7 +303,7 @@
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1709336216,
@ -297,6 +353,24 @@
"url": "https://flakehub.com/f/numtide/flake-utils/0.1.%2A.tar.gz"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -347,11 +421,11 @@
]
},
"locked": {
"lastModified": 1710404304,
"narHash": "sha256-tYsUAsZgt9TT7d+r1KRYHWyBRWedJ39SXNBVSCQVsGQ=",
"lastModified": 1710915975,
"narHash": "sha256-yOc0AD6ba7mbialNciZGzuSQLMo4CopoZGEfcUugA4I=",
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"rev": "ffa51458aec4d53aac85b6dee1ee2ec29f4e953f",
"rev": "179d73fbe14c5bdb835d10bcc1c783466112bfa6",
"type": "github"
},
"original": {
@ -373,11 +447,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1710563757,
"narHash": "sha256-H5SZIo7O4zg/NqSdM71V2gYH4ex5WbBf6s9ue5s4nL4=",
"lastModified": 1710898409,
"narHash": "sha256-vk+NUeKBb8pyTkZvHVq7+or25fpnSeaaSBGHSGKXL44=",
"owner": "martinvonz",
"repo": "jj",
"rev": "8600750fceafbf489d42a99b36b1f48bbc1e416b",
"rev": "4fbe6aecc95152eda44cb4b185ab369e23e1393f",
"type": "github"
},
"original": {
@ -386,6 +460,41 @@
"type": "github"
}
},
"lib-aggregate": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1710677371,
"narHash": "sha256-yqjXunc+Zvqf6rcH7W9wMvhr18jMZhDvIdnretlfj78=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "f890211817b941d9ed9de48d62ba8553fa2c20f3",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "lib-aggregate",
"type": "github"
}
},
"mozilla": {
"flake": false,
"locked": {
"lastModified": 1704373101,
"narHash": "sha256-+gi59LRWRQmwROrmE1E2b3mtocwueCQqZ60CwLG+gbg=",
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"rev": "9b11a87c0cc54e308fa83aac5b4ee1816d5418a2",
"type": "github"
},
"original": {
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"type": "github"
}
},
"niri": {
"inputs": {
"crane": [
@ -410,11 +519,11 @@
]
},
"locked": {
"lastModified": 1710525749,
"narHash": "sha256-LpV/mJLeShTPecVQZnIAb9PTCGziuMuGOJQUeAb2u/w=",
"lastModified": 1710858553,
"narHash": "sha256-CHSkAhNaWIMXlJX7skC2t5wr/qaNlMgWQsezNqr15mw=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "0c57815fbf47c69af9ed11fa8ebc1b52158a3ba2",
"rev": "db49deb7fd2fbe805ceec060aa4dec65009ad7a7",
"type": "github"
},
"original": {
@ -447,11 +556,11 @@
]
},
"locked": {
"lastModified": 1710637843,
"narHash": "sha256-NVszlVTM0sEe8yZuOShitwOhNdl2juD7032SQg2dV+U=",
"lastModified": 1711003080,
"narHash": "sha256-YAycKYKMytiQe9L6yZuVcq/1rCFcDHIA6/G78oSofV8=",
"owner": "fufexan",
"repo": "nix-gaming",
"rev": "da2c09734818d85ef4d112997b5188b62cfdd0fd",
"rev": "1e435616e688c2b9125cd5282febcad3ab981d5e",
"type": "github"
},
"original": {
@ -485,11 +594,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1710631334,
"narHash": "sha256-rL5LSYd85kplL5othxK5lmAtjyMOBg390sGBTb3LRMM=",
"lastModified": 1710806803,
"narHash": "sha256-qrxvLS888pNJFwJdK+hf1wpRCSQcqA6W5+Ox202NDa0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c75037bbf9093a2acb617804ee46320d6d1fea5a",
"rev": "b06025f1533a1e07b6db3e75151caa155d1c7eb3",
"type": "github"
},
"original": {
@ -500,6 +609,21 @@
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1710636348,
"narHash": "sha256-/kB+ZWSdkZjbZ0FTqm0u84sf2jFS+30ysaEajmBjtoY=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "fa827dda806c5aa98f454da4c567991ab8ce422c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs-lib_2": {
"locked": {
"dir": "lib",
"lastModified": 1709237383,
@ -587,7 +711,8 @@
},
"shared": {
"inputs": {
"flake-compat": "flake-compat_2",
"ff_nightly": "ff_nightly",
"flake-compat": "flake-compat_3",
"nix-gaming": "nix-gaming",
"nixpkgs": [
"nixpkgs"
@ -596,17 +721,16 @@
"utils": "utils"
},
"locked": {
"dirtyRev": "154b9aa8ec511edf7c3a62c94f5d04f5d070e36e-dirty",
"dirtyShortRev": "154b9aa-dirty",
"lastModified": 1710718492,
"narHash": "sha256-CZgpU2fSJC0HAp6+pAdmAze28t7E2ch6Q+YnFonADUQ=",
"ref": "refs/heads/main",
"rev": "154b9aa8ec511edf7c3a62c94f5d04f5d070e36e",
"revCount": 31,
"narHash": "sha256-eonlerwNvoyXvtoLDQKtHXR/aP6pRX6YrbakcOfKY7Q=",
"type": "git",
"url": "https://git.grimmauld.de/Grimmauld/grimm-nix-shared"
"url": "file:///home/grimmauld/shared"
},
"original": {
"type": "git",
"url": "https://git.grimmauld.de/Grimmauld/grimm-nix-shared"
"url": "file:///home/grimmauld/shared"
}
},
"swaymux": {
@ -675,9 +799,24 @@
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_3"
"systems": "systems_4"
},
"locked": {
"lastModified": 1710146030,

View File

@ -14,8 +14,8 @@
inputs.nixpkgs.follows = "nixpkgs";
};
shared = {
url = "git+https://git.grimmauld.de/Grimmauld/grimm-nix-shared";
# url = "git+file:///home/grimmauld/shared";
# url = "git+https://git.grimmauld.de/Grimmauld/grimm-nix-shared";
url = "git+file:///home/grimmauld/shared";
inputs.nixpkgs.follows = "nixpkgs";
};
};
@ -34,14 +34,14 @@
# ./kernel.nix
./configuration.nix
./modules/users.nix
./modules/tlp.nix
# ./modules/tlp.nix
./modules/fonts.nix
./modules/screenshare_select.nix
# ./modules/spotify-tui.nix
./modules/spotify-tui.nix
./modules/tabletdriver.nix
./modules/xserver.nix
./modules/system-packages.nix
# ./modules/kvm.nix
./modules/kvm.nix
./modules/cloudsync.nix
{ environment.systemPackages = [ agenix.packages.${system}.default ]; }
];

View File

@ -1,18 +1,74 @@
{ pkgs, ... }:
{
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
virtualisation.libvirtd.qemu.ovmf.packages = [
{ pkgs, ... }: let
loadvfio = pkgs.writeShellScriptBin "loadvfio" ''
udevadm trigger --verbose --type=devices --action=remove --subsystem-match=drm --property-match="MINOR=1"
sleep 2
rmmod -f nvidia_drm nvidia_modeset nvidia_uvm nvidia
echo -n 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
echo -n 0000:01:00.1 > /sys/bus/pci/drivers/vfio-pci/bind
echo -n 0000:01:00.0 > /sys/bus/pci/drivers/vfio-pci/bind
'';
loadnvidia = pkgs.writeShellScriptBin "loadnvidia" ''
echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
echo 0000:01:00.1 > /sys/bus/pci/devices/0000:01:00.1/driver/unbind
modprobe nvidia
modprobe nvidia_drm
modprobe nvidia_modeset
echo -n 0000:01:00.0 > /sys/bus/pci/drivers/snd_hda_intel/bind
nvidia-smi -i 0 -pm 1
'';
qemuHook = pkgs.writeShellScript "qemu" ''
#
# Author: Sebastiaan Meijer (sebastiaan@passthroughpo.st)
#
# Copy this file to /etc/libvirt/hooks, make sure it's called "qemu".
# After this file is installed, restart libvirt.
# From now on, you can easily add per-guest qemu hooks.
# Add your hooks in /etc/libvirt/hooks/qemu.d/vm_name/hook_name/state_name.
# For a list of available hooks, please refer to https://www.libvirt.org/hooks.html
#
GUEST_NAME="$1"
HOOK_NAME="$2"
STATE_NAME="$3"
MISC="''${@:4}"
BASEDIR="$(dirname $0)"
HOOKPATH="$BASEDIR/qemu.d/$GUEST_NAME/$HOOK_NAME/$STATE_NAME"
set -e # If a script exits with an error, we should as well.
# check if it's a non-empty executable file
if [ -f "$HOOKPATH" ] && [ -s "$HOOKPATH"] && [ -x "$HOOKPATH" ]; then
eval \"$HOOKPATH\" "$@"
elif [ -d "$HOOKPATH" ]; then
while read file; do
# check for null string
if [ ! -z "$file" ]; then
eval \"$file\" "$@"
fi
done <<< "$(find -L "$HOOKPATH" -maxdepth 1 -type f -executable -print;)"
fi
'';
in {
environment.systemPackages = [ loadnvidia loadvfio ];
security.sudo.extraConfig = "grimmauld ALL=(ALL) NOPASSWD:/run/current-system/sw/bin/loadnvidia, /run/current-system/sw/bin/loadvfio";
virtualisation.libvirtd = {
enable = true;
qemu = {
runAsRoot = false;
ovmf = {
enable = true;
packages = [
# pkgs.pkgsCross.aarch64-multiplatform.OVMF.fd # AAVMF
pkgs.OVMF.fd
];
pkgs.OVMF.fd
];
};
};
onBoot = "ignore";
onShutdown = "shutdown";
};
programs.virt-manager.enable = true;
virtualisation.spiceUSBRedirection.enable = true;
# security.wrappers.spice-client-glib-usb-acl-helper.source = "${pkgs.spice_gtk}/bin/spice-client-glib-usb-acl-helper";
# home manager
# dconf.settings = {
# "org/virt-manager/virt-manager/connections" = {
# autoconnect = ["qemu:///system"];
# uris = ["qemu:///system"];
# };
# };
}

View File

@ -28,7 +28,7 @@ END
];
environment.systemPackages = with pkgs; [
spotify-tui
ncspot
spotifyd
];

View File

@ -3,7 +3,7 @@
isNormalUser = true;
shell = pkgs.xonsh;
description = "grimmauld";
extraGroups = [ "networkmanager" "wheel" "input" "video" "lp" "scanner" "libvirtd" "pipewire" "gamemode" ];
extraGroups = [ "networkmanager" "kvm" "wheel" "input" "video" "lp" "scanner" "libvirt" "libvirt-qemu" "libvirtd" "pipewire" "gamemode" ];
packages = with pkgs; [
webcord
discord