feat: refactor Niri configuration by removing deprecated services and scripts, and updating display management to use niri-native scripts

This commit is contained in:
2025-10-02 18:36:46 -03:00
parent ca62a6bd19
commit 86d27b80d8
8 changed files with 100 additions and 157 deletions

View File

@@ -5,10 +5,6 @@
}: {
imports = [
inputs.niri.nixosModules.niri
(import ./niri/waybar.nix)
(import ./niri/swayidle.nix)
(import ./niri/fuzzel.nix)
(import ./niri/swaylock.nix)
];
programs.niri.enable = true;

View File

@@ -1,8 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [fuzzel];
# Provide a simple system-wide wrapper script in /etc/profile.d or /etc to make fuzzel available
environment.etc."profile.d/fuzzel.sh".text = ''
export PATH="${pkgs.fuzzel}/bin:$PATH"
'';
}

View File

@@ -1,13 +0,0 @@
{pkgs, ...}: {
# Install swayidle and configure a systemd user service for idle locking
environment.systemPackages = with pkgs; [swayidle swaylock inotify-tools];
systemd.user.services.swayidle = {
description = "swayidle for Niri sessions";
wantedBy = ["default.target"];
serviceConfig = {
ExecStart = "${pkgs.swayidle}/bin/swayidle -w 'timeout 300 ${pkgs.swaylock}/bin/swaylock -f' resume 'swaymsg resume'";
Restart = "on-failure";
};
};
}

View File

@@ -1,9 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [swaylock imagemagick];
# Provide a system-level helper in /etc/profile.d to point to a lock wrapper
environment.etc."profile.d/lockwrapper.sh".text = ''
#!/bin/sh
export LOCK_WRAPPER="${pkgs.swaylock}/bin/swaylock"
'';
}

View File

@@ -1,23 +0,0 @@
{pkgs, ...}: {
# Install waybar system-wide and provide a systemd user service to start it for graphical users
environment.systemPackages = with pkgs; [waybar jq wl-clipboard];
systemd.user.services.waybar = {
description = "Waybar for Niri sessions";
wantedBy = ["default.target"];
serviceConfig = {
ExecStart = "${pkgs.waybar}/bin/waybar";
Restart = "on-failure";
RestartSec = 2;
};
};
# Optionally provide a default system-level config in /etc/xdg/waybar/config
environment.etc."xdg/waybar/config".text = ''
{
"modules-left": ["workspace"],
"modules-center": [],
"modules-right": ["clock"]
}
'';
}

View File

@@ -33,29 +33,31 @@ in {
};
};
systemd.user.services.watchDisplays = {
description = "set screens on keyboard event";
wantedBy = ["default.target"];
after = ["graphical-session.target"];
# DISABLED: Old gnome-monitor-config approach - now using niri-native zenbook-screen.nix
# systemd.user.services.watchDisplays = {
# description = "set screens on keyboard event";
# wantedBy = ["default.target"];
# after = ["graphical-session.target"];
path = [pkgs.gnome-monitor-config pkgs.usbutils pkgs.inotify-tools];
serviceConfig = {
preStart = "${patchedDuoScript} normal";
ExecStart = "${patchedDuoScript} watch-displays";
Restart = "always";
RestartSec = 5;
};
};
# path = [pkgs.gnome-monitor-config pkgs.usbutils pkgs.inotify-tools];
# serviceConfig = {
# preStart = "${patchedDuoScript} normal";
# ExecStart = "${patchedDuoScript} watch-displays";
# Restart = "always";
# RestartSec = 5;
# };
# };
systemd.user.services.watchRotation = {
description = "rotate screens";
wantedBy = ["default.target"];
after = ["graphical-session.target"];
path = [pkgs.gnome-monitor-config pkgs.iio-sensor-proxy];
serviceConfig = {
ExecStart = "${patchedDuoScript} watch-rotation";
Restart = "always";
RestartSec = 5;
};
};
# DISABLED: Old rotation script - conflicts with niri
# systemd.user.services.watchRotation = {
# description = "rotate screens";
# wantedBy = ["default.target"];
# after = ["graphical-session.target"];
# path = [pkgs.gnome-monitor-config pkgs.iio-sensor-proxy];
# serviceConfig = {
# ExecStart = "${patchedDuoScript} watch-rotation";
# Restart = "always";
# RestartSec = 5;
# };
# };
}

View File

@@ -14,27 +14,34 @@
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "vmd" "nvme" "usbhid"];
boot.initrd.kernelModules = [];
boot.kernelPackages = pkgs.linuxPackages_zen;
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelModules = ["kvm-intel" "evdi" "intel_vpu"];
boot.kernelParams = [
"i915.enable_guc=3"
#"i915.enable_psr=0"
# Suppress rfkill/WLAN toggle events from asus-wmi
"asus_nb_wmi.wapf=4"
];
boot.kernelPatches = [
/*
{
name = "zenbook-asus-wmi";
patch = ./zenbook-asus-wmi.patch;
}
*/
/*
{
name = "zenbook-duo-suppress-rfkill-on-kbd-connect";
patch = ./zenbook-duo-suppress-rfkill-on-kbd-connect.patch;
}
*/
# Both patches are malformed/outdated and don't apply to current kernel versions
# Using alternative approach with extraModprobeConfig below
];
# Suppress rfkill events from keyboard attach/detach
services.udev.extraRules = ''
# Zenbook Duo - suppress rfkill/airplane mode key events on keyboard connect/disconnect
SUBSYSTEM=="input", ATTRS{name}=="Asus WMI hotkeys", ENV{KEY_RFKILL}="0", ENV{KEY_WLAN}="0"
'';
# Hardware database override to disable rfkill key on ASUS WMI hotkeys
services.udev.extraHwdb = ''
evdev:name:Asus WMI hotkeys:dmi:*
KEYBOARD_KEY_88=unknown
KEYBOARD_KEY_5d=unknown
KEYBOARD_KEY_5e=unknown
KEYBOARD_KEY_5f=unknown
'';
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction