diff --git a/AGENT.md b/AGENT.md new file mode 100644 index 0000000..dac01ba --- /dev/null +++ b/AGENT.md @@ -0,0 +1,43 @@ +🤖 Prompt for the AI Agent: Final Systemic Refactor +System Context: +We are finalizing the architectural migration of "Nomarchy" to NixOS 25.11. We need to address systemic issues regarding non-FHS pathing, orphaned Systemd services, script interpreter paths, and UWSM integration. + +Please implement the following fixes across the system and home manager modules. + +Task 1: Fix the FHS Trap (Polkit Agent) +The Hyprland autostart config relies on a hardcoded /usr/lib/ path, which breaks GUI authentication in NixOS. + +Action 1: Instead of relying on autostart.conf to launch Polkit, create a native Home Manager systemd user service in a relevant module (e.g., modules/home/hyprland.nix or a new modules/home/security.nix). + +Action 2: Define the service to execute ${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1. Ensure it belongs to the graphical-session.target. + +Action 3: Remove the broken /usr/lib/... line from the legacy config/nomarchy/default/hypr/autostart.conf. + +Task 2: Native Systemd Migration (Battery Monitor) +The battery monitor relies on static .service and .timer files that Home Manager does not automatically enable. + +Action 1: Create a new module modules/home/battery-monitor.nix. + +Action 2: Translate the logic from config/systemd/user/nomarchy-battery-monitor.service into systemd.user.services.nomarchy-battery-monitor = { ... };. Ensure the ExecStart path points correctly to the packaged nomarchy-battery-monitor script. + +Action 3: Translate the timer into systemd.user.timers.nomarchy-battery-monitor = { ... }; and set WantedBy = [ "timers.target" ];. + +Action 4: Delete the legacy config/systemd/user/ folder to prevent confusion. Ensure battery-monitor.nix is imported into modules/home/default.nix. + +Task 3: Harden Custom Scripts (modules/home/scripts.nix) +The custom scripts in the bin/ directory will fail due to invalid #!/bin/bash shebangs and missing PATH dependencies. + +Action 1: Audit modules/home/scripts.nix. If it currently uses a standard copy or symlink approach, rewrite the packaging logic. + +Action 2: Use pkgs.stdenv.mkDerivation. In the installPhase, copy the bin/ folder, and crucially, run patchShebangs $out/bin to fix all interpreters natively. + +Action 3: (Optional but recommended) If specific scripts heavily rely on external tools (like jq), consider using wrapProgram in a postFixup phase to prepend the required package binaries to the script's PATH. + +Task 4: Enable Native UWSM (modules/system/sddm.nix or Hyprland config) +UWSM must be deeply integrated into the NixOS system layer to function correctly, not just mapped via dotfiles. + +Action 1: In the system-level configuration where Hyprland is enabled (likely modules/system/default.nix or similar), ensure programs.hyprland.withUWSM = true; is set. + +Action 2: Ensure any SDDM configurations are compatible with launching the UWSM wrapped session rather than standard Hyprland. + +Please provide the updated code blocks for the affected Nix modules. diff --git a/config/hypr/hypridle.conf b/config/hypr/hypridle.conf deleted file mode 100644 index 7eac23d..0000000 --- a/config/hypr/hypridle.conf +++ /dev/null @@ -1,28 +0,0 @@ -general { - lock_cmd = nomarchy-lock-screen # lock screen and 1password - before_sleep_cmd = loginctl lock-session # lock before suspend. - after_sleep_cmd = sleep 1 && hyprctl dispatch dpms on # delay for PAM readiness, then turn on display. - inhibit_sleep = 3 # wait until screen is locked -} - -listener { - timeout = 150 # 2.5min - on-timeout = pidof hyprlock || nomarchy-launch-screensaver # start screensaver (if we haven't locked already) -} - -listener { - timeout = 151 # 5min - on-timeout = loginctl lock-session # lock screen when timeout has passed -} - -listener { - timeout = 330 # 5.5min - on-timeout = brightnessctl -sd '*::kbd_backlight' set 0 # save state and turn off keyboard backlight - on-resume = brightnessctl -rd '*::kbd_backlight' # restore keyboard backlight -} - -listener { - timeout = 330 # 5.5min - on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed - on-resume = hyprctl dispatch dpms on && brightnessctl -r # screen on when activity is detected -} diff --git a/config/swayosd/config.toml b/config/swayosd/config.toml deleted file mode 100644 index 759cbe1..0000000 --- a/config/swayosd/config.toml +++ /dev/null @@ -1,4 +0,0 @@ -[server] -show_percentage = true -max_volume = 100 -style = "~/.config/swayosd/style.css" diff --git a/config/swayosd/style.css b/config/swayosd/style.css deleted file mode 100644 index e066560..0000000 --- a/config/swayosd/style.css +++ /dev/null @@ -1,28 +0,0 @@ -@import "../nomarchy/current/theme/swayosd.css"; - -window { - border-radius: 0; - opacity: 0.97; - border: 2px solid @border-color; - - background-color: @background-color; -} - -label { - font-family: 'JetBrainsMono Nerd Font'; - font-size: 11pt; - - color: @label; -} - -image { - color: @image; -} - -progressbar { - border-radius: 0; -} - -progress { - background-color: @progress; -} diff --git a/config/systemd/user/nomarchy-battery-monitor.service b/config/systemd/user/nomarchy-battery-monitor.service deleted file mode 100644 index 51857af..0000000 --- a/config/systemd/user/nomarchy-battery-monitor.service +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Nomarchy Battery Monitor Check -After=graphical-session.target - -[Service] -Type=oneshot -ExecStart=%h/.local/share/nomarchy/bin/nomarchy-battery-monitor -Environment=DISPLAY=:0 -LogLevelMax=warning diff --git a/config/systemd/user/nomarchy-battery-monitor.timer b/config/systemd/user/nomarchy-battery-monitor.timer deleted file mode 100644 index 4d91409..0000000 --- a/config/systemd/user/nomarchy-battery-monitor.timer +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Nomarchy Battery Monitor Timer -Requires=nomarchy-battery-monitor.service - -[Timer] -OnBootSec=1min -OnUnitActiveSec=30sec -AccuracySec=10sec - -[Install] -WantedBy=timers.target \ No newline at end of file diff --git a/modules/home/idle.nix b/modules/home/idle.nix index e867718..c3518cf 100644 --- a/modules/home/idle.nix +++ b/modules/home/idle.nix @@ -3,6 +3,35 @@ { services.hypridle = { enable = config.nomarchy.toggles.idle; - extraConfig = builtins.readFile ../../config/hypr/hypridle.conf; + extraConfig = '' + general { + lock_cmd = nomarchy-lock-screen # lock screen and 1password + before_sleep_cmd = loginctl lock-session # lock before suspend. + after_sleep_cmd = sleep 1 && hyprctl dispatch dpms on # delay for PAM readiness, then turn on display. + inhibit_sleep = 3 # wait until screen is locked + } + + listener { + timeout = 150 # 2.5min + on-timeout = pidof hyprlock || nomarchy-launch-screensaver # start screensaver (if we haven't locked already) + } + + listener { + timeout = 151 # 5min + on-timeout = loginctl lock-session # lock screen when timeout has passed + } + + listener { + timeout = 330 # 5.5min + on-timeout = brightnessctl -sd '*::kbd_backlight' set 0 # save state and turn off keyboard backlight + on-resume = brightnessctl -rd '*::kbd_backlight' # restore keyboard backlight + } + + listener { + timeout = 330 # 5.5min + on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed + on-resume = hyprctl dispatch dpms on && brightnessctl -r # screen on when activity is detected + } + ''; }; } diff --git a/modules/system/vm-guest.nix b/modules/system/vm-guest.nix new file mode 100644 index 0000000..3de4ea5 --- /dev/null +++ b/modules/system/vm-guest.nix @@ -0,0 +1,17 @@ +{ lib, ... }: + +{ + # Shared VM configuration + virtualisation.vmVariant = { + virtualisation.graphics = true; + virtualisation.qemu.options = [ "-device virtio-vga" ]; + }; + + # Dummy hardware config for VM + fileSystems."/" = { device = "/dev/disk/by-label/nixos"; }; + boot.loader.grub.device = "/dev/vda"; + boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_blk" "virtio_gpu" "virtio_net" "virtio_mmio" ]; + + # Force early KMS for Plymouth + boot.initrd.kernelModules = [ "virtio_gpu" ]; +}