From fa69a8a7472ecc77f90e1153abba652616276536 Mon Sep 17 00:00:00 2001 From: Myned Date: Mon, 30 Dec 2024 17:33:20 +0000 Subject: [PATCH] niri: add output options Signed-off-by: Myned --- machines/mynix/default.nix | 1 + machines/myork/default.nix | 19 ++----------- options/custom/desktops/niri/default.nix | 1 + options/custom/desktops/niri/output.nix | 35 ++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 options/custom/desktops/niri/output.nix diff --git a/machines/mynix/default.nix b/machines/mynix/default.nix index d46c6a0..ecd5c3d 100644 --- a/machines/mynix/default.nix +++ b/machines/mynix/default.nix @@ -13,6 +13,7 @@ width = 3440; height = 1440; refresh = 100; + desktops.niri.output.connectors = ["DP-1"]; programs.looking-glass = { enable = true; diff --git a/machines/myork/default.nix b/machines/myork/default.nix index f0ea4b5..b44b617 100644 --- a/machines/myork/default.nix +++ b/machines/myork/default.nix @@ -1,11 +1,8 @@ { config, inputs, - pkgs, ... -}: let - brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl"; -in { +}: { imports = [ inputs.nixos-hardware.nixosModules.framework-13-7040-amd @@ -18,6 +15,7 @@ in { width = 2256; height = 1504; scale = 1.5; + desktops.niri.output.connectors = ["eDP-1"]; # BUG: Phoenix support not currently functional # https://github.com/Cryolitia/ryzen_smu/issues/1 @@ -54,19 +52,6 @@ in { }; home-manager.users.${config.custom.username} = { - programs.niri.settings.outputs = { - "eDP-1" = { - background-color = "#073642"; - - mode = with config.custom; { - inherit width height; - refresh = refresh + 0.0; - }; - - scale = config.custom.scale; - }; - }; - wayland.windowManager.hyprland.settings = { device = [ { diff --git a/options/custom/desktops/niri/default.nix b/options/custom/desktops/niri/default.nix index bcf173a..2d6d05f 100644 --- a/options/custom/desktops/niri/default.nix +++ b/options/custom/desktops/niri/default.nix @@ -24,6 +24,7 @@ in { input.enable = true; layout.enable = true; misc.enable = true; + output.enable = true; rules.enable = true; }; diff --git a/options/custom/desktops/niri/output.nix b/options/custom/desktops/niri/output.nix new file mode 100644 index 0000000..2be9a01 --- /dev/null +++ b/options/custom/desktops/niri/output.nix @@ -0,0 +1,35 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.custom.desktops.niri.output; +in { + options.custom.desktops.niri.output = { + enable = mkOption {default = false;}; + connectors = mkOption {default = [];}; + }; + + config = mkIf cfg.enable { + home-manager.sharedModules = [ + { + # https://github.com/YaLTeR/niri/wiki/Configuration:-Outputs + programs.niri.settings.outputs = listToAttrs (forEach cfg.connectors (connector: { + name = connector; + + value = { + background-color = "#073642"; + + mode = with config.custom; { + inherit width height; + refresh = refresh + 0.0; # Convert to float + }; + + scale = config.custom.scale; + }; + })); + } + ]; + }; +}