From 79c7e495c857ee006175da39edb304ec9854f7c0 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Wed, 9 Jul 2025 03:57:16 +0800 Subject: [PATCH 1/2] feat(configurations): pass in host manifest config to home-manager --- nix/configurations.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nix/configurations.nix b/nix/configurations.nix index a8040c1..1d27ceb 100644 --- a/nix/configurations.nix +++ b/nix/configurations.nix @@ -10,10 +10,13 @@ let inherit (lib.attrsets) mapAttrs; inherit (cfg.lib.modules) forAllUsers'; cfg = config.flake; - globalCfg = name: { + globalCfg = name: hostConfig: { useGlobalPkgs = true; useUserPackages = true; - extraSpecialArgs.hostName = name; + extraSpecialArgs = { + inherit hostConfig; + hostName = name; + }; sharedModules = [ cfg.modules.homeManager.default ]; users = forAllUsers' (name: _: cfg.modules.homeManager.${name}); }; @@ -28,7 +31,7 @@ let modules = [ cfg.modules.nixos.default inputs.home-manager.nixosModules.home-manager - { home-manager = globalCfg name; } + { home-manager = globalCfg name value; } (value.extraCfg or { }) ] ++ optional value.graphical cfg.modules.nixos.graphical; } From 782bbcbaa3958a828997e8c16120585ad62bcf9b Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Wed, 9 Jul 2025 04:13:24 +0800 Subject: [PATCH 2/2] feat(configurations): use host config for monitor settings --- nix/homes/rafiq/desktop/default.nix | 14 +++++++++----- nix/manifest.nix | 14 ++++++-------- nix/meta.nix | 19 ++++++++++--------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/nix/homes/rafiq/desktop/default.nix b/nix/homes/rafiq/desktop/default.nix index e3e4ef3..9eb1fc4 100644 --- a/nix/homes/rafiq/desktop/default.nix +++ b/nix/homes/rafiq/desktop/default.nix @@ -65,6 +65,7 @@ in pkgs, config, hostName, + hostConfig, ... }: let @@ -250,17 +251,20 @@ in # Null the packages since we use them system wide package = null; portalPackage = null; - # settings.monitor = [ - # "${mainMonitor.id}, ${mainMonitor.resolution}@${mainMonitor.refresh-rate}, auto, ${mainMonitor.scale}" - # ]; - settings = mkMerge [ (import ./_hyprland/decoration.nix) (import ./_hyprland/keybinds.nix { inherit pkgs; }) { ecosystem.no_update_news = 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 = [ "uwsm app -- $LOCKSCREEN" "uwsm app -- $NOTIFICATION_DAEMON" diff --git a/nix/manifest.nix b/nix/manifest.nix index aa91702..4479b14 100644 --- a/nix/manifest.nix +++ b/nix/manifest.nix @@ -14,14 +14,12 @@ platform = "amd"; gpu = "nvidia"; root.drive = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434"; - monitors = [ - { - id = "desc:OOO AN-270W04K"; - scale = "2"; - resolution = "3840x2160"; - refresh-rate = "60"; - } - ]; + monitors.main = { + id = "desc:OOO AN-270W04K"; + resolution = "3840x2160"; + refresh-rate = "60"; + scale = "2"; + }; }; extraCfg.server.web-apps = { comfy-ui.enable = true; diff --git a/nix/meta.nix b/nix/meta.nix index 5fee0c7..0d95bd7 100644 --- a/nix/meta.nix +++ b/nix/meta.nix @@ -8,7 +8,6 @@ let inherit (lib.options) mkOption mkEnableOption; inherit (cfg.lib.options) mkStrOption; inherit (lib.types) - listOf path lazyAttrsOf raw @@ -18,6 +17,14 @@ let inherit (inputs.flake-parts.lib) mkSubmoduleOptions; inherit (cfg.lib.attrsets) firstAttrNameMatching; cfg = config.flake; + monitorOpts = submodule { + options = { + id = mkStrOption ""; + resolution = mkStrOption ""; + refresh-rate = mkStrOption ""; + scale = mkStrOption ""; + }; + }; userOpts = submodule { options = { username = mkStrOption ""; @@ -36,14 +43,8 @@ let gpu = mkStrOption ""; root.drive = mkStrOption ""; monitors = mkOption { - type = listOf submodule { - options = { - id = mkStrOption ""; - scale = mkStrOption ""; - resolution = mkStrOption ""; - refresh-rate = mkStrOption ""; - }; - }; + type = lazyAttrsOf monitorOpts; + default = { }; }; }; extraCfg = mkOption {