dotfiles

My PC Dotfiles & Website

modules/hardware/laptop.nix (1341B)


 1## Laptop Configuration ##
 2{config, ...}: let
 3  inherit (config.flake) files;
 4in {
 5  flake.modules = {
 6    nixos.laptop = _: {
 7      services.logind.settings.Login = {
 8        KillUserProcesses = true;
 9
10        # Power Button
11        HandlePowerKey = "poweroff";
12        HandlePowerKeyLongPress = "reboot";
13
14        # Lid
15        HandleLidSwitch = "lock";
16        HandleLidSwitchDocked = "ignore";
17      };
18
19      # Touchpad
20      services.libinput = {
21        enable = true;
22        touchpad = {
23          tapping = true;
24          tappingDragLock = true;
25          middleEmulation = true;
26          naturalScrolling = false;
27          disableWhileTyping = true;
28          scrollMethod = "twofinger";
29          accelSpeed = "0.7";
30        };
31      };
32
33      # Battery
34      powerManagement = {
35        enable = true;
36        powertop.enable = true;
37      };
38    };
39
40    homeManager.laptop = {pkgs, ...}: {
41      # Audio
42      home.file.".config/autostart/audio-tweaks.desktop".text = ''
43        [Desktop Entry]
44        Type=Application
45        Name=audio-tweaks
46        Exec=${
47          pkgs.writeShellApplication {
48            name = "audio";
49            text = files.scripts.audio;
50            runtimeInputs = with pkgs; [
51              glib
52              playerctl
53            ];
54          }
55        }/bin/audio
56      '';
57    };
58  };
59}