Skip to content

NixOS module for ThinkPads and docking stations

License

Notifications You must be signed in to change notification settings

oxzi/nixos-thinkpad-dock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NixOS Thinkpad Dock

Small NixOS module for ThinkPads to perform certain tasks during docking and undocking on the docking station. Technically this is realized by creating an acpid handler.

Usage

This repository needs to be included in the NixOS configuration. An example follows.

{ config, pkgs, ... }:

{
  imports = [
    /path/to/nixos-thinkpad-dock
  ];

  hardware = {
    thinkpad-dock = {
      enable = true;

      # Those are needed for xrandr.
      environment = ''
        export DISPLAY=:0
        export XAUTHORITY=/home/user/.Xauthority
      '';

      # Add a second monitor while docking and remove it again.
      dockEvent = ''
        ${pkgs.xorg.xrandr}/bin/xrandr --output DP-2-1 --mode 1920x1080 --right-of eDP-1
      '';
      undockEvent = ''
        ${pkgs.xorg.xrandr}/bin/xrandr --output DP-2-1 --off
      '';
    };
  };
}

About

NixOS module for ThinkPads and docking stations

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published