diff --git a/common/graphics/sway.nix b/common/graphics/sway.nix index 4bc51c6..e897c99 100644 --- a/common/graphics/sway.nix +++ b/common/graphics/sway.nix @@ -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}" { diff --git a/common/hardware/laptop.nix b/common/hardware/laptop.nix index 62ea880..28866e3 100644 --- a/common/hardware/laptop.nix +++ b/common/hardware/laptop.nix @@ -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" ]; }; }; diff --git a/common/tooling/default.nix b/common/tooling/default.nix index f553836..9827c8c 100644 --- a/common/tooling/default.nix +++ b/common/tooling/default.nix @@ -61,6 +61,8 @@ in qdirstat libva-utils gparted + jetbrains.clion + jetbrains.idea-community ]; programs.git = { diff --git a/configuration.nix b/configuration.nix index 514313c..109b6c5 100644 --- a/configuration.nix +++ b/configuration.nix @@ -4,10 +4,9 @@ ./overlays ./common ./fake_flake.nix - ./specific/grimm-nixos-laptop/configuration.nix - ./modules/users.nix - # ./modules/kvm.nix - ./sway + ./users.nix + + ./specific/grimm-nixos-laptop/configuration.nix ]; # Bootloader. @@ -16,49 +15,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"; }; } diff --git a/modules/kvm.nix b/modules/kvm.nix deleted file mode 100644 index 2854ddc..0000000 --- a/modules/kvm.nix +++ /dev/null @@ -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; -} diff --git a/specific/grimm-nixos-laptop/configuration.nix b/specific/grimm-nixos-laptop/configuration.nix index f42e3d6..1ee6b88 100644 --- a/specific/grimm-nixos-laptop/configuration.nix +++ b/specific/grimm-nixos-laptop/configuration.nix @@ -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; } diff --git a/modules/users.nix b/users.nix similarity index 74% rename from modules/users.nix rename to users.nix index 7677f02..617e340 100644 --- a/modules/users.nix +++ b/users.nix @@ -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