commit 6fef5fcecc58afff5674e60fd0146f1adedc82ae
parent 2b244d77ea6ddba3a35ba41f63091dd25b425904
Author: Milutin Popovic <milutin@popovic.xyz>
Date: Sun, 12 Apr 2026 14:28:51 +0100
update
Diffstat:
9 files changed, 152 insertions(+), 44 deletions(-)
diff --git a/flake.nix b/flake.nix
@@ -73,6 +73,7 @@
hostName
system
isDarwin
+ isWayland
;
};
modules = [
diff --git a/hosts/frame/configuration.nix b/hosts/frame/configuration.nix
@@ -4,7 +4,6 @@
hostName,
inputs,
isDarwin,
- isWayland,
...
}:
{
@@ -12,9 +11,6 @@
../../users/root.nix
../../modules/nix-settings.nix
../../modules/nm.nix
- ]
- + lib.optionals (isWayland) [
- ../../modules/niri-resume-hook.nix
];
sops.defaultSopsFile = ../../secrets.yaml;
diff --git a/hosts/frame/hardware.nix b/hosts/frame/hardware.nix
@@ -1,40 +1,53 @@
-{ config, lib, modulesPath, ... }:
+{
+ config,
+ lib,
+ modulesPath,
+ ...
+}:
{
- imports =
- [
- (modulesPath + "/installer/scan/not-detected.nix")
- ];
+ imports = [
+ (modulesPath + "/installer/scan/not-detected.nix")
+ ];
- boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" "usb_storage" ];
- boot.initrd.kernelModules = [ "dm-snapshot" "cryptd" ];
- boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/68d936fb-68be-4351-a557-874ef2d96efc"; # <--
+ boot.initrd.availableKernelModules = [
+ "nvme"
+ "xhci_pci"
+ "thunderbolt"
+ "usbhid"
+ "usb_storage"
+ ];
+ boot.initrd.kernelModules = [
+ "dm-snapshot"
+ "cryptd"
+ ];
+ boot.initrd.luks.devices."cryptroot".device =
+ "/dev/disk/by-uuid/68d936fb-68be-4351-a557-874ef2d96efc";
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
- fileSystems."/" =
- {
- device = "/dev/disk/by-uuid/adc85ee5-286c-44aa-9dfa-4580e59687dc";
- fsType = "ext4";
- };
- fileSystems."/home" =
- {
- device = "/dev/disk/by-uuid/2e36575d-3dc4-4760-9bc1-9bf055371805";
- fsType = "ext4";
- };
+ fileSystems."/" = {
+ device = "/dev/disk/by-uuid/adc85ee5-286c-44aa-9dfa-4580e59687dc";
+ fsType = "ext4";
+ };
+ fileSystems."/home" = {
+ device = "/dev/disk/by-uuid/2e36575d-3dc4-4760-9bc1-9bf055371805";
+ fsType = "ext4";
+ };
- fileSystems."/boot" =
- {
- device = "/dev/disk/by-uuid/F656-048E";
- fsType = "vfat";
- options = [ "fmask=0022" "dmask=0022" ];
- };
-
- swapDevices =
- [
- { device = "/dev/disk/by-uuid/f1c0a91f-0460-4ba8-a414-f49c90dfa399"; }
+ fileSystems."/boot" = {
+ device = "/dev/disk/by-uuid/F656-048E";
+ fsType = "vfat";
+ options = [
+ "fmask=0022"
+ "dmask=0022"
];
+ };
+
+ swapDevices = [
+ { device = "/dev/disk/by-uuid/f1c0a91f-0460-4ba8-a414-f49c90dfa399"; }
+ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.enableAllFirmware = true;
diff --git a/modules/dotfiles.nix b/modules/dotfiles.nix
@@ -8,7 +8,7 @@
nvim-config = builtins.fetchGit {
url = "git://popovic.xyz/config.nvim.git";
ref = "master";
- rev = "245555e22829a513703b9a0c6508a6cc35492e0a";
+ rev = "08e0b1d01183f6cade6e29420d46a6e6aecdf115";
};
}
diff --git a/modules/niri-resume-hook.nix b/modules/niri-resume-hook.nix
@@ -3,19 +3,92 @@
let
user = "mika";
uid = toString config.users.users.${user}.uid;
+
+ niriWakeupMonitors = pkgs.writeShellScriptBin "niri-wakeup-monitors" ''
+ #!${pkgs.bash}/bin/bash
+ set -euo pipefail
+
+ mon_n="BOE 0x0BCA Unknown"
+ mon_l="PNP(BNQ) BenQ GL2760 H3E04203019"
+ mon_r="PNP(BNQ) BenQ GL2760 SCF04101019"
+
+ niri="${pkgs.niri}/bin/niri"
+ grep="${pkgs.gnugrep}/bin/grep"
+ wc="${pkgs.coreutils}/bin/wc"
+ tr="${pkgs.coreutils}/bin/tr"
+ seq="${pkgs.coreutils}/bin/seq"
+
+ active_connection() {
+ count=$("$niri" msg outputs | "$grep" -E "H3E04203019|SCF04101019" | "$wc" -l | "$tr" -d ' ')
+ [ "$count" -eq 2 ]
+ }
+
+ move_workspaces() {
+ local monitor="$1"
+ local direction="$2"
+
+ for nw in $("$seq" 1 9); do
+ "$niri" msg action \
+ move-workspace-to-monitor \
+ --reference "$direction$nw" \
+ "$monitor"
+ done
+
+ "$niri" msg action focus-monitor "$monitor"
+
+ for nw in $("$seq" 1 9); do
+ "$niri" msg action \
+ move-workspace-to-index \
+ --reference "$direction$nw" \
+ "$nw"
+ done
+ }
+
+ mulmon_activate() {
+ "$niri" msg output "$mon_l" on
+ "$niri" msg output "$mon_r" on
+ move_workspaces "$mon_l" "l"
+ move_workspaces "$mon_r" "r"
+ "$niri" msg output "$mon_n" off
+ }
+
+ mulmon_deactivate() {
+ "$niri" msg output "$mon_n" on
+ move_workspaces "$mon_n" "r"
+ move_workspaces "$mon_n" "l"
+ "$niri" msg output "$mon_l" off
+ "$niri" msg output "$mon_r" off
+ }
+
+ if active_connection; then
+ mulmon_activate
+ else
+ mulmon_deactivate
+ fi
+ '';
in
{
+ environment.systemPackages = [ niriWakeupMonitors ];
+
environment.etc."systemd/system-sleep/niri-wakeup-monitors" = {
mode = "0755";
text = ''
#!${pkgs.bash}/bin/bash
+ set -euo pipefail
+
# args: pre|post suspend|hibernate|hybrid-sleep|suspend-then-hibernate
- if [ "$1" = "post" ]; then
- # run in the user session context so niri IPC works
+ if [ "''${1:-}" = "post" ]; then
exec ${pkgs.util-linux}/bin/runuser -u ${user} -- \
env XDG_RUNTIME_DIR=/run/user/${uid} \
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus \
- niri-wakeup-monitors
+ ${pkgs.bash}/bin/bash -lc '
+ # wait briefly for niri IPC to be ready after resume
+ for i in $(seq 1 30); do
+ ${pkgs.niri}/bin/niri msg -q outputs >/dev/null 2>&1 && break
+ sleep 0.2
+ done
+ ${niriWakeupMonitors}/bin/niri-wakeup-monitors
+ '
fi
'';
};
diff --git a/modules/niri.nix b/modules/niri.nix
@@ -178,7 +178,7 @@
enable = true;
width = 4;
active = {
- color = "#A96C8A";
+ color = "#ffc87f";
};
inactive = {
color = "#263238";
diff --git a/modules/noctalia.nix b/modules/noctalia.nix
@@ -10,7 +10,7 @@
mError = "#ff6b6b";
mOnError = "#0b0f14";
- mPrimary = "#A96C8A";
+ mPrimary = "#bababa";
mOnPrimary = "#ffffff";
mSecondary = "#6CA98A";
@@ -22,7 +22,7 @@
mSurfaceVariant = "#111827";
mOnSurfaceVariant = "#c9d1d9";
- mTertiary = "#c583d0";
+ mTertiary = "#ffc87f";
mOnTertiary = "#07130a";
mHover = "#1f2937";
diff --git a/modules/systemd-services.nix b/modules/systemd-services.nix
@@ -32,5 +32,28 @@
WantedBy = [ "timers.target" ];
};
};
+ services.niri-wakeup-monitors = {
+ Unit = {
+ Description = "Wake up external monitors after resume (niri)";
+ After = [
+ "suspend.target"
+ "hibernate.target"
+ "systemd-suspend-then-hibernate.target"
+ ];
+ };
+
+ Service = {
+ Type = "oneshot";
+ ExecStart = "${pkgs.zsh}/bin/zsh -c 'niri-wakeup-monitors'";
+ };
+
+ Install = {
+ WantedBy = [
+ "suspend.target"
+ "hibernate.target"
+ "systemd-suspend-then-hibernate.target"
+ ];
+ };
+ };
};
}
diff --git a/users/root.nix b/users/root.nix
@@ -8,11 +8,13 @@ let
in
{
environment.pathsToLink =
- [ ]
- + lib.optionals (!isDarwin) [
- "/share/applications"
- "/share/xdg-desktop-portal"
- ];
+ if (!isDarwin) then
+ [
+ "/share/applications"
+ "/share/xdg-desktop-portal"
+ ]
+ else
+ [ ];
home-manager = {
useGlobalPkgs = true;