Compare commits

..

2 commits

8 changed files with 62 additions and 142 deletions

View file

@ -116,7 +116,7 @@ in
let
build_definition_lines = mapAttrsToList (name: value: "set \$${name} ${value}");
build_keybind_lines = mapAttrsToList (key: value: "bindsym ${key} ${value}");
build_exec_lines = e: map (item: "${e} " + (if isString item then item else (getExe item)));
build_exec_lines = e: map (item: "${e} " + (if isDerivation item then (getExe item) else item));
build_mode_lines = mapAttrsToList (
name: value: ''
mode "${name}" {

View file

@ -18,12 +18,12 @@ in
lshw
pciutils
usbutils
opentabletdriver
ddcutil
python312Packages.py-cpuinfo
(writeShellScriptBin "lsiommu" ./lsiommu)
]
++ lib.optionals graphical [
opentabletdriver
ddcui
wootility
];
@ -57,14 +57,8 @@ in
boot = {
kernelParams = [
# "splash"
"quiet"
# "intel_iommu=on"
# "iommu=force"
# "pcie_acs_override=downstream"
# "mmio_stale_data=full,nosmt"
# "pcie_aspm=off"
]; # "vfio-pci.ids=10de:1aeb,10de:2191,10de:1aed,10de:1aec" ];
];
loader.efi.canTouchEfiVariables = true;
initrd.availableKernelModules = [
"xhci_pci"
@ -86,15 +80,10 @@ in
}))
];
kernelModules = [
# "kvm-intel"
# "vfio_pci"
# "vfio_iommu_type1"
# "vfio"
"ddcci_backlight"
"i2c-dev"
"ec_sys"
];
# blacklistedKernelModules = [ "i2c_nvidia_gpu" ];
};
};

View file

@ -61,6 +61,8 @@ in
qdirstat
libva-utils
gparted
jetbrains.clion
jetbrains.idea-community
];
programs.git = {

View file

@ -4,10 +4,7 @@
./overlays
./common
./fake_flake.nix
./specific/grimm-nixos-laptop/configuration.nix
./modules/users.nix
# ./modules/kvm.nix
./sway
./users.nix
];
# Bootloader.
@ -16,49 +13,12 @@
kernelPackages = pkgs.linuxPackages_zen;
};
# Enable flatpaks
# services.flatpak.enable = true;
grimmShared = {
enable = true;
locale = true;
printing = true;
portals = true;
network = true;
tooling = {
enable = true;
pass = true;
lilypond = true;
};
sound = {
enable = true;
midi = true;
};
graphical = true;
firefox = {
enable = true;
plugins = {
"uBlock0@raymondhill.net" = "ublock-origin";
"gdpr@cavi.au.dk" = "consent-o-matic";
"{41f9e51d-35e4-4b29-af66-422ff81c8b41}" = "disable-javascript";
"{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}" = "styl-us";
"wappalyzer@crunchlabz.com" = "wappalyzer";
"{b9db16a4-6edc-47ec-a1f4-b86292ed211d}" = "video-downloadhelper";
"{1526fba1-ac33-4dfc-99d8-163e6129f7b9}" = "reveye-ris";
};
};
cloudSync = {
enable = true;
username = "Grimmauld";
server = "cloud.grimmauld.de";
passwordFile = config.age.secrets.nextcloud_pass.path;
};
spotify.enable = true;
};
age.secrets.nextcloud_pass = {
file = ./secrets/nextcloud_pass.age;
mode = "777";
};
}

View file

@ -9,6 +9,14 @@ let
nivSources = import ./nix/sources.nix;
asGithubRef = src: "github:${src.owner}/${src.repo}/${src.rev}";
build_target = let env_host = builtins.getEnv "NIXOS_TARGET_HOST"; in if env_host != "" then env_host else builtins.replaceStrings ["\n"] [""] (lib.toLower (builtins.readFile /proc/sys/kernel/hostname));
host_modules = {
grimmauld-nixos = [
./specific/grimm-nixos-laptop/configuration.nix
];
};
nixpkgs_patches = [
{
# tlpui
@ -22,7 +30,7 @@ in
"${nivSources.agenix}/modules/age.nix"
(import "${nivSources.lix-module}/module.nix" { lix = nivSources.lix-pkg; })
(builtins.getFlake (asGithubRef nivSources.chaotic)).nixosModules.default # fixme: ideally we'd not rely on the flake syntax to load the module
];
] ++ lib.optionals (builtins.hasAttr build_target host_modules) host_modules.${build_target};
nixpkgs.hostPlatform = system;

View file

@ -1,76 +0,0 @@
{ 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
];
};
};
onBoot = "ignore";
onShutdown = "shutdown";
};
programs.virt-manager.enable = true;
virtualisation.spiceUSBRedirection.enable = true;
}

View file

@ -1,15 +1,55 @@
{ pkgs, ... }:
{ pkgs, config, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
./hardware-configuration.nix
# ./modules/kvm.nix
./../../sway
];
age.identityPaths = [ "/home/grimmauld/.ssh/id_ed25519" ];
grimmShared = {
tooling = {
pass = true;
lilypond = true;
};
gaming = true;
printing = true;
portals = true;
sound = {
enable = true;
midi = true;
};
graphical = true;
firefox = {
enable = true;
plugins = {
"uBlock0@raymondhill.net" = "ublock-origin";
"gdpr@cavi.au.dk" = "consent-o-matic";
"{41f9e51d-35e4-4b29-af66-422ff81c8b41}" = "disable-javascript";
"{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}" = "styl-us";
"wappalyzer@crunchlabz.com" = "wappalyzer";
"{b9db16a4-6edc-47ec-a1f4-b86292ed211d}" = "video-downloadhelper";
"{1526fba1-ac33-4dfc-99d8-163e6129f7b9}" = "reveye-ris";
};
};
cloudSync = {
enable = true;
username = "Grimmauld";
server = "cloud.grimmauld.de";
passwordFile = config.age.secrets.nextcloud_pass.path;
};
spotify.enable = true;
};
age.secrets.nextcloud_pass = {
file = ./../../secrets/nextcloud_pass.age;
mode = "777";
};
networking.hostName = "grimmauld-nixos";
system.stateVersion = "23.05";
grimmShared.gaming = true;
}

View file

@ -9,7 +9,7 @@
isNormalUser = true;
# shell = pkgs.xonsh;
description = "grimmauld";
extraGroups = [
extraGroups = lib.intersectLists (lib.attrNames config.users.groups) [
"networkmanager"
"kvm"
"wheel"
@ -23,7 +23,7 @@
"pipewire"
"gamemode"
"i2c"
];
]; # only add to groups that actually exist on this system
syncPaths = [
{ remote = "3d"; }
@ -32,10 +32,7 @@
{ remote = "Videos"; }
];
packages = with pkgs; [
jetbrains.clion
jetbrains.idea-community
packages = with pkgs; lib.optionals config.grimmShared.graphical [
webcord
discord
obs-studio