commit 493c665cdf5c1bd3688fcc8119af6edb95e2be65
parent a3c1e88dfa46e75214a6689cde8d98a73112e44e
Author: Leah (ctucx) <git@ctu.cx>
Date: Mon, 27 Mar 2023 20:48:02 +0200
parent a3c1e88dfa46e75214a6689cde8d98a73112e44e
Author: Leah (ctucx) <git@ctu.cx>
Date: Mon, 27 Mar 2023 20:48:02 +0200
cleanup
8 files changed, 8 insertions(+), 113 deletions(-)
D
|
107
-------------------------------------------------------------------------------
diff --git a/modules/default.nix b/modules/default.nix @@ -7,7 +7,6 @@ inputs.agenix.nixosModules.default ./linux/restic-backups.nix ./linux/vnstati - ./linux/desktop-speakers.nix ./linux/gitolite.nix ./linux/email-notify.nix ./linux/dns.nix
diff --git a/modules/linux/desktop-speakers.nix b/modules/linux/desktop-speakers.nix @@ -1,107 +0,0 @@ -{ pkgs, lib, config, ... }: - -let - secrets = import ../secrets; - cfg = config.hardware.desktop-speakers; - -in { - options.hardware.desktop-speakers = with lib; { - power-control.enable = mkEnableOption "Control power-state of speakers"; - power-control.automaticSwitching = mkEnableOption "Control power-state of speakers via lock-state"; - pipewire-tunnel.enable = mkEnableOption "Create a systend-user-service for a pipewire-tunnel to the speakers"; - pipewire-tunnel.automaticConnect = mkEnableOption "Activate pipewire-tunnel together with pipewire"; - }; - - config = { - assertions = lib.mkIf cfg.power-control.automaticSwitching [ - ({ - assertion = cfg.power-control.enable; - message = "hardware..power-control.automaticSwitching requires hardware.power-control.enable == true"; - }) - ]; - - home-manager.users.leah.wayland.windowManager.sway.config.keybindings = { - "${config.home-manager.users.leah.wayland.windowManager.sway.config.modifier}+Delete" = lib.mkIf cfg.power-control.enable "exec curl -d '{\"accessToken\": \"${secrets.hosts.lollo.smartied.accessToken}\", \"type\": \"SwitchStateAction\", \"deviceName\": \"modbus-20\", \"relay\": 0, \"toggle\": true}' http://10.0.0.1:5000"; - "${config.home-manager.users.leah.wayland.windowManager.sway.config.modifier}+Insert" = lib.mkIf cfg.pipewire-tunnel.enable "exec systemctl --user restart pipewire-pulse-tunnel.service"; - }; - - home-manager.users.leah.systemd.user.services = { - speakers = lib.mkIf cfg.power-control.enable { - Unit = { - Requisite = [ "graphical-session.target" ]; - - After = [ "network-online.target" ]; - Wants = [ "network-online.target" ]; - }; - - Service = { - RemainAfterExit = "yes"; - - ExecStartPre = "/usr/bin/env sh -c 'until ping -c1 10.0.0.1; do sleep 0.1; done;'"; - ExecStart = "${pkgs.curl}/bin/curl -d '{\"accessToken\": \"${secrets.hosts.lollo.smartied.accessToken}\", \"type\": \"SwitchStateAction\", \"deviceName\": \"modbus-20\", \"relay\": 0, \"state\": true}' http://10.0.0.1:5000"; - - ExecStopPre = "/usr/bin/env sh -c 'until ping -c1 10.0.0.1; do sleep 0.1; done;'"; - ExecStop = "${pkgs.curl}/bin/curl -d '{\"accessToken\": \"${secrets.hosts.lollo.smartied.accessToken}\", \"type\": \"SwitchStateAction\", \"deviceName\": \"modbus-20\", \"relay\": 0, \"state\": false}' http://10.0.0.1:5000"; - }; - - Install = { - WantedBy = [ "graphical-session.target" ]; - }; - }; - - speakers-lock = lib.mkIf cfg.power-control.automaticSwitching { - Unit = { - Requisite = [ "graphical-session.target" ]; - PartOf = [ "lock.target" "sleep.target" ]; - }; - - Service = { - ExecStart = "${pkgs.systemd}/bin/systemctl --user stop speakers"; - }; - - Install = { - WantedBy = [ "lock.target" "sleep.target" ]; - }; - }; - - speakers-unlock = lib.mkIf cfg.power-control.automaticSwitching { - Unit = { - Requisite = [ "graphical-session.target" ]; - PartOf = [ "unlock.target" ]; - }; - - Service = { - ExecStart = "${pkgs.systemd}/bin/systemctl --user start speakers"; - }; - - Install = { - WantedBy = [ "unlock.target" ]; - }; - }; - - - pipewire-pulse-tunnel = lib.mkIf cfg.pipewire-tunnel.enable { - Unit = { - Requires = [ "pipewire-pulse.service" ]; - After = [ "pipewire-pulse.service" "network-online.target" ]; - BindsTo = [ "pipewire-pulse.service" ]; - }; - - Service = { - Type = "oneshot"; - RemainAfterExit = true; - ExecStartPre = "/usr/bin/env sh -c 'until ping -c1 195.39.246.41; do sleep 0.1; done;'"; - ExecStart = "${pkgs.pulseaudio}/bin/pactl load-module module-tunnel-sink server=195.39.246.41"; - ExecStop = "${pkgs.pulseaudio}/bin/pactl unload-module module-tunnel-sink"; - }; - - Install = lib.mkIf cfg.pipewire-tunnel.automaticConnect { - WantedBy = [ "pipewire-pulse.service" ]; - }; - }; - - }; - - }; - -}
diff --git a/modules/linux/dns.nix b/modules/linux/dns.nix @@ -6,6 +6,7 @@ let cfg = config.dns; in { + options.dns = { enable = mkEnableOption "nix-powered DNS"; @@ -58,4 +59,5 @@ in { ) ++ cfg.extraZones; }; }; + }
diff --git a/secrets/secrets.nix b/secrets/secrets.nix @@ -25,12 +25,17 @@ in { "blechkasten/syncthing/cert.age".publicKeys = [ leah blechkasten ]; + "lollo/wireguard-privkey.age".publicKeys = [ leah lollo ]; + + "lollo/radicale-users.age".publicKeys = [ leah lollo ]; + "lollo/gotosocial-env.age".publicKeys = [ leah lollo ]; + "lollo/mosquitto/passwd-leah.age".publicKeys = [ leah lollo ]; "lollo/zigbee2mqtt/secrets.age".publicKeys = [ leah lollo ]; + "lollo/telegraf_env.age".publicKeys = [ leah lollo ]; "lollo/syncthing/key.age".publicKeys = [ leah lollo ]; "lollo/syncthing/cert.age".publicKeys = [ leah lollo ]; - "lollo/telegraf_env.age".publicKeys = [ leah lollo ]; "lollo/influx/grafana_token.age".publicKeys = [ leah lollo trabbi]; "lollo/influx/telegraf_token.age".publicKeys = [ leah lollo ]; @@ -38,10 +43,6 @@ in { "lollo/influx/backup_env.age".publicKeys = [ leah lollo ]; "lollo/restic-server-htpasswd.age".publicKeys = [ leah lollo ]; - "lollo/wireguard-privkey.age".publicKeys = [ leah lollo ]; - - "lollo/radicale-users.age".publicKeys = [ leah lollo ]; - "lollo/gotosocial-env.age".publicKeys = [ leah lollo ]; "lollo/restic/vnstat.age".publicKeys = [ leah lollo ]; "lollo/restic/gotosocial.age".publicKeys = [ leah lollo ];
diff --git a/secrets/taurus/restic/matrix-synapse.age b/secrets/taurus/restic/matrix-synapse.age Binary files differ.
diff --git a/secrets/taurus/restic/pleroma.age b/secrets/taurus/restic/pleroma.age Binary files differ.
diff --git a/secrets/taurus/syncthing/cert.age b/secrets/taurus/syncthing/cert.age Binary files differ.
diff --git a/secrets/taurus/syncthing/key.age b/secrets/taurus/syncthing/key.age Binary files differ.