From dac6f1d220ae1e91477e39fdaf6c7c53ead2cfb2 Mon Sep 17 00:00:00 2001 From: ltadeu6 Date: Sun, 12 Apr 2026 18:21:24 -0300 Subject: [PATCH] Run xrandr primary fix via systemd user service --- hosts/Nixos/configuration.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hosts/Nixos/configuration.nix b/hosts/Nixos/configuration.nix index cb03d2d..31f4f44 100644 --- a/hosts/Nixos/configuration.nix +++ b/hosts/Nixos/configuration.nix @@ -5,7 +5,7 @@ { config, pkgs, lib, agenix, ... }: let - tf2XrandrPrimaryFix = pkgs.writeShellScriptBin "tf2-xrandr-primary-fix" '' + xrandrPrimaryFix = pkgs.writeShellScript "xrandr-primary-fix" '' set -euo pipefail if [ -z "''${DISPLAY:-}" ]; then @@ -13,7 +13,7 @@ let fi runtime_dir="''${XDG_RUNTIME_DIR:-/tmp}" - lock_path="$runtime_dir/tf2-xrandr-primary-fix.$UID.lock" + lock_path="$runtime_dir/xrandr-primary-fix.$UID.lock" mkdir -p "$runtime_dir" 2>/dev/null || true exec 9>"$lock_path" @@ -290,9 +290,6 @@ in { # desktopManager.gnome.enable = true; # evaluation warning: The option `services.xserver.displayManager.gdm.enable' # defined in `/etc/nixos/configuration.nix' has been renamed to `services.displayManager.gdm.enable'. - displayManager.sessionCommands = lib.mkAfter '' - ${tf2XrandrPrimaryFix}/bin/tf2-xrandr-primary-fix & - ''; }; ollama = { enable = true; @@ -578,6 +575,16 @@ in { nixpkgs.config.allowUnfree = true; + systemd.user.services.xrandr-primary-fix = { + description = "Fix primary display via xrandr after login"; + wantedBy = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = xrandrPrimaryFix; + }; + }; + # nixpkgs.config.cudaSupport = true; nix.settings.experimental-features = [ "nix-command" "flakes" ];