Init
This commit is contained in:
commit
be23132d54
13 changed files with 1784 additions and 0 deletions
185
machine-confs/helium.nix
Normal file
185
machine-confs/helium.nix
Normal file
|
@ -0,0 +1,185 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
unison-conf = "${pkgs.writeText "unison-conf"
|
||||
''
|
||||
root = /home/vili
|
||||
root = ssh://nixos-cpu.vsinerva.fi//home/vili
|
||||
|
||||
watch = true
|
||||
repeat = watch
|
||||
prefer = newer
|
||||
diff = diff -y -W 79 --suppress-common-lines
|
||||
copyprog = rsync --inplace --compress
|
||||
copyprogrest = rsync --partial --inplace --compress sshargs = -C
|
||||
|
||||
path = Desktop
|
||||
path = Documents
|
||||
path = Downloads
|
||||
path = Music
|
||||
path = Pictures
|
||||
path = Projects
|
||||
path = Public
|
||||
path = School
|
||||
path = Templates
|
||||
path = Videos
|
||||
path = Zotero
|
||||
''}";
|
||||
in
|
||||
{
|
||||
networking = {
|
||||
hostName = "helium";
|
||||
firewall.allowedUDPPorts = [ 51820 51821 ];
|
||||
wg-quick.interfaces = {
|
||||
wg0 = {
|
||||
autostart = false;
|
||||
address = [ "172.16.0.2/24" ];
|
||||
dns = [ "192.168.0.1" "vsinerva.fi" ];
|
||||
privateKeyFile = "/root/wireguard-keys/privatekey-home";
|
||||
listenPort = 51820;
|
||||
|
||||
peers = [
|
||||
{
|
||||
publicKey = "f9QoYPxyaxylUcOI9cE9fE9DJoEX4c6GUtr4p+rsd34=";
|
||||
allowedIPs = [ "0.0.0.0/0" ];
|
||||
endpoint = "wg.vsinerva.fi:51820";
|
||||
}
|
||||
];
|
||||
};
|
||||
wg1 = {
|
||||
autostart = false;
|
||||
address = [ "10.100.0.7/24" ];
|
||||
dns = [ "1.1.1.1" ];
|
||||
privateKeyFile = "/root/wireguard-keys/privatekey-netflix";
|
||||
listenPort = 51821;
|
||||
|
||||
peers = [
|
||||
{
|
||||
publicKey = "XSYHg0utIR1j7kRsWFwuWNo4RPD47KP53cVa6qDPtRE=";
|
||||
allowedIPs = [ "0.0.0.0/0" "192.168.0.0/24" ];
|
||||
endpoint = "netflix.vsinerva.fi:51821";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nix.settings = {
|
||||
cores = 3;
|
||||
max-jobs = 4;
|
||||
};
|
||||
|
||||
imports = [
|
||||
/mnt/nixos-conf/base.nix
|
||||
/mnt/nixos-conf/vili.nix
|
||||
/mnt/nixos-conf/desktop.nix
|
||||
/mnt/nixos-conf/development.nix
|
||||
/mnt/nixos-conf/machine-confs/libinput.nix
|
||||
];
|
||||
disabledModules = [ "services/x11/hardware/libinput.nix" ];
|
||||
|
||||
nixpkgs.overlays =
|
||||
[
|
||||
(final: prev:
|
||||
{
|
||||
moonlight-qt = prev.moonlight-qt.overrideAttrs (old: {
|
||||
patches = (old.patches or []) ++ [ ./mouse-accel.patch ];
|
||||
});
|
||||
})
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
zenmonitor moonlight-qt parsec-bin via
|
||||
];
|
||||
|
||||
systemd.services = {
|
||||
unisonConfSymlink = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
description = "Symlink for unison conf";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "vili";
|
||||
ExecStartPre = ''${pkgs.coreutils-full}/bin/mkdir -p /home/vili/.unison'';
|
||||
ExecStart = ''${pkgs.coreutils-full}/bin/ln -sf ${unison-conf} /home/vili/.unison/cpu.prf'';
|
||||
};
|
||||
};
|
||||
unisonSync = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
description = "unison filesync";
|
||||
serviceConfig = {
|
||||
Type = "exec";
|
||||
User = "vili";
|
||||
ExecStart = ''${pkgs.unison}/bin/unison -sshcmd ${pkgs.openssh}/bin/ssh cpu'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# HARDWARE SPECIFIC
|
||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||
hardware = {
|
||||
opengl.extraPackages = with pkgs; [
|
||||
rocmPackages.clr.icd
|
||||
];
|
||||
logitech.wireless = {
|
||||
enable = true;
|
||||
enableGraphical = true;
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
xserver = {
|
||||
videoDrivers = [ "amdgpu" "modesetting" ];
|
||||
deviceSection = ''
|
||||
Option "DRI" "2"
|
||||
Option "TearFree" "true"
|
||||
'';
|
||||
|
||||
displayManager.setupCommands = ''
|
||||
${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-0 --auto --pos 0x0 --primary --output eDP --auto --pos 3840x360
|
||||
'';
|
||||
};
|
||||
|
||||
libinput.mouse = {
|
||||
accelProfile = "custom";
|
||||
accelPointsMotion = [ 0.00000 0.02000 0.04000 0.06000 0.08000 0.10000 0.12000 0.14000 0.16000 0.18000 0.20000 0.25250 0.31000 0.37250 0.44000 0.51250 0.59000 0.67250 0.76000 0.85250 0.95000 1.15500 1.37000 1.59500 1.83000 2.07500 2.33000 2.59500 2.87000 3.15500 3.45000 3.75500 4.07000 4.39500 4.73000 5.07500 5.43000 5.79500 6.17000 6.55500 6.95000 7.35500 7.77000 8.19500 8.63000 9.07500 9.53000 9.99500 10.47000 10.95500 11.45000 11.95000 ];
|
||||
accelStepMotion = 0.05;
|
||||
# accelPointsFallback = [ 0.0 10 ];
|
||||
# accelPointsMotion = [ 0.0 20 ];
|
||||
# accelPointsScroll = [ 0.0 30 ];
|
||||
# accelStepFallback = 0.01;
|
||||
# accelStepMotion = 0.02;
|
||||
# accelStepScroll = 0.03;
|
||||
};
|
||||
|
||||
redshift = {
|
||||
executable = "/bin/redshift-gtk";
|
||||
enable = true;
|
||||
temperature = {
|
||||
night = 2800;
|
||||
day = 6500;
|
||||
};
|
||||
brightness = {
|
||||
night = "0.5";
|
||||
day = "1";
|
||||
};
|
||||
};
|
||||
|
||||
devmon.enable = true;
|
||||
gvfs.enable = true;
|
||||
udisks2.enable = true;
|
||||
};
|
||||
location = {
|
||||
latitude = 60.17;
|
||||
longitude = 24.94;
|
||||
};
|
||||
|
||||
# Keychron Q11
|
||||
services.udev.extraRules = ''
|
||||
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="3434", ATTRS{idProduct}=="01e0", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
|
||||
'';
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
}
|
370
machine-confs/libinput.nix
Normal file
370
machine-confs/libinput.nix
Normal file
|
@ -0,0 +1,370 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.services.libinput;
|
||||
|
||||
xorgBool = v: if v then "on" else "off";
|
||||
|
||||
mkConfigForDevice = deviceType: {
|
||||
dev = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "/dev/input/event0";
|
||||
description = ''
|
||||
Path for ${deviceType} device. Set to `null` to apply to any
|
||||
auto-detected ${deviceType}.
|
||||
'';
|
||||
};
|
||||
|
||||
accelProfile = mkOption {
|
||||
type = types.enum [ "flat" "adaptive" "custom" ];
|
||||
default = "adaptive";
|
||||
example = "flat";
|
||||
description = ''
|
||||
Sets the pointer acceleration profile to the given profile.
|
||||
Permitted values are `adaptive`, `flat`, `custom`.
|
||||
Not all devices support this option or all profiles.
|
||||
If a profile is unsupported, the default profile for this is used.
|
||||
`flat`: Pointer motion is accelerated by a constant
|
||||
(device-specific) factor, depending on the current speed.
|
||||
`adaptive`: Pointer acceleration depends on the input speed.
|
||||
This is the default profile for most devices.
|
||||
`custom`: Allows the user to define a custom acceleration function.
|
||||
To define custom functions use the accelPoints<Fallback/Motion/Scroll>
|
||||
and accelStep<Fallback/Motion/Scroll> options.
|
||||
'';
|
||||
};
|
||||
|
||||
accelSpeed = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "-0.5";
|
||||
description = ''
|
||||
Cursor acceleration (how fast speed increases from minSpeed to maxSpeed).
|
||||
This only applies to the flat or adaptive profile.
|
||||
'';
|
||||
};
|
||||
|
||||
accelPointsFallback = mkOption {
|
||||
type = types.nullOr (types.listOf types.number);
|
||||
default = null;
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
accelPointsMotion = mkOption {
|
||||
type = types.nullOr (types.listOf types.number);
|
||||
default = null;
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
accelPointsScroll = mkOption {
|
||||
type = types.nullOr (types.listOf types.number);
|
||||
default = null;
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
accelStepFallback = mkOption {
|
||||
type = types.nullOr types.number;
|
||||
default = null;
|
||||
example = 0.1;
|
||||
description = ''
|
||||
Sets the step between the points of the fallback acceleration function. When a step of
|
||||
0.0 is provided, libinput's Fallback acceleration function is used. This only applies
|
||||
to the custom profile.
|
||||
'';
|
||||
};
|
||||
|
||||
accelStepMotion = mkOption {
|
||||
type = types.nullOr types.number;
|
||||
default = null;
|
||||
example = 0.1;
|
||||
description = ''
|
||||
Sets the step between the points of the (pointer) motion acceleration function. When a
|
||||
step of 0.0 is provided, libinput's Fallback acceleration function is used. This only
|
||||
applies to the custom profile.
|
||||
'';
|
||||
};
|
||||
|
||||
accelStepScroll = mkOption {
|
||||
type = types.nullOr types.number;
|
||||
default = null;
|
||||
example = 0.1;
|
||||
description = ''
|
||||
Sets the step between the points of the scroll acceleration function. When a step of
|
||||
0.0 is provided, libinput's Fallback acceleration function is used. This only applies
|
||||
to the custom profile.
|
||||
'';
|
||||
};
|
||||
|
||||
buttonMapping = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "1 6 3 4 5 0 7";
|
||||
description = ''
|
||||
Sets the logical button mapping for this device, see XSetPointerMapping(3). The string must
|
||||
be a space-separated list of button mappings in the order of the logical buttons on the
|
||||
device, starting with button 1. The default mapping is "1 2 3 ... 32". A mapping of 0 deac‐
|
||||
tivates the button. Multiple buttons can have the same mapping. Invalid mapping strings are
|
||||
discarded and the default mapping is used for all buttons. Buttons not specified in the
|
||||
user's mapping use the default mapping. See section BUTTON MAPPING for more details.
|
||||
'';
|
||||
};
|
||||
|
||||
calibrationMatrix = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "0.5 0 0 0 0.8 0.1 0 0 1";
|
||||
description = ''
|
||||
A string of 9 space-separated floating point numbers. Sets the calibration matrix to the
|
||||
3x3 matrix where the first row is (abc), the second row is (def) and the third row is (ghi).
|
||||
'';
|
||||
};
|
||||
|
||||
clickMethod = mkOption {
|
||||
type = types.nullOr (types.enum [ "none" "buttonareas" "clickfinger" ]);
|
||||
default = null;
|
||||
example = "buttonareas";
|
||||
description = ''
|
||||
Enables a click method. Permitted values are `none`,
|
||||
`buttonareas`, `clickfinger`.
|
||||
Not all devices support all methods, if an option is unsupported,
|
||||
the default click method for this device is used.
|
||||
'';
|
||||
};
|
||||
|
||||
leftHanded = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enables left-handed button orientation, i.e. swapping left and right buttons.";
|
||||
};
|
||||
|
||||
middleEmulation = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enables middle button emulation. When enabled, pressing the left and right buttons
|
||||
simultaneously produces a middle mouse button click.
|
||||
'';
|
||||
};
|
||||
|
||||
naturalScrolling = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enables or disables natural scrolling behavior.";
|
||||
};
|
||||
|
||||
scrollButton = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
example = 1;
|
||||
description = ''
|
||||
Designates a button as scroll button. If the ScrollMethod is button and the button is logically
|
||||
held down, x/y axis movement is converted into scroll events.
|
||||
'';
|
||||
};
|
||||
|
||||
scrollMethod = mkOption {
|
||||
type = types.enum [ "twofinger" "edge" "button" "none" ];
|
||||
default = "twofinger";
|
||||
example = "edge";
|
||||
description = ''
|
||||
Specify the scrolling method: `twofinger`, `edge`,
|
||||
`button`, or `none`
|
||||
'';
|
||||
};
|
||||
|
||||
horizontalScrolling = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enables or disables horizontal scrolling. When disabled, this driver will discard any
|
||||
horizontal scroll events from libinput. This does not disable horizontal scroll events
|
||||
from libinput; it merely discards the horizontal axis from any scroll events.
|
||||
'';
|
||||
};
|
||||
|
||||
sendEventsMode = mkOption {
|
||||
type = types.enum [ "disabled" "enabled" "disabled-on-external-mouse" ];
|
||||
default = "enabled";
|
||||
example = "disabled";
|
||||
description = ''
|
||||
Sets the send events mode to `disabled`, `enabled`,
|
||||
or `disabled-on-external-mouse`
|
||||
'';
|
||||
};
|
||||
|
||||
tapping = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enables or disables tap-to-click behavior.
|
||||
'';
|
||||
};
|
||||
|
||||
tappingButtonMap = mkOption {
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
tappingDragLock = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enables or disables drag lock during tapping behavior. When enabled, a finger up during tap-
|
||||
and-drag will not immediately release the button. If the finger is set down again within the
|
||||
timeout, the dragging process continues.
|
||||
'';
|
||||
};
|
||||
|
||||
transformationMatrix = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "0.5 0 0 0 0.8 0.1 0 0 1";
|
||||
description = ''
|
||||
A string of 9 space-separated floating point numbers. Sets the transformation matrix to
|
||||
the 3x3 matrix where the first row is (abc), the second row is (def) and the third row is (ghi).
|
||||
'';
|
||||
};
|
||||
|
||||
disableWhileTyping = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Disable input method while typing.
|
||||
'';
|
||||
};
|
||||
|
||||
additionalOptions = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example =
|
||||
''
|
||||
Option "DragLockButtons" "L1 B1 L2 B2"
|
||||
'';
|
||||
description = ''
|
||||
Additional options for libinput ${deviceType} driver. See
|
||||
{manpage}`libinput(4)`
|
||||
for available options.";
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
mkX11ConfigForDevice = deviceType: matchIs: ''
|
||||
Identifier "libinput ${deviceType} configuration"
|
||||
MatchDriver "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}"''}
|
||||
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}"''}
|
||||
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}"''}
|
||||
Option "TappingDragLock" "${xorgBool cfg.${deviceType}.tappingDragLock}"
|
||||
Option "DisableWhileTyping" "${xorgBool cfg.${deviceType}.disableWhileTyping}"
|
||||
${cfg.${deviceType}.additionalOptions}
|
||||
'';
|
||||
in {
|
||||
|
||||
imports =
|
||||
(map (option: mkRenamedOptionModule ([ "services" "xserver" "libinput" option ]) [ "services" "libinput" "touchpad" option ]) [
|
||||
"accelProfile"
|
||||
"accelSpeed"
|
||||
"buttonMapping"
|
||||
"calibrationMatrix"
|
||||
"clickMethod"
|
||||
"leftHanded"
|
||||
"middleEmulation"
|
||||
"naturalScrolling"
|
||||
"scrollButton"
|
||||
"scrollMethod"
|
||||
"horizontalScrolling"
|
||||
"sendEventsMode"
|
||||
"tapping"
|
||||
"tappingButtonMap"
|
||||
"tappingDragLock"
|
||||
"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" ])
|
||||
];
|
||||
|
||||
options = {
|
||||
|
||||
services.libinput = {
|
||||
enable = mkEnableOption "libinput" // {
|
||||
default = config.services.xserver.enable;
|
||||
defaultText = lib.literalExpression "config.services.xserver.enable";
|
||||
};
|
||||
mouse = mkConfigForDevice "mouse";
|
||||
touchpad = mkConfigForDevice "touchpad";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
services.xserver.modules = [ pkgs.xorg.xf86inputlibinput ];
|
||||
|
||||
environment.systemPackages = [ pkgs.xorg.xf86inputlibinput ];
|
||||
|
||||
environment.etc =
|
||||
let cfgPath = "X11/xorg.conf.d/40-libinput.conf";
|
||||
in {
|
||||
${cfgPath} = {
|
||||
source = pkgs.xorg.xf86inputlibinput.out + "/share/" + cfgPath;
|
||||
};
|
||||
};
|
||||
|
||||
services.udev.packages = [ pkgs.libinput.out ];
|
||||
|
||||
services.xserver.inputClassSections = [
|
||||
(mkX11ConfigForDevice "mouse" "Pointer")
|
||||
(mkX11ConfigForDevice "touchpad" "Touchpad")
|
||||
];
|
||||
|
||||
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).";
|
||||
} */
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
}
|
13
machine-confs/mouse-accel.patch
Normal file
13
machine-confs/mouse-accel.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/app/streaming/input/input.cpp b/app/streaming/input/input.cpp
|
||||
index fb11938b..5c0eb22e 100644
|
||||
--- a/app/streaming/input/input.cpp
|
||||
+++ b/app/streaming/input/input.cpp
|
||||
@@ -47,7 +47,7 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, int streamWidth, i
|
||||
// Otherwise, we'll use raw input capture which is straight from the device
|
||||
// without modification by the OS.
|
||||
SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
|
||||
- prefs.absoluteMouseMode ? "1" : "0",
|
||||
+ prefs.absoluteMouseMode ? "1" : "1",
|
||||
SDL_HINT_OVERRIDE);
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 15)
|
18
machine-confs/nixos-cpu.nix
Normal file
18
machine-confs/nixos-cpu.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
networking.hostName = "nixos-cpu";
|
||||
|
||||
imports = [
|
||||
/mnt/nixos-conf/base.nix
|
||||
/mnt/nixos-conf/development.nix
|
||||
/mnt/nixos-conf/vili.nix
|
||||
];
|
||||
|
||||
# HARDWARE SPECIFIC
|
||||
|
||||
services.qemuGuest.enable = true;
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
}
|
17
machine-confs/vaultwarden.nix
Normal file
17
machine-confs/vaultwarden.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
networking.hostName = "vaultwarden";
|
||||
|
||||
imports = [
|
||||
/mnt/nixos-conf/base.nix
|
||||
/mnt/nixos-conf/vaultwarden.nix
|
||||
];
|
||||
|
||||
# HARDWARE SPECIFIC
|
||||
|
||||
services.qemuGuest.enable = true;
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
}
|
149
machine-confs/wg-rpi-configuration.nix
Normal file
149
machine-confs/wg-rpi-configuration.nix
Normal file
|
@ -0,0 +1,149 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
SSID = "ENTER_SSID";
|
||||
SSIDpassword = "ENTER_PASSWORD";
|
||||
interface = "wlan0";
|
||||
wg_interface = "end0";
|
||||
hostname = "netflix-huijaus";
|
||||
ssh-authorizedKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBbGREoK1uVny1s8FK3KZ74Wmaf0VtifhqPyK69C/Gez vili@helium";
|
||||
ddPassFile = "/root/wg-conf/ddPassFile";
|
||||
in {
|
||||
|
||||
environment.systemPackages = with pkgs; [ vim wireguard-tools qrencode ];
|
||||
|
||||
# enable NAT
|
||||
networking.nat.enable = true;
|
||||
networking.nat.externalInterface = wg_interface;
|
||||
networking.nat.internalInterfaces = [ "wg0" ];
|
||||
networking.firewall = {
|
||||
allowedUDPPorts = [ 51821 ];
|
||||
};
|
||||
|
||||
networking.wireguard.interfaces = {
|
||||
# "wg0" is the network interface name. You can name the interface arbitrarily.
|
||||
wg0 = {
|
||||
# Determines the IP address and subnet of the server's end of the tunnel interface.
|
||||
ips = [ "10.100.0.1/24" ];
|
||||
|
||||
# The port that WireGuard listens to. Must be accessible by the client.
|
||||
listenPort = 51821;
|
||||
|
||||
# This allows the wireguard server to route your traffic to the internet and hence be like a VPN
|
||||
# For this to work you have to set the dnsserver IP of your router (or dnsserver of choice) in your clients
|
||||
postSetup = ''
|
||||
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o ${wg_interface} -j MASQUERADE
|
||||
'';
|
||||
|
||||
# This undoes the above command
|
||||
postShutdown = ''
|
||||
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o ${wg_interface} -j MASQUERADE
|
||||
'';
|
||||
|
||||
|
||||
# Path to the private key file.
|
||||
#
|
||||
# Note: The private key can also be included inline via the privateKey option,
|
||||
# but this makes the private key world-readable; thus, using privateKeyFile is
|
||||
# recommended.
|
||||
privateKeyFile = "/root/wg-conf/private";
|
||||
|
||||
peers = [
|
||||
{ # Vili Android
|
||||
publicKey = "niKpC3+Pi4HrYITlzROzqRcxzfzRw1rjpxeJVOr/WAw=";
|
||||
allowedIPs = [ "10.100.0.2/32" ];
|
||||
}
|
||||
{ # Miika Puhelin
|
||||
publicKey = "mcOs94W9jqn3SGgc8uWbnmUv0tja/P6tAvaCg3WYKlY=";
|
||||
allowedIPs = [ "10.100.0.3/32" ];
|
||||
}
|
||||
{ # Miika Kone
|
||||
publicKey = "7m7wnwNlmxZfUNvUOYNh4mTNbOsig7z2K/svUhDHFDY=";
|
||||
allowedIPs = [ "10.100.0.4/32" ];
|
||||
}
|
||||
{ # Silja Puhelin
|
||||
publicKey = "f6wWd6KD63xwnKkre/ZgZxPJv9GfAXK9Zx/EQEq8cik=";
|
||||
allowedIPs = [ "10.100.0.5/32" ];
|
||||
}
|
||||
{ # Silja Kone
|
||||
publicKey = "t9cmHc6/+0njdzsTFnnhEGKfhCa2VXFrTH9hF1jOCXw=";
|
||||
allowedIPs = [ "10.100.0.6/32" ];
|
||||
}
|
||||
{ # Vili helium
|
||||
publicKey = "iGO375NT9EK5LH+E9vjPRRJp+UM4rZ2d1RMVR3f5R0c=";
|
||||
allowedIPs = [ "10.100.0.7/32" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.ddclient = {
|
||||
enable = true;
|
||||
domains = [ "netflood.ddnsfree.com" ];
|
||||
use = "web, web=checkip.dynu.com/, web-skip='IP Address'";
|
||||
server = "api.dynu.com";
|
||||
username = "VSinerva";
|
||||
passwordFile = ddPassFile;
|
||||
};
|
||||
#################### EVERYTHING BELOW THIS SHOULD NOT NEED TO CHANGE ####################
|
||||
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxKernel.packages.linux_rpi4;
|
||||
initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" ];
|
||||
loader = {
|
||||
grub.enable = false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = "/dev/disk/by-label/NIXOS_SD";
|
||||
fsType = "ext4";
|
||||
options = [ "noatime" ];
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = hostname;
|
||||
wireless = {
|
||||
enable = false;
|
||||
networks."${SSID}".psk = SSIDpassword;
|
||||
interfaces = [ interface ];
|
||||
};
|
||||
};
|
||||
|
||||
#################### SSH configuration ####################
|
||||
services.openssh.enable = true;
|
||||
services.openssh.settings.PasswordAuthentication = false;
|
||||
users.users.root.openssh.authorizedKeys.keys = [ ssh-authorizedKey ];
|
||||
|
||||
#################### BASE ####################
|
||||
users.mutableUsers = false;
|
||||
users.users.root.hashedPassword = "!";
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
services.xserver.layout = "us,";
|
||||
services.xserver.xkbVariant = "de_se_fi,";
|
||||
console = pkgs.lib.mkForce {
|
||||
font = "Lat2-Terminus16";
|
||||
useXkbConfig = true; # use xkbOptions in tty.
|
||||
};
|
||||
time.timeZone = "Europe/Helsinki";
|
||||
|
||||
#################### Housekeeping ####################
|
||||
system.autoUpgrade.enable = true;
|
||||
nix.gc.automatic = true;
|
||||
nix.gc.options = "--delete-older-than 7d";
|
||||
nix.gc.dates = "weekly";
|
||||
|
||||
# Copy the NixOS configuration file and link it from the resulting system
|
||||
# (/run/current-system/configuration.nix). This is useful in case you
|
||||
# accidentally delete configuration.nix.
|
||||
system.copySystemConfiguration = true;
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
system.stateVersion = "23.11";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue