Initial legion desktop

This commit is contained in:
Nikodem Rabuliński 2023-10-02 20:02:08 +02:00
parent eb7b2a57b2
commit 49b0d48a66
5 changed files with 215 additions and 0 deletions

View file

@ -59,6 +59,7 @@
inputs.mailserver.nixosModules.default
inputs.home-manager.nixosModules.home-manager
inputs.hercules-ci-agent.nixosModules.agent-service
# inputs.nvidia-patch.nixosModules.nvidia-patch
self.nixosModules.settei
self.nixosModules.common
sharedOptions

View file

@ -9,6 +9,7 @@
./hardware.nix
# ./disks.nix
./msmtp.nix
./desktop.nix
];
nixpkgs.hostPlatform = "x86_64-linux";

102
hosts/legion/desktop.nix Normal file
View file

@ -0,0 +1,102 @@
# TODO: Proper desktop module
{
config,
pkgs,
lib,
username,
...
}: {
# Needed for nvidia and steam
nixpkgs.config.allowUnfree = true;
settei.user.config = {pkgs, ...}: {
home.packages = with pkgs; [alacritty brightnessctl dmenu];
xsession.windowManager.i3 = {
enable = true;
config = {
terminal = "alacritty";
modifier = "Mod4";
};
};
home.file.".xinitrc".source = pkgs.writeShellScript "xinitrc" ''
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
exec dbus-run-session i3
'';
};
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
gamescopeSession = {};
};
hardware.steam-hardware.enable = true;
services.logind =
lib.genAttrs
["lidSwitch" "lidSwitchDocked" "lidSwitchExternalPower"]
(_: "ignore");
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
programs.dconf.enable = true;
services.dbus.enable = true;
users.users.${username}.extraGroups = ["video" "input"];
# NVIDIA stuff
services.xserver = {
enable = true;
excludePackages = [pkgs.xterm];
videoDrivers = ["nvidia"];
layout = "pl";
displayManager.startx.enable = true;
config = lib.mkForce ''
Section "OutputClass"
Identifier "intel"
MatchDriver "i915"
Driver "modesetting"
EndSection
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "PrimaryGPU" "yes"
ModulePath "${config.hardware.nvidia.package.bin}/lib/xorg/modules"
ModulePath "${pkgs.xorg.xorgserver}/lib/xorg/modules"
EndSection
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on"
Option "TappingButtonMap" "lrm"
Option "NaturalScrolling" "true"
EndSection
'';
exportConfiguration = true;
libinput.enable = true;
};
hardware.nvidia = {
# TODO: Makes the build spiral out of control?
# patch.enable = true;
modesetting.enable = true;
};
hardware.opengl = {
enable = true;
driSupport32Bit = true;
};
}