Format files

This commit is contained in:
Vili Sinervä 2024-07-20 17:35:00 +03:00
parent 26b6e53956
commit f4356fc733
No known key found for this signature in database
GPG key ID: DF8FEAF54EFAC996
4 changed files with 453 additions and 339 deletions

View file

@ -1,9 +1,4 @@
{
config,
pkgs,
lib,
...
}:
{ config, pkgs, ... }:
{
networking = {
hostName = "helium";

View file

@ -1,9 +1,4 @@
{
config,
pkgs,
lib,
...
}:
{ config, pkgs, ... }:
{
networking.hostName = "lithium";

View file

@ -1,9 +1,4 @@
{
config,
pkgs,
lib,
...
}:
{ config, pkgs, ... }:
let
SSID = "ENTER_SSID";
SSIDpassword = "ENTER_PASSWORD";

View file

@ -1,8 +1,14 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
let cfg = config.services.libinput;
let
cfg = config.services.libinput;
xorgBool = v: if v then "on" else "off";
@ -18,7 +24,11 @@ let cfg = config.services.libinput;
};
accelProfile = mkOption {
type = types.enum [ "flat" "adaptive" "custom" ];
type = types.enum [
"flat"
"adaptive"
"custom"
];
default = "adaptive";
example = "flat";
description = ''
@ -49,7 +59,12 @@ let cfg = config.services.libinput;
accelPointsFallback = mkOption {
type = types.nullOr (types.listOf types.number);
default = null;
example = [ 0.0 1.0 2.4 2.5 ];
example = [
0.0
1.0
2.4
2.5
];
description = ''
Sets the points of the fallback acceleration function. The value must be a list of
floating point non-negative numbers. This only applies to the custom profile.
@ -59,7 +74,12 @@ let cfg = config.services.libinput;
accelPointsMotion = mkOption {
type = types.nullOr (types.listOf types.number);
default = null;
example = [ 0.0 1.0 2.4 2.5 ];
example = [
0.0
1.0
2.4
2.5
];
description = ''
Sets the points of the (pointer) motion acceleration function. The value must be a
list of floating point non-negative numbers. This only applies to the custom profile.
@ -69,7 +89,12 @@ let cfg = config.services.libinput;
accelPointsScroll = mkOption {
type = types.nullOr (types.listOf types.number);
default = null;
example = [ 0.0 1.0 2.4 2.5 ];
example = [
0.0
1.0
2.4
2.5
];
description = ''
Sets the points of the scroll acceleration function. The value must be a list of
floating point non-negative numbers. This only applies to the custom profile.
@ -134,7 +159,13 @@ let cfg = config.services.libinput;
};
clickMethod = mkOption {
type = types.nullOr (types.enum [ "none" "buttonareas" "clickfinger" ]);
type = types.nullOr (
types.enum [
"none"
"buttonareas"
"clickfinger"
]
);
default = null;
example = "buttonareas";
description = ''
@ -177,7 +208,12 @@ let cfg = config.services.libinput;
};
scrollMethod = mkOption {
type = types.enum [ "twofinger" "edge" "button" "none" ];
type = types.enum [
"twofinger"
"edge"
"button"
"none"
];
default = "twofinger";
example = "edge";
description = ''
@ -197,7 +233,11 @@ let cfg = config.services.libinput;
};
sendEventsMode = mkOption {
type = types.enum [ "disabled" "enabled" "disabled-on-external-mouse" ];
type = types.enum [
"disabled"
"enabled"
"disabled-on-external-mouse"
];
default = "enabled";
example = "disabled";
description = ''
@ -215,7 +255,12 @@ let cfg = config.services.libinput;
};
tappingButtonMap = mkOption {
type = types.nullOr (types.enum [ "lrm" "lmr" ]);
type = types.nullOr (
types.enum [
"lrm"
"lmr"
]
);
default = null;
description = ''
Set the button mapping for 1/2/3-finger taps to left/right/middle or left/middle/right, respectively.
@ -253,8 +298,7 @@ let cfg = config.services.libinput;
additionalOptions = mkOption {
type = types.lines;
default = "";
example =
''
example = ''
Option "DragLockButtons" "L1 B1 L2 B2"
'';
description = ''
@ -271,34 +315,78 @@ let cfg = config.services.libinput;
MatchIs${matchIs} "${xorgBool true}"
${optionalString (cfg.${deviceType}.dev != null) ''MatchDevicePath "${cfg.${deviceType}.dev}"''}
Option "AccelProfile" "${cfg.${deviceType}.accelProfile}"
${optionalString (cfg.${deviceType}.accelSpeed != null) ''Option "AccelSpeed" "${cfg.${deviceType}.accelSpeed}"''}
${optionalString (cfg.${deviceType}.accelPointsFallback != null) ''Option "AccelPointsFallback" "${toString cfg.${deviceType}.accelPointsFallback}"''}
${optionalString (cfg.${deviceType}.accelPointsMotion != null) ''Option "AccelPointsMotion" "${toString cfg.${deviceType}.accelPointsMotion}"''}
${optionalString (cfg.${deviceType}.accelPointsScroll != null) ''Option "AccelPointsScroll" "${toString cfg.${deviceType}.accelPointsScroll}"''}
${optionalString (cfg.${deviceType}.accelStepFallback != null) ''Option "AccelStepFallback" "${toString cfg.${deviceType}.accelStepFallback}"''}
${optionalString (cfg.${deviceType}.accelStepMotion != null) ''Option "AccelStepMotion" "${toString cfg.${deviceType}.accelStepMotion}"''}
${optionalString (cfg.${deviceType}.accelStepScroll != null) ''Option "AccelStepScroll" "${toString cfg.${deviceType}.accelStepScroll}"''}
${optionalString (cfg.${deviceType}.buttonMapping != null) ''Option "ButtonMapping" "${cfg.${deviceType}.buttonMapping}"''}
${optionalString (cfg.${deviceType}.calibrationMatrix != null) ''Option "CalibrationMatrix" "${cfg.${deviceType}.calibrationMatrix}"''}
${optionalString (cfg.${deviceType}.transformationMatrix != null) ''Option "TransformationMatrix" "${cfg.${deviceType}.transformationMatrix}"''}
${optionalString (cfg.${deviceType}.clickMethod != null) ''Option "ClickMethod" "${cfg.${deviceType}.clickMethod}"''}
${optionalString (
cfg.${deviceType}.accelSpeed != null
) ''Option "AccelSpeed" "${cfg.${deviceType}.accelSpeed}"''}
${optionalString (cfg.${deviceType}.accelPointsFallback != null)
''Option "AccelPointsFallback" "${toString cfg.${deviceType}.accelPointsFallback}"''
}
${optionalString (cfg.${deviceType}.accelPointsMotion != null)
''Option "AccelPointsMotion" "${toString cfg.${deviceType}.accelPointsMotion}"''
}
${optionalString (cfg.${deviceType}.accelPointsScroll != null)
''Option "AccelPointsScroll" "${toString cfg.${deviceType}.accelPointsScroll}"''
}
${optionalString (cfg.${deviceType}.accelStepFallback != null)
''Option "AccelStepFallback" "${toString cfg.${deviceType}.accelStepFallback}"''
}
${optionalString (cfg.${deviceType}.accelStepMotion != null)
''Option "AccelStepMotion" "${toString cfg.${deviceType}.accelStepMotion}"''
}
${optionalString (cfg.${deviceType}.accelStepScroll != null)
''Option "AccelStepScroll" "${toString cfg.${deviceType}.accelStepScroll}"''
}
${optionalString (cfg.${deviceType}.buttonMapping != null)
''Option "ButtonMapping" "${cfg.${deviceType}.buttonMapping}"''
}
${optionalString (cfg.${deviceType}.calibrationMatrix != null)
''Option "CalibrationMatrix" "${cfg.${deviceType}.calibrationMatrix}"''
}
${optionalString (
cfg.${deviceType}.transformationMatrix != null
) ''Option "TransformationMatrix" "${cfg.${deviceType}.transformationMatrix}"''}
${optionalString (
cfg.${deviceType}.clickMethod != null
) ''Option "ClickMethod" "${cfg.${deviceType}.clickMethod}"''}
Option "LeftHanded" "${xorgBool cfg.${deviceType}.leftHanded}"
Option "MiddleEmulation" "${xorgBool cfg.${deviceType}.middleEmulation}"
Option "NaturalScrolling" "${xorgBool cfg.${deviceType}.naturalScrolling}"
${optionalString (cfg.${deviceType}.scrollButton != null) ''Option "ScrollButton" "${toString cfg.${deviceType}.scrollButton}"''}
${optionalString (cfg.${deviceType}.scrollButton != null)
''Option "ScrollButton" "${toString cfg.${deviceType}.scrollButton}"''
}
Option "ScrollMethod" "${cfg.${deviceType}.scrollMethod}"
Option "HorizontalScrolling" "${xorgBool cfg.${deviceType}.horizontalScrolling}"
Option "SendEventsMode" "${cfg.${deviceType}.sendEventsMode}"
Option "Tapping" "${xorgBool cfg.${deviceType}.tapping}"
${optionalString (cfg.${deviceType}.tappingButtonMap != null) ''Option "TappingButtonMap" "${cfg.${deviceType}.tappingButtonMap}"''}
${optionalString (cfg.${deviceType}.tappingButtonMap != null)
''Option "TappingButtonMap" "${cfg.${deviceType}.tappingButtonMap}"''
}
Option "TappingDragLock" "${xorgBool cfg.${deviceType}.tappingDragLock}"
Option "DisableWhileTyping" "${xorgBool cfg.${deviceType}.disableWhileTyping}"
${cfg.${deviceType}.additionalOptions}
'';
in {
in
{
imports =
(map (option: mkRenamedOptionModule ([ "services" "xserver" "libinput" option ]) [ "services" "libinput" "touchpad" option ]) [
(map
(
option:
mkRenamedOptionModule
([
"services"
"xserver"
"libinput"
option
])
[
"services"
"libinput"
"touchpad"
option
]
)
[
"accelProfile"
"accelSpeed"
"buttonMapping"
@ -317,10 +405,48 @@ in {
"transformationMatrix"
"disableWhileTyping"
"additionalOptions"
]) ++ [
(mkRenamedOptionModule [ "services" "xserver" "libinput" "enable" ] [ "services" "libinput" "enable" ])
(mkRenamedOptionModule [ "services" "xserver" "libinput" "mouse" ] [ "services" "libinput" "mouse" ])
(mkRenamedOptionModule [ "services" "xserver" "libinput" "touchpad" ] [ "services" "libinput" "touchpad" ])
]
)
++ [
(mkRenamedOptionModule
[
"services"
"xserver"
"libinput"
"enable"
]
[
"services"
"libinput"
"enable"
]
)
(mkRenamedOptionModule
[
"services"
"xserver"
"libinput"
"mouse"
]
[
"services"
"libinput"
"mouse"
]
)
(mkRenamedOptionModule
[
"services"
"xserver"
"libinput"
"touchpad"
]
[
"services"
"libinput"
"touchpad"
]
)
];
options = {
@ -335,7 +461,6 @@ in {
};
};
config = mkIf cfg.enable {
services.xserver.modules = [ pkgs.xorg.xf86inputlibinput ];
@ -343,8 +468,10 @@ in {
environment.systemPackages = [ pkgs.xorg.xf86inputlibinput ];
environment.etc =
let cfgPath = "X11/xorg.conf.d/40-libinput.conf";
in {
let
cfgPath = "X11/xorg.conf.d/40-libinput.conf";
in
{
${cfgPath} = {
source = pkgs.xorg.xf86inputlibinput.out + "/share/" + cfgPath;
};
@ -359,10 +486,12 @@ in {
assertions = [
# already present in synaptics.nix
/* {
/*
{
assertion = !config.services.xserver.synaptics.enable;
message = "Synaptics and libinput are incompatible, you cannot enable both (in services.xserver).";
} */
}
*/
];
};