2024-06-30 02:20:12 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
2024-07-03 20:54:52 -04:00
|
|
|
self,
|
2024-06-30 02:20:12 -04:00
|
|
|
...
|
|
|
|
}: let
|
2024-06-30 12:58:09 -04:00
|
|
|
inherit (lib) getExe mkForce;
|
2024-06-29 03:45:06 -04:00
|
|
|
inherit (config.vars) mainUser;
|
2024-06-30 02:20:12 -04:00
|
|
|
|
2024-07-04 19:06:17 -04:00
|
|
|
# FIXME: switch to wayland when possible
|
2024-06-30 12:58:09 -04:00
|
|
|
defaultSession = "plasmax11";
|
2024-06-30 02:20:12 -04:00
|
|
|
|
|
|
|
switch-session = pkgs.writeShellApplication {
|
|
|
|
name = "switch-session";
|
|
|
|
|
|
|
|
text = ''
|
|
|
|
mkdir -p /etc/sddm.conf.d
|
|
|
|
|
|
|
|
cat <<EOF | tee /etc/sddm.conf.d/autologin.conf
|
|
|
|
[Autologin]
|
|
|
|
User=${mainUser}
|
|
|
|
Session=$1
|
|
|
|
Relogin=true
|
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
gaming-mode = pkgs.writeShellScriptBin "gaming-mode" ''
|
|
|
|
sudo ${pkgs.systemd}/bin/systemctl start to-gaming-mode.service
|
|
|
|
'';
|
2024-06-29 03:45:06 -04:00
|
|
|
in {
|
|
|
|
services = {
|
2024-06-30 12:58:09 -04:00
|
|
|
xserver.enable = true;
|
|
|
|
desktopManager.plasma6.enable = true;
|
2024-06-29 03:45:06 -04:00
|
|
|
|
|
|
|
displayManager = {
|
2024-06-29 22:53:47 -04:00
|
|
|
sddm = {
|
2024-06-29 03:45:06 -04:00
|
|
|
enable = true;
|
2024-06-29 23:00:49 -04:00
|
|
|
autoLogin.relogin = true;
|
|
|
|
};
|
2024-06-30 02:20:12 -04:00
|
|
|
};
|
|
|
|
};
|
2024-06-29 22:53:47 -04:00
|
|
|
|
2024-07-04 17:47:09 -04:00
|
|
|
# Sets the default session at launch
|
2024-06-30 02:20:12 -04:00
|
|
|
systemd.services."set-session" = {
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
before = ["display-manager.service"];
|
2024-06-29 03:45:06 -04:00
|
|
|
|
2024-06-30 02:20:12 -04:00
|
|
|
path = [switch-session];
|
|
|
|
|
|
|
|
script = ''
|
2024-06-30 12:58:09 -04:00
|
|
|
switch-session "${defaultSession}"
|
2024-06-30 02:20:12 -04:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-07-04 17:47:09 -04:00
|
|
|
# Allows switching to gaming mode
|
2024-06-30 02:20:12 -04:00
|
|
|
systemd.services."to-gaming-mode" = {
|
2024-06-30 12:58:09 -04:00
|
|
|
wantedBy = mkForce [];
|
2024-06-30 02:20:12 -04:00
|
|
|
|
|
|
|
path = [switch-session];
|
|
|
|
|
|
|
|
script = ''
|
|
|
|
switch-session "gamescope-wayland"
|
|
|
|
systemctl restart display-manager
|
|
|
|
sleep 10
|
2024-06-30 12:58:09 -04:00
|
|
|
switch-session "${defaultSession}"
|
2024-06-30 02:20:12 -04:00
|
|
|
'';
|
2024-06-29 03:45:06 -04:00
|
|
|
};
|
|
|
|
|
2024-07-04 17:47:09 -04:00
|
|
|
# Make it so we don't need root to switch to gaming mode
|
2024-06-30 02:20:12 -04:00
|
|
|
security.sudo.extraRules = [
|
|
|
|
{
|
|
|
|
users = [mainUser];
|
|
|
|
groups = [100];
|
|
|
|
commands = [
|
|
|
|
{
|
|
|
|
command = "${pkgs.systemd}/bin/systemctl start to-gaming-mode.service";
|
|
|
|
options = ["SETENV" "NOPASSWD"];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2024-07-04 17:47:09 -04:00
|
|
|
# Add desktop entry to make it GUI friendly
|
2024-06-30 02:20:12 -04:00
|
|
|
home-manager.users.${mainUser}.xdg.desktopEntries."Gaming Mode" = {
|
|
|
|
name = "Gaming Mode";
|
|
|
|
exec = getExe gaming-mode;
|
|
|
|
icon = "steam";
|
|
|
|
terminal = false;
|
|
|
|
type = "Application";
|
|
|
|
};
|
|
|
|
|
2024-07-03 17:49:48 -04:00
|
|
|
environment.systemPackages = [
|
2024-07-04 19:06:17 -04:00
|
|
|
# Misc apps for DE
|
2024-07-03 17:49:48 -04:00
|
|
|
pkgs.firefox
|
|
|
|
pkgs.wl-clipboard
|
2024-07-03 20:54:52 -04:00
|
|
|
self.packages.${pkgs.system}.ryujinx
|
2024-06-30 02:20:12 -04:00
|
|
|
];
|
|
|
|
|
2024-06-29 03:45:06 -04:00
|
|
|
programs = {
|
|
|
|
xwayland.enable = true;
|
|
|
|
kdeconnect.enable = true;
|
2024-07-03 17:49:48 -04:00
|
|
|
|
|
|
|
steam = {
|
|
|
|
enable = true;
|
|
|
|
remotePlay.openFirewall = true;
|
|
|
|
extraCompatPackages = [
|
|
|
|
pkgs.proton-ge-bin
|
|
|
|
];
|
|
|
|
};
|
2024-06-29 03:45:06 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
# Enable flatpak support
|
|
|
|
services.flatpak.enable = true;
|
|
|
|
services.packagekit.enable = true;
|
2024-07-04 17:47:09 -04:00
|
|
|
|
|
|
|
# Jovian NixOS settings
|
2024-06-29 03:45:06 -04:00
|
|
|
jovian.steam = {
|
2024-07-04 19:06:17 -04:00
|
|
|
# Steam > Settings > System > Enable Developer Mode
|
|
|
|
# Steam > Developer > CEF Remote Debugging
|
2024-06-29 03:45:06 -04:00
|
|
|
enable = true;
|
|
|
|
user = mainUser;
|
|
|
|
|
|
|
|
desktopSession = config.services.displayManager.defaultSession;
|
|
|
|
};
|
|
|
|
|
|
|
|
jovian.decky-loader = {
|
|
|
|
enable = true;
|
|
|
|
user = mainUser;
|
2024-07-04 17:47:09 -04:00
|
|
|
stateDir = "/home/${mainUser}/.local/share/decky"; # Keep scoped to user
|
|
|
|
# https://github.com/Jovian-Experiments/Jovian-NixOS/blob/1171169117f63f1de9ef2ea36efd8dcf377c6d5a/modules/decky-loader.nix#L80-L84
|
2024-07-04 17:54:27 -04:00
|
|
|
|
|
|
|
extraPackages = with pkgs; [
|
|
|
|
# Generic packages
|
|
|
|
curl
|
|
|
|
unzip
|
|
|
|
util-linux
|
|
|
|
gnugrep
|
|
|
|
|
|
|
|
readline.out
|
|
|
|
procps
|
|
|
|
pciutils
|
|
|
|
libpulseaudio
|
|
|
|
];
|
|
|
|
|
|
|
|
extraPythonPackages = pythonPackages: with pythonPackages; [
|
|
|
|
python
|
|
|
|
];
|
2024-06-29 03:45:06 -04:00
|
|
|
};
|
2024-06-30 00:35:53 -04:00
|
|
|
|
|
|
|
# Takes way too long to shutdown
|
|
|
|
systemd.services."decky-loader".serviceConfig.TimeoutStopSec = "5";
|
2024-06-29 03:45:06 -04:00
|
|
|
}
|