40 lines
1.1 KiB
Nix
40 lines
1.1 KiB
Nix
|
{ lib, pkgs, config, ...}: let
|
||
|
inherit (lib) mkIf mkEnableOption mkOption types;
|
||
|
cfg = config.chuj.stuff.autorandr;
|
||
|
user = config.chuj.system.user;
|
||
|
in {
|
||
|
options.chuj.stuff.autorandr = {
|
||
|
enable = mkEnableOption "autorandr";
|
||
|
fingerprint = mkOption {
|
||
|
type = types.attrs;
|
||
|
default = null;
|
||
|
};
|
||
|
config = mkOption {
|
||
|
type = types.attrs;
|
||
|
default = null;
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
home-manager.users.${user} = {
|
||
|
programs.autorandr = {
|
||
|
enable = true;
|
||
|
profiles."main" = { inherit (cfg) fingerprint config; };
|
||
|
};
|
||
|
# the autorandr service from home-manager sucks, can't customize flags
|
||
|
services.autorandr.enable = false;
|
||
|
systemd.user.services.autorandr = {
|
||
|
Unit = {
|
||
|
Description = "autorandr";
|
||
|
After = [ "graphical-session-pre.target" ];
|
||
|
PartOf = [ "graphical-session.target" ];
|
||
|
};
|
||
|
Service = {
|
||
|
Type = "oneshot";
|
||
|
ExecStart = "${pkgs.autorandr}/bin/autorandr --match-edid -l main";
|
||
|
};
|
||
|
Install.WantedBy = [ "graphical-session.target" ];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|