feat(configurations): use host config for monitor settings

This commit is contained in:
Mohammad Rafiq 2025-07-09 04:13:24 +08:00
parent 79c7e495c8
commit 782bbcbaa3
No known key found for this signature in database
3 changed files with 25 additions and 22 deletions

View file

@ -65,6 +65,7 @@ in
pkgs, pkgs,
config, config,
hostName, hostName,
hostConfig,
... ...
}: }:
let let
@ -250,17 +251,20 @@ in
# Null the packages since we use them system wide # Null the packages since we use them system wide
package = null; package = null;
portalPackage = null; portalPackage = null;
# settings.monitor = [
# "${mainMonitor.id}, ${mainMonitor.resolution}@${mainMonitor.refresh-rate}, auto, ${mainMonitor.scale}"
# ];
settings = mkMerge [ settings = mkMerge [
(import ./_hyprland/decoration.nix) (import ./_hyprland/decoration.nix)
(import ./_hyprland/keybinds.nix { inherit pkgs; }) (import ./_hyprland/keybinds.nix { inherit pkgs; })
{ {
ecosystem.no_update_news = true; ecosystem.no_update_news = true;
xwayland.force_zero_scaling = true; xwayland.force_zero_scaling = true;
monitor = [ ", preferred, auto, 1" ]; monitor =
let
mainMonitor = hostConfig.machine.monitors.main;
in
[
"${mainMonitor.id}, ${mainMonitor.resolution}@${mainMonitor.refresh-rate}, auto, ${mainMonitor.scale}"
", preferred, auto, 1"
];
exec-once = [ exec-once = [
"uwsm app -- $LOCKSCREEN" "uwsm app -- $LOCKSCREEN"
"uwsm app -- $NOTIFICATION_DAEMON" "uwsm app -- $NOTIFICATION_DAEMON"

View file

@ -14,14 +14,12 @@
platform = "amd"; platform = "amd";
gpu = "nvidia"; gpu = "nvidia";
root.drive = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434"; root.drive = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434";
monitors = [ monitors.main = {
{ id = "desc:OOO AN-270W04K";
id = "desc:OOO AN-270W04K"; resolution = "3840x2160";
scale = "2"; refresh-rate = "60";
resolution = "3840x2160"; scale = "2";
refresh-rate = "60"; };
}
];
}; };
extraCfg.server.web-apps = { extraCfg.server.web-apps = {
comfy-ui.enable = true; comfy-ui.enable = true;

View file

@ -8,7 +8,6 @@ let
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (cfg.lib.options) mkStrOption; inherit (cfg.lib.options) mkStrOption;
inherit (lib.types) inherit (lib.types)
listOf
path path
lazyAttrsOf lazyAttrsOf
raw raw
@ -18,6 +17,14 @@ let
inherit (inputs.flake-parts.lib) mkSubmoduleOptions; inherit (inputs.flake-parts.lib) mkSubmoduleOptions;
inherit (cfg.lib.attrsets) firstAttrNameMatching; inherit (cfg.lib.attrsets) firstAttrNameMatching;
cfg = config.flake; cfg = config.flake;
monitorOpts = submodule {
options = {
id = mkStrOption "";
resolution = mkStrOption "";
refresh-rate = mkStrOption "";
scale = mkStrOption "";
};
};
userOpts = submodule { userOpts = submodule {
options = { options = {
username = mkStrOption ""; username = mkStrOption "";
@ -36,14 +43,8 @@ let
gpu = mkStrOption ""; gpu = mkStrOption "";
root.drive = mkStrOption ""; root.drive = mkStrOption "";
monitors = mkOption { monitors = mkOption {
type = listOf submodule { type = lazyAttrsOf monitorOpts;
options = { default = { };
id = mkStrOption "";
scale = mkStrOption "";
resolution = mkStrOption "";
refresh-rate = mkStrOption "";
};
};
}; };
}; };
extraCfg = mkOption { extraCfg = mkOption {