summaryrefslogtreecommitdiffstats
path: root/lass
diff options
context:
space:
mode:
Diffstat (limited to 'lass')
-rw-r--r--lass/1systems/green/source.nix13
-rw-r--r--lass/2configs/hass/zigbee.nix56
-rw-r--r--lass/2configs/radio.nix61
-rw-r--r--lass/2configs/websites/domsen.nix2
4 files changed, 42 insertions, 90 deletions
diff --git a/lass/1systems/green/source.nix b/lass/1systems/green/source.nix
index 21f3a8bd5..48499c9db 100644
--- a/lass/1systems/green/source.nix
+++ b/lass/1systems/green/source.nix
@@ -1,14 +1,5 @@
{ lib, pkgs, ... }:
{
- nixpkgs = lib.mkForce {
- file = {
- path = toString (pkgs.fetchFromGitHub {
- owner = "nixos";
- repo = "nixpkgs";
- rev = (lib.importJSON ../../../krebs/nixpkgs.json).rev;
- sha256 = (lib.importJSON ../../../krebs/nixpkgs.json).sha256;
- });
- useChecksum = true;
- };
- };
+ nixpkgs-unstable = lib.mkForce { file = "/var/empty"; };
+ nixpkgs.git.shallow = true;
}
diff --git a/lass/2configs/hass/zigbee.nix b/lass/2configs/hass/zigbee.nix
index b2a221e49..789a7fb92 100644
--- a/lass/2configs/hass/zigbee.nix
+++ b/lass/2configs/hass/zigbee.nix
@@ -1,38 +1,40 @@
{config, pkgs, lib, ...}: let
- zigbee2mqtt_cfg = pkgs.writeText "zigbee2mqtt.json" (builtins.toJSON {
- homeassistant = true;
- permit_join = false;
- mqtt = {
- discovery = true;
- base_topic = "zigbee";
- server = "mqtt://10.42.0.1";
- user = "gg23";
- password = "gg23-mqtt";
- };
- serial.port = "/dev/cc2531";
- });
+ unstable-pkgs = import <nixpkgs-unstable> {};
in {
# symlink the zigbee controller
services.udev.extraRules = ''
- SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dailout"
- '';
-
- system.activationScripts.installZigbee = ''
- install -d /var/lib/zigbee2mqtt
- install ${zigbee2mqtt_cfg} /var/lib/zigbee2mqtt/configuration.yaml
+ SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout"
+ SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="cc2652", MODE="0660", GROUP="dialout"
'';
- # hack to restart docker container on config change
- systemd.services.docker-zigbee2mqtt.environment.cfg = zigbee2mqtt_cfg;
+ # needed to use unstable package
+ systemd.services.zigbee2mqtt.environment.ZIGBEE2MQTT_DATA = "/var/lib/zigbee2mqtt";
- docker-containers.zigbee2mqtt = {
- image = "koenkk/zigbee2mqtt";
- extraDockerOptions = [
- "--device=/dev/cc2531:/dev/cc2531"
- ];
- volumes = ["/var/lib/zigbee2mqtt:/app/data"];
+ services.zigbee2mqtt = {
+ enable = true;
+ package = unstable-pkgs.zigbee2mqtt;
+ config = {
+ homeassistant = true;
+ frontend.port = 1337;
+ experimental.new_api = true;
+ permit_join = false;
+ mqtt = {
+ discovery = true;
+ base_topic = "zigbee";
+ server = "mqtt://10.42.0.1";
+ user = "gg23";
+ password = "gg23-mqtt";
+ };
+ serial = {
+ port = "/dev/cc2652";
+ # disable_led = true;
+ };
+ advanced = {
+ pan_id = 4222;
+ };
+ };
};
services.home-assistant.config = {
@@ -93,7 +95,6 @@ in {
{
id = "zigbee_join_enabled";
alias = "";
- hide_entity = "true";
trigger = {
platform = "state";
entity_id = "switch.zigbee2mqtt_join";
@@ -107,7 +108,6 @@ in {
# Automation to stop timer when switch turned off and turn off switch when timer finished
{
id = "zigbee_join_disabled";
- hide_entity = "true";
trigger = [
{
platform = "event";
diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix
index 3e8d12381..8c95b535d 100644
--- a/lass/2configs/radio.nix
+++ b/lass/2configs/radio.nix
@@ -6,9 +6,6 @@ let
name = "radio";
mainUser = config.users.extraUsers.mainUser;
- admin-password = import <secrets/icecast-admin-pw>;
- source-password = import <secrets/icecast-source-pw>;
-
music_dir = "/home/radio/music";
add_random = pkgs.writeDashBin "add_random" ''
@@ -138,54 +135,19 @@ in {
auto_update "yes"
audio_output {
- type "shout"
- encoding "lame"
- name "the_playlist_mp3"
- host "localhost"
- port "8000"
- mount "/radio.mp3"
- password "${source-password}"
- bitrate "128"
-
- format "44100:16:2"
-
- user "source"
- genre "good music"
- }
- audio_output {
- type "shout"
- encoding "ogg"
- name "the_playlist_ogg"
- host "localhost"
- port "8000"
- mount "/radio.ogg"
- password "${source-password}"
- bitrate "128"
-
- format "44100:16:2"
-
- user "source"
- genre "good music"
+ type "httpd"
+ name "lassulus radio"
+ encoder "vorbis" # optional
+ port "8000"
+ quality "5.0" # do not define if bitrate is defined
+ # bitrate "128" # do not define if quality is defined
+ format "44100:16:2"
+ always_on "yes" # prevent MPD from disconnecting all listeners when playback is stopped.
+ tags "yes" # httpd supports sending tags to listening streams.
}
'';
};
- services.icecast = {
- enable = true;
- hostname = "radio.lassul.us";
- admin.password = admin-password;
- extraConf = ''
- <mount>
- <mount-name>/radio.mp3</mount-name>
- <password>${source-password}</password>
- </mount>
- <mount>
- <mount-name>/radio.ogg</mount-name>
- <password>${source-password}</password>
- </mount>
- '';
- };
-
krebs.iptables = {
tables = {
filter.INPUT.rules = [
@@ -206,7 +168,7 @@ in {
systemd.services.radio = let
autoAdd = pkgs.writeDash "autoAdd" ''
- LIMIT=$1 #in secconds
+ LIMIT=$1 #in seconds
timeLeft () {
playlistDuration=$(${pkgs.mpc_cli}/bin/mpc --format '%time%' playlist | ${pkgs.gawk}/bin/awk -F ':' 'BEGIN{t=0} {t+=$1*60+$2} END{print t}')
@@ -238,8 +200,7 @@ in {
${pkgs.mpc_cli}/bin/mpc idle player > /dev/null
${pkgs.mpc_cli}/bin/mpc current -f %file%
done | while read track; do
- listeners=$(${pkgs.curl}/bin/curl 'http://localhost:8000/status-json.xsl' \
- | ${pkgs.jq}/bin/jq '[.icestats.source[].listeners] | add')
+ listeners=$(${pkgs.iproute}/bin/ss -Hno state established '( sport = :8000 )' | wc -l)
echo "$(date -Is)" "$track" | tee -a "$HISTORY_FILE"
echo "$(tail -$LIMIT "$HISTORY_FILE")" > "$HISTORY_FILE"
${write_to_irc} "playing: $track listeners: $listeners"
diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix
index ac7db10f5..f3beb9eb9 100644
--- a/lass/2configs/websites/domsen.nix
+++ b/lass/2configs/websites/domsen.nix
@@ -91,7 +91,7 @@ in {
services.nextcloud = {
enable = true;
hostName = "o.xanf.org";
- package = pkgs.nextcloud19;
+ package = pkgs.nextcloud20;
config = {
adminpassFile = toString <secrets> + "/nextcloud_pw";
overwriteProtocol = "https";