From 99816f0d3fc4684d3cccc94705b3f5e2e8c8c8c4 Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Mon, 2 Dec 2024 14:28:35 -0600 Subject: [PATCH] modularize system graphics settings --- sys/modules/default.nix | 1 + sys/modules/graphics.nix | 25 ++++++++++++++++++++++++ sys/modules/virtualisation.nix | 23 ++++++++++++++++++++++ sys/platforms/posixlycorrect/default.nix | 20 +------------------ 4 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 sys/modules/graphics.nix create mode 100644 sys/modules/virtualisation.nix diff --git a/sys/modules/default.nix b/sys/modules/default.nix index eed6ea4..49af04c 100644 --- a/sys/modules/default.nix +++ b/sys/modules/default.nix @@ -8,5 +8,6 @@ ./baseline.nix ./yubikey.nix ./audio.nix + ./graphics.nix ]; } diff --git a/sys/modules/graphics.nix b/sys/modules/graphics.nix new file mode 100644 index 0000000..98fa94a --- /dev/null +++ b/sys/modules/graphics.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.local.sys.graphics; +in { + options.local.sys.graphics = { + enable = mkEnableOption "graphics settings"; + }; + config = mkIf cfg.enable { + services.xserver = { + enable = true; + xkb.layout = "us"; #TODO + displayManager.startx.enable = true; #TODO maybe crear un modulo para ly? + libinput.enable = true; + }; + + hardware.graphics.enable = true; + + programs.dconf.enable = true; + }; +} diff --git a/sys/modules/virtualisation.nix b/sys/modules/virtualisation.nix new file mode 100644 index 0000000..0ff9627 --- /dev/null +++ b/sys/modules/virtualisation.nix @@ -0,0 +1,23 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.local.sys.virtualisation; +in { + options.local.sys.virtualisation = { + enable = mkEnableOption "virtualisation settings"; + }; + config = mkIf cfg.enable { + virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm; + virtualisation.libvirtd.qemu.ovmf.enable = true; + virtualisation.libvirtd.qemu.ovmf.packages = [pkgs.OVMFFull.fd]; + virtualisation.libvirtd.enable = true; + programs.dconf.enable = true; + # boot.kernelModules = [ "vfio" "vfio_iommu_type1" "vfio_pci" "vfio_virqfd" ]; + # boot.kernelParams = [ "amd_iommu=on" "iommu=pt" "vfio-pci.ids=1002:699f,1002:aae0" "video=efifb:off" ]; + virtualisation.libvirtd.onBoot = "start"; + }; +} diff --git a/sys/platforms/posixlycorrect/default.nix b/sys/platforms/posixlycorrect/default.nix index 3497bd1..f1974a5 100644 --- a/sys/platforms/posixlycorrect/default.nix +++ b/sys/platforms/posixlycorrect/default.nix @@ -17,6 +17,7 @@ yubikey.enable = true; audio.enable = true; + graphics.enable = true; }; # Use the systemd-boot EFI boot loader. @@ -41,16 +42,6 @@ # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; - # Enable the X11 windowing system. - services.xserver = { - enable = true; - xkb.layout = "us"; - displayManager.startx.enable = true; - }; - services.libinput.enable = true; - - hardware.graphics.enable = true; - users = { users.fabian = { isNormalUser = true; @@ -65,13 +56,4 @@ services.udev.packages = [ pkgs.android-udev-rules ]; - - virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm; - virtualisation.libvirtd.qemu.ovmf.enable = true; - virtualisation.libvirtd.qemu.ovmf.packages = [pkgs.OVMFFull.fd]; - virtualisation.libvirtd.enable = true; - programs.dconf.enable = true; - # boot.kernelModules = [ "vfio" "vfio_iommu_type1" "vfio_pci" "vfio_virqfd" ]; - # boot.kernelParams = [ "amd_iommu=on" "iommu=pt" "vfio-pci.ids=1002:699f,1002:aae0" "video=efifb:off" ]; - virtualisation.libvirtd.onBoot = "start"; }