diff --git a/common/graphics/default.nix b/common/graphics/default.nix new file mode 100644 index 0000000..e1f83d6 --- /dev/null +++ b/common/graphics/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ./qt.nix + ./opengl.nix + ./sway.nix + ]; +} diff --git a/common/opengl.nix b/common/graphics/opengl.nix similarity index 100% rename from common/opengl.nix rename to common/graphics/opengl.nix diff --git a/common/qt.nix b/common/graphics/qt.nix similarity index 100% rename from common/qt.nix rename to common/graphics/qt.nix diff --git a/common/sway.nix b/common/graphics/sway.nix similarity index 98% rename from common/sway.nix rename to common/graphics/sway.nix index 5e5882a..03ac048 100644 --- a/common/sway.nix +++ b/common/graphics/sway.nix @@ -156,8 +156,8 @@ in export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" export _JAVA_AWT_WM_NONREPARENTING=1 export MOZ_ENABLE_WAYLAND=1 - # export WLR_RENDERER=vulkan - # export DRI_PRIME=1 + export WLR_RENDERER=vulkan + export DRI_PRIME=1 # export MESA_LOADER_DRIVER_OVERRIDE="zink" ''; }; diff --git a/common/laptop_hardware.nix b/common/laptop_hardware.nix index d6822b0..01c8d9e 100644 --- a/common/laptop_hardware.nix +++ b/common/laptop_hardware.nix @@ -17,6 +17,8 @@ in services.ddccontrol.enable = true; powerManagement.scsiLinkPolicy = lib.mkIf (!config.services.tlp.enable) "min_power"; hardware.i2c.enable = true; + services.xserver.libinput.enable = true; + powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; boot = { kernelParams = [ @@ -29,10 +31,11 @@ in "pcie_aspm=off" ]; # "vfio-pci.ids=10de:1aeb,10de:2191,10de:1aed,10de:1aec" ]; kernelModules = [ "kvm-intel" "vfio_pci" "vfio_iommu_type1" "vfio" "i2c-dev" ]; + blacklistedKernelModules = ["i2c_nvidia_gpu"]; }; services.power-profiles-daemon.enable = false; - powerManagement.powertop.enable = true; + # powerManagement.powertop.enable = true; services.upower.enable = true; diff --git a/common/network/bluetooth.nix b/common/network/bluetooth.nix new file mode 100644 index 0000000..487ca84 --- /dev/null +++ b/common/network/bluetooth.nix @@ -0,0 +1,20 @@ +{ pkgs, config, lib, ... }: +let + cfg = config.grimmShared; +in +{ + config = with cfg; lib.mkIf (enable && network && config.hardware.bluetooth.enable ) { + services.blueman.enable = lib.mkIf graphical true; + + environment.systemPackages = with pkgs; [ + bluetuith + ] ++ lib.optional sound pkgs.bluez; + + systemd.user.services.mpris-proxy = lib.mkIf sound { + description = "Mpris proxy"; + after = [ "network.target" "sound.target" ]; + wantedBy = [ "default.target" ]; + serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; + }; + }; +} diff --git a/common/networking.nix b/common/network/default.nix similarity index 55% rename from common/networking.nix rename to common/network/default.nix index db16dc3..37a933d 100644 --- a/common/networking.nix +++ b/common/network/default.nix @@ -7,23 +7,15 @@ in networking.networkmanager.enable = true; networking.useDHCP = lib.mkDefault true; - hardware.bluetooth.enable = true; + hardware.bluetooth.enable = lib.mkDefault laptop_hardware.enable; environment.systemPackages = with pkgs; [ wireguard-tools - bluetuith ]; - - services.blueman.enable = lib.mkIf graphical true; - - systemd.user.services.mpris-proxy = lib.mkIf sound { - description = "Mpris proxy"; - after = [ "network.target" "sound.target" ]; - wantedBy = [ "default.target" ]; - serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; - }; }; + imports = [ ./bluetooth.nix ]; + options.grimmShared.network = with lib; mkOption { type = types.bool; default = false; diff --git a/common/security.nix b/common/security.nix index 4b54e6d..6f687b7 100644 --- a/common/security.nix +++ b/common/security.nix @@ -6,6 +6,7 @@ in config = with cfg; lib.mkIf enable { security.polkit.enable = true; networking.firewall.enable = lib.mkIf network true; + security.rtkit.enable = true; security.doas.enable = true; security.sudo.enable = false; diff --git a/common/sound.nix b/common/sound/default.nix similarity index 94% rename from common/sound.nix rename to common/sound/default.nix index e4d9719..ca4d0db 100644 --- a/common/sound.nix +++ b/common/sound/default.nix @@ -6,7 +6,7 @@ in config = with cfg; lib.mkIf (enable && sound) { sound.enable = true; hardware.pulseaudio.enable = false; - security.rtkit.enable = true; + services.pipewire = { enable = true; alsa.enable = true; @@ -24,6 +24,10 @@ in ]; }; + imports = [ + ./spotify.nix + ]; + options.grimmShared.sound = with lib; mkOption { type = types.bool; default = false; diff --git a/common/spotify.nix b/common/sound/spotify.nix similarity index 100% rename from common/spotify.nix rename to common/sound/spotify.nix diff --git a/common/spotifyd.nix b/common/sound/spotifyd.nix similarity index 100% rename from common/spotifyd.nix rename to common/sound/spotifyd.nix diff --git a/configuration.nix b/configuration.nix index dcebfbc..9abe104 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ system, config, pkgs, ... }: { imports = [ @@ -70,8 +70,7 @@ nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.package = pkgs.nixVersions.unstable; - + nixpkgs.hostPlatform = system; programs.dconf.enable = true; - } diff --git a/load_common.nix b/load_common.nix index a715a8e..5240d10 100644 --- a/load_common.nix +++ b/load_common.nix @@ -9,17 +9,14 @@ with lib; ./common/localisation.nix ./common/printing.nix ./common/portals.nix - ./common/networking.nix + ./common/network ./common/toolchains.nix - ./common/sound.nix - ./common/opengl.nix + ./common/sound + ./common/graphics ./common/gaming.nix ./common/firefox.nix - ./common/sway.nix ./common/cloudsync.nix ./common/security.nix - ./common/qt.nix - ./common/spotify.nix ./common/laptop_hardware.nix ]; } diff --git a/specific/grimm-nixos-laptop/hardware-configuration.nix b/specific/grimm-nixos-laptop/hardware-configuration.nix index 200fc65..6ffa067 100644 --- a/specific/grimm-nixos-laptop/hardware-configuration.nix +++ b/specific/grimm-nixos-laptop/hardware-configuration.nix @@ -12,7 +12,6 @@ boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; fileSystems."/" = @@ -48,8 +47,6 @@ laptop_hardware.enable = true; }; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - hardware.bluetooth.enable = true; }