feat: niri - define configs via home-manager

This commit is contained in:
Ryan Yin
2025-08-20 00:47:30 +08:00
parent 69eee64e7e
commit ce4588d0c2
5 changed files with 655 additions and 44 deletions

View File

@@ -1,8 +1,11 @@
{ config, ... }:
{ config, niri, ... }:
let
hostName = "shoukei"; # Define your hostname.
in
{
programs.ssh.matchBlocks."github.com".identityFile =
"${config.home.homeDirectory}/.ssh/${hostName}";
modules.desktop.hyprland = {
nvidia = false;
settings.source = [
@@ -10,6 +13,35 @@ in
];
};
programs.ssh.matchBlocks."github.com".identityFile =
"${config.home.homeDirectory}/.ssh/${hostName}";
modules.desktop.niri = {
settings =
let
inherit (niri.lib.kdl)
node
plain
leaf
flag
;
in
[
(node "output" "eDP-1" [
(leaf "scale" 1.5)
(leaf "transform" "normal")
(leaf "mode" "2560x1600@60")
(leaf "position" {
x = 0;
y = 0;
})
])
# Settings for debugging. Not meant for normal use.
# These can change or stop working at any point with little notice.
(plain "debug" [
# Override the DRM device that niri will use for all rendering.
# Fix: niri fails to correctly detect the primary render device
(leaf "render-drm-device" "/dev/dri/renderD128")
])
];
};
}

View File

@@ -1,13 +1,68 @@
{ config, ... }:
{ config, niri, ... }:
{
modules.desktop = {
hyprland = {
nvidia = true;
settings.source = [
"${config.home.homeDirectory}/nix-config/hosts/idols-ai/hypr-hardware.conf"
];
};
programs.ssh.matchBlocks."github.com".identityFile = "${config.home.homeDirectory}/.ssh/idols-ai";
modules.desktop.hyprland = {
nvidia = true;
settings.source = [
"${config.home.homeDirectory}/nix-config/hosts/idols-ai/hypr-hardware.conf"
];
};
programs.ssh.matchBlocks."github.com".identityFile = "${config.home.homeDirectory}/.ssh/idols-ai";
modules.desktop.niri = {
settings =
let
inherit (niri.lib.kdl)
node
plain
leaf
flag
;
in
[
# running `niri msg outputs` to find outputs
(node "output" "DP-2" [
# Uncomment this line to disable this output.
# (flag "off")
# Scale is a floating-point number, but at the moment only integer values work.
(leaf "scale" 1.5)
# Transform allows to rotate the output counter-clockwise, valid values are:
# normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270.
(leaf "transform" "normal")
# Resolution and, optionally, refresh rate of the output.
# The format is "<width>x<height>" or "<width>x<height>@<refresh rate>".
# If the refresh rate is omitted, niri will pick the highest refresh rate
# for the resolution.
# If the mode is omitted altogether or is invalid, niri will pick one automatically.
# Run `niri msg outputs` while inside a niri instance to list all outputs and their modes.
(leaf "mode" "3840x2160@144")
# Position of the output in the global coordinate space.
# This affects directional monitor actions like "focus-monitor-left", and cursor movement.
# The cursor can only move between directly adjacent outputs.
# Output scale has to be taken into account for positioning:
# outputs are sized in logical, or scaled, pixels.
# For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080,
# so to put another output directly adjacent to it on the right, set its x to 1920.
# It the position is unset or results in an overlap, the output is instead placed
# automatically.
(leaf "position" {
x = 0;
y = 0;
})
])
(node "output" "HDMI-A-1" [
(leaf "scale" 1.5)
(leaf "transform" "normal")
(leaf "mode" "3840x2160@60")
(leaf "position" {
x = 2560; # on the right of DP-2
y = 0;
})
])
];
};
}