diff options
author | tv <tv@krebsco.de> | 2023-07-25 20:39:35 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2023-07-25 20:39:35 +0200 |
commit | 5d1b0675cf179f863a5b34b67661a953197b6057 (patch) | |
tree | dd9c83dff894fd97cee61dd1b2df3eaeecbbd740 /lass/2configs | |
parent | a2c9ad05b2e8237b915a100e1e38ca0f3d18526c (diff) | |
parent | 8eab63eaa81717391269a61355cb7fb64341fd1a (diff) |
Merge remote-tracking branch 'orange/master'
Diffstat (limited to 'lass/2configs')
26 files changed, 682 insertions, 256 deletions
diff --git a/lass/2configs/antimicrox/default.nix b/lass/2configs/antimicrox/default.nix index 16f546ce6..2b683b8bc 100644 --- a/lass/2configs/antimicrox/default.nix +++ b/lass/2configs/antimicrox/default.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: { systemd.services.antimicrox = { + after = [ "display-manager.service" ]; wantedBy = [ "multi-user.target" ]; environment = { DISPLAY = ":0"; @@ -8,18 +9,23 @@ serviceConfig = { User = config.users.users.mainUser.name; ExecStartPre = lib.singleton (pkgs.writeDash "init_state" "echo 0 > /tmp/gamepad.state"); - ExecStart = "${pkgs.antimicrox}/bin/antimicrox --no-tray --hidden --profile ${./mouse.amgp}"; + ExecStart = "${pkgs.antimicrox}/bin/antimicrox --hidden --profile ${./mouse.gamecontroller.amgp}"; }; }; + services.udev.extraRules = '' + KERNEL=="uinput", MODE="0660", GROUP="input", OPTIONS+="static_node=uinput" + ''; + environment.systemPackages = [ + pkgs.antimicrox (pkgs.writers.writeDashBin "gamepad_mouse_disable" '' echo 1 > /tmp/gamepad.state - ${pkgs.antimicrox}/bin/antimicrox --profile ${./empty.amgp} + ${pkgs.antimicrox}/bin/antimicrox --profile ${./empty.gamecontroller.amgp} '') (pkgs.writers.writeDashBin "gamepad_mouse_enable" '' echo 0 > /tmp/gamepad.state - ${pkgs.antimicrox}/bin/antimicrox --profile ${./mouse.amgp} + ${pkgs.antimicrox}/bin/antimicrox --profile ${./mouse.gamecontroller.amgp} '') (pkgs.writers.writeDashBin "gamepad_mouse_toggle" '' state=$(${pkgs.coreutils}/bin/cat /tmp/gamepad.state) diff --git a/lass/2configs/antimicrox/empty.amgp b/lass/2configs/antimicrox/empty.gamecontroller.amgp index 0257bfe71..0257bfe71 100644 --- a/lass/2configs/antimicrox/empty.amgp +++ b/lass/2configs/antimicrox/empty.gamecontroller.amgp diff --git a/lass/2configs/antimicrox/mouse.amgp b/lass/2configs/antimicrox/mouse.gamecontroller.amgp index 313e598de..743618f54 100644 --- a/lass/2configs/antimicrox/mouse.amgp +++ b/lass/2configs/antimicrox/mouse.gamecontroller.amgp @@ -23,7 +23,8 @@ <maxZone>29501</maxZone> <modifierZone>1412</modifierZone> <diagonalRange>90</diagonalRange> - <stickbutton index="7"> + <squareStick>100</squareStick> + <stickbutton index="1"> <mousespeedx>74</mousespeedx> <mousespeedy>74</mousespeedy> <accelerationmultiplier>4</accelerationmultiplier> @@ -32,16 +33,12 @@ <extraaccelerationcurve>easeoutquad</extraaccelerationcurve> <slots> <slot> - <code>3</code> + <code>1</code> <mode>mousemovement</mode> </slot> </slots> </stickbutton> - <stickbutton index="6"> - <mousespeedx>74</mousespeedx> - <mousespeedy>74</mousespeedy> - </stickbutton> - <stickbutton index="5"> + <stickbutton index="3"> <mousespeedx>74</mousespeedx> <mousespeedy>74</mousespeedy> <accelerationmultiplier>4</accelerationmultiplier> @@ -50,16 +47,16 @@ <extraaccelerationcurve>easeoutquad</extraaccelerationcurve> <slots> <slot> - <code>2</code> + <code>4</code> <mode>mousemovement</mode> </slot> </slots> </stickbutton> - <stickbutton index="4"> + <stickbutton index="2"> <mousespeedx>74</mousespeedx> <mousespeedy>74</mousespeedy> </stickbutton> - <stickbutton index="3"> + <stickbutton index="5"> <mousespeedx>74</mousespeedx> <mousespeedy>74</mousespeedy> <accelerationmultiplier>4</accelerationmultiplier> @@ -68,16 +65,16 @@ <extraaccelerationcurve>easeoutquad</extraaccelerationcurve> <slots> <slot> - <code>4</code> + <code>2</code> <mode>mousemovement</mode> </slot> </slots> </stickbutton> - <stickbutton index="2"> + <stickbutton index="4"> <mousespeedx>74</mousespeedx> <mousespeedy>74</mousespeedy> </stickbutton> - <stickbutton index="1"> + <stickbutton index="7"> <mousespeedx>74</mousespeedx> <mousespeedy>74</mousespeedy> <accelerationmultiplier>4</accelerationmultiplier> @@ -86,11 +83,15 @@ <extraaccelerationcurve>easeoutquad</extraaccelerationcurve> <slots> <slot> - <code>1</code> + <code>3</code> <mode>mousemovement</mode> </slot> </slots> </stickbutton> + <stickbutton index="6"> + <mousespeedx>74</mousespeedx> + <mousespeedy>74</mousespeedy> + </stickbutton> <stickbutton index="8"> <mousespeedx>74</mousespeedx> <mousespeedy>74</mousespeedy> @@ -99,66 +100,66 @@ <stick index="1"> <deadZone>2578</deadZone> <maxZone>30799</maxZone> - <stickbutton index="7"> + <stickbutton index="1"> <mouseacceleration>linear</mouseacceleration> <slots> <slot> - <code>6</code> + <code>4</code> <mode>mousebutton</mode> </slot> </slots> </stickbutton> - <stickbutton index="6"> - <mouseacceleration>linear</mouseacceleration> - </stickbutton> - <stickbutton index="5"> + <stickbutton index="3"> <mouseacceleration>linear</mouseacceleration> <slots> <slot> - <code>5</code> + <code>7</code> <mode>mousebutton</mode> </slot> </slots> </stickbutton> - <stickbutton index="4"> + <stickbutton index="2"> <mouseacceleration>linear</mouseacceleration> </stickbutton> - <stickbutton index="3"> + <stickbutton index="5"> <mouseacceleration>linear</mouseacceleration> <slots> <slot> - <code>7</code> + <code>5</code> <mode>mousebutton</mode> </slot> </slots> </stickbutton> - <stickbutton index="2"> + <stickbutton index="4"> <mouseacceleration>linear</mouseacceleration> </stickbutton> - <stickbutton index="1"> + <stickbutton index="7"> <mouseacceleration>linear</mouseacceleration> <slots> <slot> - <code>4</code> + <code>6</code> <mode>mousebutton</mode> </slot> </slots> </stickbutton> + <stickbutton index="6"> + <mouseacceleration>linear</mouseacceleration> + </stickbutton> <stickbutton index="8"> <mouseacceleration>linear</mouseacceleration> </stickbutton> </stick> <dpad index="1"> - <dpadbutton index="6"> + <dpadbutton index="12"> <wheelspeedx>2</wheelspeedx> <wheelspeedy>10</wheelspeedy> </dpadbutton> - <dpadbutton index="4"> - <wheelspeedx>2</wheelspeedx> + <dpadbutton index="1"> + <wheelspeedx>10</wheelspeedx> <wheelspeedy>10</wheelspeedy> <slots> <slot> - <code>0x1000017</code> + <code>0x1000013</code> <mode>keyboard</mode> </slot> </slots> @@ -172,22 +173,22 @@ <wheelspeedy>10</wheelspeedy> <slots> <slot> - <code>0x1000011</code> + <code>0x1000014</code> <mode>keyboard</mode> </slot> </slots> </dpadbutton> - <dpadbutton index="1"> - <wheelspeedx>10</wheelspeedx> + <dpadbutton index="4"> + <wheelspeedx>2</wheelspeedx> <wheelspeedy>10</wheelspeedy> <slots> <slot> - <code>0x1000016</code> + <code>0x1000015</code> <mode>keyboard</mode> </slot> </slots> </dpadbutton> - <dpadbutton index="12"> + <dpadbutton index="6"> <wheelspeedx>2</wheelspeedx> <wheelspeedy>10</wheelspeedy> </dpadbutton> @@ -200,7 +201,7 @@ <wheelspeedy>10</wheelspeedy> <slots> <slot> - <code>0x1000010</code> + <code>0x1000012</code> <mode>keyboard</mode> </slot> </slots> @@ -235,31 +236,39 @@ </slot> </slots> </button> - <button index="5"> + <button index="2"> <slots> <slot> - <code>1</code> + <code>3</code> <mode>mousebutton</mode> </slot> </slots> </button> - <button index="3"> + <button index="1"> <slots> <slot> - <code>2</code> + <code>1</code> <mode>mousebutton</mode> </slot> </slots> </button> - <button index="2"> + <button index="4"> <slots> <slot> - <code>3</code> + <code>0x1000004</code> + <mode>keyboard</mode> + </slot> + </slots> + </button> + <button index="3"> + <slots> + <slot> + <code>2</code> <mode>mousebutton</mode> </slot> </slots> </button> - <button index="1"> + <button index="5"> <slots> <slot> <code>1</code> diff --git a/lass/2configs/atuin-server.nix b/lass/2configs/atuin-server.nix index ad959a311..05d3b4fd4 100644 --- a/lass/2configs/atuin-server.nix +++ b/lass/2configs/atuin-server.nix @@ -1,38 +1,10 @@ { config, lib, pkgs, ... }: { - services.postgresql = { + services.atuin = { enable = true; - dataDir = "/var/state/postgresql/${config.services.postgresql.package.psqlSchema}"; - ensureDatabases = [ "atuin" ]; - ensureUsers = [{ - name = "atuin"; - ensurePermissions."DATABASE atuin" = "ALL PRIVILEGES"; - }]; - }; - systemd.tmpfiles.rules = [ - "d /var/state/postgresql 0700 postgres postgres -" - ]; - users.groups.atuin = {}; - users.users.atuin = { - uid = pkgs.stockholm.lib.genid_uint31 "atuin"; - isSystemUser = true; - group = "atuin"; - home = "/run/atuin"; - createHome = true; + host = "0.0.0.0"; + maxHistoryLength = 1000000; + openFirewall = true; }; - systemd.services.atuin = { - wantedBy = [ "multi-user.target" ]; - environment = { - ATUIN_HOST = "0.0.0.0"; - ATUIN_PORT = "8888"; - ATUIN_OPEN_REGISTRATION = "true"; - ATUIN_DB_URI = "postgres:///atuin"; - }; - serviceConfig = { - User = "atuin"; - ExecStart = "${pkgs.atuin}/bin/atuin server start"; - }; - }; - networking.firewall.allowedTCPPorts = [ 8888 ]; } diff --git a/lass/2configs/baseX.nix b/lass/2configs/baseX.nix index 654247728..e5b1f0b90 100644 --- a/lass/2configs/baseX.nix +++ b/lass/2configs/baseX.nix @@ -89,16 +89,30 @@ in { x11vnc xclip xephyrify + xorg.xmodmap xorg.xhost + xdotool xsel zathura flameshot (pkgs.writeDashBin "screenshot" '' set -efu - ${pkgs.flameshot}/bin/flameshot gui + ${pkgs.flameshot}/bin/flameshot gui && ${pkgs.klem}/bin/klem '') + (pkgs.writers.writeDashBin "IM" '' + ${pkgs.mosh}/bin/mosh green.r -- tmux new-session -A -s IM -- weechat + '') + (pkgs.writers.writeDashBin "deploy_hm" '' + target=$1 + shift + + hm_profile=$(${pkgs.home-manager}/bin/home-manager -f ~/sync/stockholm/lass/2configs/home-manager.nix build "$@") + nix-copy-closure --to "$target" "$hm_profile" + ssh "$target" -- "$hm_profile"/activate + '') + zbar ]; services.udev.extraRules = '' @@ -114,6 +128,7 @@ in { xkbVariant = "altgr-intl"; xkbOptions = "caps:escape"; libinput.enable = true; + exportConfiguration = true; displayManager = { lightdm.enable = true; defaultSession = "none+xmonad"; @@ -130,7 +145,6 @@ in { }; krebs.xresources.enable = true; - lass.screenlock.enable = true; lass.klem = { kpaste.script = pkgs.writeDash "kpaste-wrapper" '' @@ -152,7 +166,7 @@ in { qrcode = { target = "image"; script = pkgs.writeDash "zbar" '' - ${pkgs.zbar}/bin/zbarimg -q - + ${pkgs.zbar}/bin/zbarimg -q --raw - ''; }; ocr = { diff --git a/lass/2configs/boot/universal.nix b/lass/2configs/boot/universal.nix new file mode 100644 index 000000000..33f4323cc --- /dev/null +++ b/lass/2configs/boot/universal.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + boot = { + loader.grub.enable = true; + loader.grub.version = 2; + loader.grub.device = "/dev/sda"; + loader.grub.efiSupport = true; + loader.grub.efiInstallAsRemovable = true; + }; +} diff --git a/lass/2configs/codimd.nix b/lass/2configs/codimd.nix index b3bf1b761..ccca49fac 100644 --- a/lass/2configs/codimd.nix +++ b/lass/2configs/codimd.nix @@ -21,7 +21,7 @@ in { }; security.acme.certs.${domain}.group = "hedgecert"; - users.groups.hedgecert.members = [ "codimd" "nginx" ]; + users.groups.hedgecert.members = [ "hedgedoc" "nginx" ]; security.dhparams = { enable = true; @@ -35,10 +35,10 @@ in { services.hedgedoc = { enable = true; configuration.allowOrigin = [ domain ]; - configuration = { + settings = { db = { dialect = "sqlite"; - storage = "/var/lib/codimd/db.codimd.sqlite"; + storage = "/var/lib/hedgedoc/db.hedgedoc.sqlite"; }; useCDN = false; port = 3091; diff --git a/lass/2configs/default.nix b/lass/2configs/default.nix index 3d7188dc6..72dbfc480 100644 --- a/lass/2configs/default.nix +++ b/lass/2configs/default.nix @@ -12,6 +12,7 @@ with import <stockholm/lib>; ./wiregrill.nix ./tmux.nix ./tor-ssh.nix + ./networkd.nix { users.extraUsers = mapAttrs (_: h: { hashedPassword = h; }) diff --git a/lass/2configs/hass/default.nix b/lass/2configs/hass/default.nix index cc8189f51..1745bbfe5 100644 --- a/lass/2configs/hass/default.nix +++ b/lass/2configs/hass/default.nix @@ -41,8 +41,7 @@ in { configWritable = true; lovelaceConfigWritable = true; config = let - tasmota_s20 = name: topic: { - platform = "mqtt"; + tasmota = name: topic: { inherit name; state_topic = "stat/${topic}/POWER"; command_topic = "cmnd/${topic}/POWER"; @@ -57,7 +56,7 @@ in { longitude = "13.41489"; elevation = 90; unit_system = "metric"; - customize = friendly_names; + # customize = friendly_names; }; config = {}; sun.elevation = 66; @@ -65,36 +64,37 @@ in { discovery = {}; frontend = {}; http = {}; - mqtt = { - broker = "localhost"; - port = 1883; - client_id = "home-assistant"; - username = "gg23"; - password = "gg23-mqtt"; - keepalive = 60; - protocol = 3.1; + # mqtt = { + # broker = "localhost"; + # port = 1883; + # client_id = "home-assistant"; + # username = "gg23"; + # password = "gg23-mqtt"; + # keepalive = 60; + # protocol = 3.1; - discovery = true; - birth_message = { - topic = "/hass/status"; - payload = "online"; - }; - will_message = { - topic = "/hass/status"; - payload = "offline"; - }; - }; + # discovery = true; + # birth_message = { + # topic = "/hass/status"; + # payload = "online"; + # }; + # will_message = { + # topic = "/hass/status"; + # payload = "offline"; + # }; + # }; sensor = [ { platform = "dwd_weather_warnings"; region_name = "Berlin"; } ]; - switch = [ - (tasmota_s20 "TV" "tv") - (tasmota_s20 "Drucker Strom" "drucker") - (tasmota_s20 "Waschmaschine" "wasch") - (tasmota_s20 "Stereo Anlage" "stereo") + mqtt.switch = [ + (tasmota "TV" "tv") + (tasmota "Drucker Strom" "drucker") + (tasmota "Waschmaschine" "wasch") + (tasmota "Stereo Anlage" "stereo") + (tasmota "Wohnzimmer Lampe" "wohn_lampe") ]; mobile_app = {}; weather = [ @@ -106,6 +106,10 @@ in { system_health = {}; history = {}; shopping_list = {}; + media_player = { + platform = "snapcast"; + host = "127.0.0.1"; + }; }; }; diff --git a/lass/2configs/hass/lib.nix b/lass/2configs/hass/lib.nix index 1f9f9945d..72ff2966f 100644 --- a/lass/2configs/hass/lib.nix +++ b/lass/2configs/hass/lib.nix @@ -1,24 +1,24 @@ { lib, ... }: rec { lights = { - bett = "0x0017880106ed3bd8"; - essen = "0x0017880108327622"; - arbeit = "0x0017880106ee2865"; - nass = "0x00178801082e9f2f"; + bett = "l_bett"; + essen = "l_essen"; + arbeit = "l_arbeit"; + nass = "l_nass"; }; switches = { dimmer = { - bett = "0x00178801086ac38c"; - essen = "0x00178801086ad1fb"; - nass = "0x00178801086ac373"; + bett = "i_bett"; + essen = "i_essen"; + nass = "i_nass"; }; }; sensors = { movement = { - essen = "0x0017880106f772f2"; - nass = "0x0017880106f77f30"; + essen = "s_essen"; + nass = "s_nass"; }; }; diff --git a/lass/2configs/hass/zigbee.nix b/lass/2configs/hass/zigbee.nix index 8fc02263b..210c761b5 100644 --- a/lass/2configs/hass/zigbee.nix +++ b/lass/2configs/hass/zigbee.nix @@ -34,117 +34,42 @@ in { advanced = { pan_id = 4222; }; - }; - }; + devices = let + set_device = id: name: + lib.nameValuePair id { + }; + in { + # lights https://www.zigbee2mqtt.io/devices/9290022166.html#philips-9290022166 + "0x0017880106ed3bd8".friendly_name = "l_bett"; + "0x0017880108327622".friendly_name = "l_essen"; + "0x0017880106ee2865".friendly_name = "l_arbeit"; + "0x00178801082e9f2f".friendly_name = "l_nass"; - services.home-assistant.config = { - sensor = [ - # Sensor for monitoring the bridge state - { - platform = "mqtt"; - name = "Zigbee2mqtt Bridge state"; - state_topic = "/zigbee2mqtt/bridge/state"; - icon = "mdi:router-wireless"; - } - # Sensor for Showing the Zigbee2mqtt Version - { - platform = "mqtt"; - name = "Zigbee2mqtt Version"; - state_topic = "/zigbee2mqtt/bridge/config"; - value_template = "{{ value_json.version }}"; - icon = "mdi:zigbee"; - } - # Sensor for Showing the Coordinator Version - { - platform = "mqtt"; - name = "Coordinator Version"; - state_topic = "/zigbee2mqtt/bridge/config"; - value_template = "{{ value_json.coordinator }}"; - icon = "mdi:chip"; - } - ]; - switch = [ - { - platform = "mqtt"; - name = "zigbee2mqtt_join"; - state_topic = "/zigbee2mqtt/bridge/config/permit_join"; - command_topic = "/zigbee2mqtt/bridge/config/permit_join"; - payload_on = "true"; - payload_off = "false"; - } - ]; - automation = [ - #{ - # alias = "Zigbee2mqtt Log Level"; - # initial_state = "on"; - # trigger = { - # platform = "state"; - # entity_id = "input_select.zigbee2mqtt_log_level"; - # }; - # action = [ - # { - # service = "mqtt.publish"; - # data = { - # payload_template = "{{ states('input_select.zigbee2mqtt_log_level') }}"; - # topic = "/zigbee2mqtt/bridge/config/log_level"; - # }; - # } - # ]; - #} - # Automation to start timer when enable join is turned on - { - id = "zigbee_join_enabled"; - alias = ""; - trigger = { - platform = "state"; - entity_id = "switch.zigbee2mqtt_join"; - to = "on"; - }; - action = { - service = "timer.start"; - entity_id = "timer.zigbee_permit_join"; + # switches https://www.zigbee2mqtt.io/devices/324131092621.html#philips-324131092621 + "0x00178801086ac38c".friendly_name = "i_bett"; + "0x00178801086ad1fb".friendly_name = "i_essen"; + "0x00178801086ac373".friendly_name = "i_nass"; + + # sensors https://www.zigbee2mqtt.io/devices/9290012607.html#philips-9290012607 + "0x0017880106f772f2".friendly_name = "s_essen"; + "0x0017880106f77f30".friendly_name = "s_nass"; + + # heat https://www.zigbee2mqtt.io/devices/701721.html#popp-701721 + "0x842e14fffe27109a".friendly_name = "t_bett"; + "0x842e14fffe269a73".friendly_name = "t_nass"; + "0x842e14fffe269a56".friendly_name = "t_arbeit"; + + # rotation https://www.zigbee2mqtt.io/devices/E1744.html + "0x8cf681fffe065493" = { + friendly_name = "r_test"; + device_id = "r_test"; + simulated_brightness = { + delta = 2; + interval = 100; + }; }; - } - # Automation to stop timer when switch turned off and turn off switch when timer finished - { - id = "zigbee_join_disabled"; - trigger = [ - { - platform = "event"; - event_type = "timer.finished"; - event_data.entity_id = "timer.zigbee_permit_join"; - } - { - platform = "state"; - entity_id = "switch.zigbee2mqtt_join"; - to = "off"; - } - ]; - action = [ - { service = "timer.cancel"; - data.entity_id = "timer.zigbee_permit_join"; - } - { service = "switch.turn_off"; - entity_id = "switch.zigbee2mqtt_join"; - } - ]; - } - ]; - #input_select.zigbee2mqtt_log_level = { - # name = "Zigbee2mqtt Log Level"; - # options = [ - # "debug" - # "info" - # "warn" - # "error" - # ]; - # initial = "info"; - # icon = "mdi:format-list-bulleted"; - #}; - timer.zigbee_permit_join = { |