greetd: Make input and output configurable

This commit is contained in:
Erwin Boskma 2023-11-30 11:50:10 +01:00
parent fa8900d4d5
commit 51fc7131c1
Signed by: erwin
SSH key fingerprint: SHA256:3F6Cm6I3erRqlBwEghZWAQl6eS5WrGTX1Vs/Evec1lQ
2 changed files with 56 additions and 5 deletions

View file

@ -15,6 +15,8 @@
microvm.nixosModules.host microvm.nixosModules.host
./outline.nix
../../users/erwin ../../users/erwin
../../users/root ../../users/root
]; ];
@ -52,6 +54,30 @@
sway = true; sway = true;
wayvnc = true; wayvnc = true;
wallpaper = ../../wallpapers/river-3840.png; wallpaper = ../../wallpapers/river-3840.png;
output = {
"DP-1" = {
bg = "${../../wallpapers/river-3840.png} fill";
mode = "3840x2160@60Hz";
position = "0 0";
};
"DP-3" = {
bg = "${../../wallpapers/river-3840.png} fill";
mode = "3840x2160@60Hz";
position = "3840 0";
};
};
input = {
"1241:662:USB-HID_Keyboard" = {
xkb_layout = "us,us";
xkb_variant = "colemak,";
xkb_options = "lv3:ralt_switch,eurosign:5,caps:backspace,ctrl:nocaps,grp:sclk_toggle,grp_led:scroll";
xkb_numlock = "enabled";
};
"1133:49257:Logitech_USB_Laser_Mouse" = {
natural_scroll = "enabled";
pointer_accel = "1";
};
};
}; };
kanata = { kanata = {
enable = false; enable = false;
@ -320,11 +346,15 @@
}; };
}; };
# sops = { sops = {
# defaultSopsFile = ./secrets.yaml; defaultSopsFile = ./secrets.yaml;
# secrets = {}; secrets = {
# }; outline-keycloak-secret = {
owner = "outline";
};
};
};
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions

View file

@ -23,6 +23,15 @@ with lib; let
''; '';
envVars = concatStringsSep " " (builtins.attrNames config.environment.sessionVariables); envVars = concatStringsSep " " (builtins.attrNames config.environment.sessionVariables);
moduleStr = moduleType: name: attrs: ''
${moduleType} "${name}" {
${builtins.concatStringsSep "\n" (lib.mapAttrsToList (name: value: "${name} ${value}") attrs)}
}
'';
inputStr = moduleStr "input";
outputStr = moduleStr "output";
in in
{ {
options.eboskma.greetd = { options.eboskma.greetd = {
@ -30,6 +39,16 @@ in
sway = mkEnableOption "sway"; sway = mkEnableOption "sway";
steam = mkEnableOption "steam"; steam = mkEnableOption "steam";
wayvnc = mkEnableOption "wayvnc"; wayvnc = mkEnableOption "wayvnc";
output = mkOption {
description = "An attribute set that defines output modules. See the sway-output(5) manpage for options";
type = types.attrsOf (types.attrsOf types.str);
default = { };
};
input = mkOption {
description = "An attribute set that defines input modules. See the sway-input(5) manpage for options";
type = types.attrsOf (types.attrsOf types.str);
default = { };
};
wallpaper = mkOption { wallpaper = mkOption {
description = "Path to an image to use as wallpaper"; description = "Path to an image to use as wallpaper";
type = types.path; type = types.path;
@ -90,7 +109,9 @@ in
exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -s /etc/greetd/gtkgreet.css -b ${cfg.wallpaper}; swaymsg exit" exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -s /etc/greetd/gtkgreet.css -b ${cfg.wallpaper}; swaymsg exit"
include /etc/sway/config.d/* include /etc/sway/config.d/*
'' ''
]); ]
++ (mapAttrsToList inputStr cfg.input)
++ (mapAttrsToList outputStr cfg.output));
user = "greeter"; user = "greeter";
group = "greeter"; group = "greeter";
}; };