Merge remote-tracking branch 'prism/master' into master

This commit is contained in:
tv 2020-12-02 00:45:50 +01:00
commit d60b1b793f
120 changed files with 2031 additions and 1797 deletions

View File

@ -77,20 +77,18 @@ in
networking.hostId = "54d97450"; # required for zfs use networking.hostId = "54d97450"; # required for zfs use
boot.initrd.luks.devices = let boot.initrd.luks.devices = let
usbkey = name: device: { usbkey = device: {
inherit name device keyFile; inherit device keyFile;
keyFileSize = 2048; keyFileSize = 2048;
preLVM = true; preLVM = true;
}; };
in [ in {
((usbkey "swap" (byid "ata-INTEL_SSDSA2M080G2GC_CVPO013300WD080BGN-part2")) swap = ((usbkey (byid "ata-INTEL_SSDSA2M080G2GC_CVPO013300WD080BGN-part2"))
// { allowDiscards = true; } ) // { allowDiscards = true; } );
((usbkey "root" (byid "ata-INTEL_SSDSA2M080G2GC_CVPO013300WD080BGN-part3")) root = ((usbkey (byid "ata-INTEL_SSDSA2M080G2GC_CVPO013300WD080BGN-part3"))
// { allowDiscards = true; } ) // { allowDiscards = true; } );
(usbkey "125" "/dev/md125") md125 = usbkey "/dev/md125";
(usbkey "126" "/dev/md126") md126 = usbkey "/dev/md126";
(usbkey "127" "/dev/md127") md127 = usbkey "/dev/md127";
]; };
} }

View File

@ -12,7 +12,6 @@
<stockholm/krebs/2configs/buildbot-stockholm.nix> <stockholm/krebs/2configs/buildbot-stockholm.nix>
<stockholm/krebs/2configs/binary-cache/nixos.nix> <stockholm/krebs/2configs/binary-cache/nixos.nix>
<stockholm/krebs/2configs/ircd.nix> <stockholm/krebs/2configs/ircd.nix>
<stockholm/krebs/2configs/nscd-fix.nix>
<stockholm/krebs/2configs/reaktor2.nix> <stockholm/krebs/2configs/reaktor2.nix>
<stockholm/krebs/2configs/wiki.nix> <stockholm/krebs/2configs/wiki.nix>
]; ];

View File

@ -7,19 +7,109 @@
<stockholm/krebs/2configs/secret-passwords.nix> <stockholm/krebs/2configs/secret-passwords.nix>
<stockholm/krebs/2configs/hw/x220.nix> <stockholm/krebs/2configs/hw/x220.nix>
## initrd unlocking
# (brain hosts/puyak/luks-ssd;echo) | ssh root@$(brain krebs-secrets/puyak/initrd/hostname) 'cat > /crypt-ramfs/passphrase'
<stockholm/krebs/2configs/tor/initrd.nix>
<stockholm/krebs/2configs/binary-cache/nixos.nix> <stockholm/krebs/2configs/binary-cache/nixos.nix>
<stockholm/krebs/2configs/binary-cache/prism.nix> <stockholm/krebs/2configs/binary-cache/prism.nix>
### Krebs ###
<stockholm/krebs/2configs/go.nix> <stockholm/krebs/2configs/go.nix>
#### NEWS ####
<stockholm/krebs/2configs/ircd.nix> <stockholm/krebs/2configs/ircd.nix>
<stockholm/krebs/2configs/news.nix> #<stockholm/krebs/2configs/news.nix>
<stockholm/krebs/2configs/news-spam.nix> #<stockholm/krebs/2configs/news-spam.nix>
### shackspace ###
# handle the worlddomination map via coap
<stockholm/krebs/2configs/shack/worlddomination.nix>
<stockholm/krebs/2configs/shack/ssh-keys.nix> <stockholm/krebs/2configs/shack/ssh-keys.nix>
# drivedroid.shack for shackphone
<stockholm/krebs/2configs/shack/drivedroid.nix>
# <stockholm/krebs/2configs/shack/nix-cacher.nix>
# Say if muell will be collected
<stockholm/krebs/2configs/shack/muell_caller.nix>
# provide muellshack api: muell.shack
<stockholm/krebs/2configs/shack/muellshack.nix>
# send mail if muell was not handled
<stockholm/krebs/2configs/shack/muell_mail.nix>
# provide light control api
<stockholm/krebs/2configs/shack/node-light.nix> # light.shack lounge.light.shack power.light.shack openhab.shack lightapi.shack
# light.shack web-ui
<stockholm/krebs/2configs/shack/light.shack.nix> #light.shack
# powerraw usb serial to mqtt and raw socket
<stockholm/krebs/2configs/shack/powerraw.nix> # powerraw.shack standby.shack
# send power stats to s3
<stockholm/krebs/2configs/shack/s3-power.nix> # powerraw.shack must be available
{ # do not log to /var/spool/log
services.nginx.appendHttpConfig = ''
map $request_method $loggable {
default 1;
GET 0;
}
log_format vhost '$host $remote_addr - $remote_user '
'[$time_local] "$request" $status '
'$body_bytes_sent "$http_referer" '
'"$http_user_agent"';
error_log stderr;
access_log syslog:server=unix:/dev/log vhost;
'';
services.journald.rateLimitBurst = 10000;
}
# create samba share for anonymous usage with the laser and 3d printer pc
<stockholm/krebs/2configs/shack/share.nix>
# mobile.lounge.mpd.shack
<stockholm/krebs/2configs/shack/mobile.mpd.nix>
# hass.shack
<stockholm/krebs/2configs/shack/glados>
# connect to git.shackspace.de as group runner for rz
<stockholm/krebs/2configs/shack/gitlab-runner.nix>
# Statistics collection and visualization
# <stockholm/krebs/2configs/shack/graphite.nix> # graphiteApi is broken and unused(hopefully)
## Collect data from mqtt.shack and store in graphite database
<stockholm/krebs/2configs/shack/mqtt_sub.nix>
## Collect radioactive data and put into graphite
<stockholm/krebs/2configs/shack/radioactive.nix>
## mqtt.shack
<stockholm/krebs/2configs/shack/mqtt.nix>
## influx.shack
<stockholm/krebs/2configs/shack/influx.nix>
## Collect local statistics via collectd and send to collectd
<stockholm/krebs/2configs/stats/shack-client.nix>
<stockholm/krebs/2configs/stats/shack-debugging.nix>
## netbox.shack: Netbox is disabled as nobody seems to be using it anyway
# <stockholm/krebs/2configs/shack/netbox.nix>
# grafana.shack
<stockholm/krebs/2configs/shack/grafana.nix>
# shackdns.shack
# replacement for leases.shack and shackles.shack
<stockholm/krebs/2configs/shack/shackDNS.nix>
# monitoring: prometheus.shack
<stockholm/krebs/2configs/shack/prometheus/node.nix> <stockholm/krebs/2configs/shack/prometheus/node.nix>
<stockholm/krebs/2configs/shack/prometheus/server.nix> <stockholm/krebs/2configs/shack/prometheus/server.nix>
<stockholm/krebs/2configs/shack/prometheus/blackbox.nix> <stockholm/krebs/2configs/shack/prometheus/blackbox.nix>
<stockholm/krebs/2configs/shack/prometheus/unifi.nix> <stockholm/krebs/2configs/shack/prometheus/unifi.nix>
<stockholm/krebs/2configs/shack/prometheus/alertmanager-telegram.nix> <stockholm/krebs/2configs/shack/prometheus/alertmanager-telegram.nix>
<stockholm/krebs/2configs/shack/gitlab-runner.nix>
## Collect local statistics via collectd and send to collectd ## Collect local statistics via collectd and send to collectd
<stockholm/krebs/2configs/stats/shack-client.nix> <stockholm/krebs/2configs/stats/shack-client.nix>

View File

@ -14,85 +14,15 @@ in
<stockholm/krebs/2configs/binary-cache/nixos.nix> <stockholm/krebs/2configs/binary-cache/nixos.nix>
<stockholm/krebs/2configs/binary-cache/prism.nix> <stockholm/krebs/2configs/binary-cache/prism.nix>
# handle the worlddomination map via coap #### shackspace services
<stockholm/krebs/2configs/shack/worlddomination.nix> <stockholm/krebs/2configs/shack/share.nix> # wolf.shack
<stockholm/krebs/2configs/shack/ssh-keys.nix>
# drivedroid.shack for shackphone # gitlab runner
<stockholm/krebs/2configs/shack/drivedroid.nix>
# <stockholm/krebs/2configs/shack/nix-cacher.nix>
# Say if muell will be collected
<stockholm/krebs/2configs/shack/muell_caller.nix>
# provide muellshack api
<stockholm/krebs/2configs/shack/muellshack.nix>
# provide light control api
<stockholm/krebs/2configs/shack/node-light.nix>
# light.shack web-ui
<stockholm/krebs/2configs/shack/light.shack.nix>
# send mail if muell was not handled
<stockholm/krebs/2configs/shack/muell_mail.nix>
# send mail if muell was not handled
<stockholm/krebs/2configs/shack/s3-power.nix>
# powerraw usb serial to mqtt and raw socket
<stockholm/krebs/2configs/shack/powerraw.nix>
{ # do not log to /var/spool/log
services.nginx.appendHttpConfig = ''
map $request_method $loggable {
default 1;
GET 0;
}
log_format vhost '$host $remote_addr - $remote_user '
'[$time_local] "$request" $status '
'$body_bytes_sent "$http_referer" '
'"$http_user_agent"';
error_log stderr;
access_log syslog:server=unix:/dev/log vhost;
'';
services.journald.rateLimitBurst = 10000;
}
# create samba share for anonymous usage with the laser and 3d printer pc
<stockholm/krebs/2configs/shack/share.nix>
# mobile.lounge.mpd.shack
<stockholm/krebs/2configs/shack/mobile.mpd.nix>
# hass.shack
<stockholm/krebs/2configs/shack/glados>
# connect to git.shackspace.de as group runner for rz
<stockholm/krebs/2configs/shack/gitlab-runner.nix> <stockholm/krebs/2configs/shack/gitlab-runner.nix>
# Statistics collection and visualization
# <stockholm/krebs/2configs/shack/graphite.nix> # graphiteApi is broken and unused(hopefully)
## Collect data from mqtt.shack and store in graphite database
<stockholm/krebs/2configs/shack/mqtt_sub.nix>
## Collect radioactive data and put into graphite
<stockholm/krebs/2configs/shack/radioactive.nix>
## mqtt.shack
<stockholm/krebs/2configs/shack/mqtt.nix>
## influx.shack
<stockholm/krebs/2configs/shack/influx.nix>
## Collect local statistics via collectd and send to collectd
<stockholm/krebs/2configs/stats/shack-client.nix>
<stockholm/krebs/2configs/stats/shack-debugging.nix>
<stockholm/krebs/2configs/shack/netbox.nix>
# prometheus.shack
#<stockholm/krebs/2configs/shack/prometheus/server.nix>
<stockholm/krebs/2configs/shack/prometheus/node.nix>
#<stockholm/krebs/2configs/shack/prometheus/unifi.nix>
# grafana.shack
<stockholm/krebs/2configs/shack/grafana.nix>
# shackdns.shack
# replacement for leases.shack and shackles.shack
<stockholm/krebs/2configs/shack/shackDNS.nix>
# misc # misc
<stockholm/krebs/2configs/shack/ssh-keys.nix>
<stockholm/krebs/2configs/save-diskspace.nix> <stockholm/krebs/2configs/save-diskspace.nix>
<stockholm/krebs/2configs/shack/prometheus/node.nix>
]; ];
# use your own binary cache, fallback use cache.nixos.org (which is used by # use your own binary cache, fallback use cache.nixos.org (which is used by

View File

@ -43,7 +43,6 @@ with import <stockholm/lib>;
]; ];
}; };
services.cron.enable = false; services.cron.enable = false;
services.nscd.enable = false;
services.ntp.enable = false; services.ntp.enable = false;
users.mutableUsers = false; users.mutableUsers = false;

View File

@ -1,33 +0,0 @@
{ config, pkgs, ... }:
let
url = "https://git.shackspace.de/";
# generate token from CI-token via:
## gitlab-runner register
## cat /etc/gitlab-runner/config.toml
token = import <secrets/shackspace-gitlab-ci-token.nix> ;
in {
systemd.services.gitlab-runner.path = [
"/run/wrappers" # /run/wrappers/bin/su
"/" # /bin/sh
];
systemd.services.gitlab-runner.serviceConfig.PrivateTmp = true;
virtualisation.docker.enable = true;
services.gitlab-runner = {
enable = true;
# configFile, configOptions and gracefulTimeout not yet in stable
# gracefulTimeout = "120min";
configFile = pkgs.writeText "gitlab-runner.cfg" ''
concurrent = 1
check_interval = 0
[[runners]]
name = "krebs-shell"
url = "${url}"
token = "${token}"
executor = "shell"
shell = "sh"
environment = ["PATH=/bin:/run/wrappers/bin:/etc/per-user/gitlab-runner/bin:/etc/per-user-pkgs/gitlab-runner/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"]
[runners.cache]
'';
};
}

View File

@ -1,24 +0,0 @@
with import <stockholm/lib>;
{ pkgs, ... }: let
enable = versionOlderThan "19.03";
versionOlderThan = v:
compareVersions
(versions.majorMinor version)
(versions.majorMinor v)
== -1;
warning = ''
Using custom services.nscd.config because
https://github.com/NixOS/nixpkgs/pull/50316
'';
in
optionalAttrs enable (trace warning {
services.nscd.enable = mkForce true;
services.nscd.config = mkForce (readFile (pkgs.fetchurl {
url = https://raw.githubusercontent.com/arianvp/nixpkgs/1d5f4cb/nixos/modules/services/system/nscd.conf;
sha256 = "1jlddk38lyynjn51zx3xi1nc29ahajyh0qg48qbq6dqlsrn3wxqs";
}));
})

View File

@ -95,7 +95,7 @@ let
} }
hooks.sed hooks.sed
(generators.command_hook { (generators.command_hook {
inherit (commands) hello random-emoji nixos-version stockholm-issue; inherit (commands) hello random-emoji nixos-version;
tell = { tell = {
filename = filename =
"${pkgs.Reaktor.src}/reaktor/commands/tell-on_privmsg"; "${pkgs.Reaktor.src}/reaktor/commands/tell-on_privmsg";

View File

@ -1,24 +1,48 @@
{ pkgs, ... }: { pkgs,lib, ... }:
let
runner-src = builtins.fetchTarball {
url = "https://gitlab.com/arianvp/nixos-gitlab-runner/-/archive/master/nixos-gitlab-runner-master.tar.gz";
sha256 = "1s0fy5ny2ygcfvx35xws8xz5ih4z4kdfqlq3r6byxpylw7r52fyi";
};
in
{ {
imports = [ services.gitlab-runner = {
"${runner-src}/gitlab-runner.nix"
];
services.gitlab-runner2 = {
enable = true; enable = true;
## registrationConfigurationFile contains: services= {
# CI_SERVER_URL=<CI server URL> # runner for building in docker via host's nix-daemon
# REGISTRATION_TOKEN=<registration secret> # nix store will be readable in runner, might be insecure
# RUNNER_TAG_LIST=nix,shacklan nix = with lib;{
# RUNNER_NAME=stockholm-runner-$name # File should contain at least these two variables:
registrationConfigFile = <secrets/shackspace-gitlab-ci>; # `CI_SERVER_URL`
#gracefulTermination = true; # `REGISTRATION_TOKEN`
registrationConfigFile = toString <secrets/shackspace-gitlab-ci>;
dockerImage = "alpine";
dockerVolumes = [
"/nix/store:/nix/store:ro"
"/nix/var/nix/db:/nix/var/nix/db:ro"
"/nix/var/nix/daemon-socket:/nix/var/nix/daemon-socket:ro"
];
dockerDisableCache = true;
preBuildScript = pkgs.writeScript "setup-container" ''
mkdir -p -m 0755 /nix/var/log/nix/drvs
mkdir -p -m 0755 /nix/var/nix/gcroots
mkdir -p -m 0755 /nix/var/nix/profiles
mkdir -p -m 0755 /nix/var/nix/temproots
mkdir -p -m 0755 /nix/var/nix/userpool
mkdir -p -m 1777 /nix/var/nix/gcroots/per-user
mkdir -p -m 1777 /nix/var/nix/profiles/per-user
mkdir -p -m 0755 /nix/var/nix/profiles/per-user/root
mkdir -p -m 0700 "$HOME/.nix-defexpr"
. ${pkgs.nix}/etc/profile.d/nix.sh
${pkgs.nix}/bin/nix-env -i ${concatStringsSep " " (with pkgs; [ nix cacert git openssh ])}
${pkgs.nix}/bin/nix-channel --add https://nixos.org/channels/nixpkgs-unstable
${pkgs.nix}/bin/nix-channel --update nixpkgs
'';
environmentVariables = {
ENV = "/etc/profile";
USER = "root";
NIX_REMOTE = "daemon";
PATH = "/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin";
NIX_SSL_CERT_FILE = "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt";
};
tagList = [ "nix" "shacklan" ];
};
};
}; };
systemd.services.gitlab-runner2.restartIfChanged = false; systemd.services.gitlab-runner.restartIfChanged = false;
systemd.services.docker.restartIfChanged = false; systemd.services.docker.restartIfChanged = false;
} }

View File

@ -21,23 +21,10 @@ in {
''; '';
}; };
}; };
services.home-assistant = let services.home-assistant =
dwd_pollen = pkgs.fetchFromGitHub { {
owner = "marcschumacher";
repo = "dwd_pollen";
rev = "0.1";
sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1";
};
in {
enable = true; enable = true;
package = (pkgs.home-assistant.overrideAttrs (old: { # TODO: find correct python package package = pkgs.home-assistant.override {
installCheckPhase = ''
echo LOLLLLLLLLLLLLLL
'';
postInstall = ''
cp -r ${dwd_pollen} $out/lib/python3.7/site-packages/homeassistant/components/dwd_pollen
'';
})).override {
extraPackages = ps: with ps; [ extraPackages = ps: with ps; [
python-forecastio jsonrpc-async jsonrpc-websocket mpd2 pkgs.picotts python-forecastio jsonrpc-async jsonrpc-websocket mpd2 pkgs.picotts
]; ];

View File

@ -1,32 +0,0 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, python
, voluptuous
}:
buildPythonPackage rec {
format = "other";
pname = "dwd_pollen";
version = "0.1";
src = fetchFromGitHub {
owner = "marcschumacher";
repo = "dwd_pollen";
rev = version;
sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1";
};
propagatedBuildInputs = [
voluptuous
];
installPhase = ''
install -D -t $out/${python.sitePackages}/homeassistant/components/sensor/dwd_pollen *
'';
meta = with lib; {
description = "Home Assistant component to retrieve Pollen data from DWD (Germany)";
homepage = https://github.com/marcschumacher/dwd_pollen;
license = licenses.mit;
maintainers = [ maintainers.makefu ];
};
}

View File

@ -10,7 +10,7 @@ let
sha256 = "1334jbbzlqizyp7zcn4hdswhhrnkj1p4p435n5nph82lzffrsi44"; sha256 = "1334jbbzlqizyp7zcn4hdswhhrnkj1p4p435n5nph82lzffrsi44";
}; };
buildInputs = [ buildInputs = [
(pkgs.python35.withPackages (pythonPackages: with pythonPackages; [ (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
docopt docopt
paho-mqtt paho-mqtt
])) ]))

View File

@ -37,6 +37,9 @@
# for legacy systems # for legacy systems
client min protocol = NT1 client min protocol = NT1
server min protocol = NT1 server min protocol = NT1
workgroup = WORKGROUP
server string = ${config.networking.hostName}
netbios name = ${config.networking.hostName}
''; '';
}; };
} }

View File

@ -0,0 +1,50 @@
{config, pkgs, ... }:
## unlock command:
# (brain hosts/puyak/luks-ssd;echo) | ssh root@$(brain krebs-secrets/puyak/initrd/hostname) 'cat > /crypt-ramfs/passphrase'
{
boot.initrd.network.enable = true;
boot.initrd.network.ssh = {
enable = true;
port = 22;
authorizedKeys = [
config.krebs.users.jeschli-brauerei.pubkey
config.krebs.users.lass.pubkey
config.krebs.users.lass-mors.pubkey
config.krebs.users.makefu.pubkey
config.krebs.users.tv.pubkey
];
hostKeys = [ <secrets/initrd/openssh_host_ecdsa_key> ];
};
boot.initrd.availableKernelModules = [ "e1000e" ];
boot.initrd.secrets = {
"/etc/tor/onion/bootup" = <secrets/initrd>;
};
boot.initrd.extraUtilsCommands = ''
copy_bin_and_libs ${pkgs.tor}/bin/tor
'';
# start tor during boot process
boot.initrd.network.postCommands = let
torRc = (pkgs.writeText "tor.rc" ''
DataDirectory /etc/tor
SOCKSPort 127.0.0.1:9050 IsolateDestAddr
SOCKSPort 127.0.0.1:9063
HiddenServiceDir /etc/tor/onion/bootup
HiddenServicePort 22 127.0.0.1:22
'');
in ''
echo "tor: preparing onion folder"
# have to do this otherwise tor does not want to start
chmod -R 700 /etc/tor
echo "make sure localhost is up"
ip a a 127.0.0.1/8 dev lo
ip link set lo up
echo "tor: starting tor"
tor -f ${torRc} --verify-config
tor -f ${torRc} &
'';
}

View File

@ -608,6 +608,10 @@ in {
mail = "joerg@thalheim.io"; mail = "joerg@thalheim.io";
pubkey = ssh-for "mic92"; pubkey = ssh-for "mic92";
}; };
shannan = {
mail = "shannan@lekwati.com";
pubkey = ssh-for "shannan";
};
qubasa = { qubasa = {
mail = "luis.nixos@gmail.com"; mail = "luis.nixos@gmail.com";
pubkey = ssh-for "qubasa"; pubkey = ssh-for "qubasa";

View File

@ -347,7 +347,10 @@ in {
nets = { nets = {
retiolum = { retiolum = {
ip4.addr = "10.243.29.171"; ip4.addr = "10.243.29.171";
aliases = [ "rock.r" ]; aliases = [
"rock.r"
"loki.r"
];
tinc.pubkey = '' tinc.pubkey = ''
-----BEGIN PUBLIC KEY----- -----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0uhNk3XXVxQcIVhD1Ime MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0uhNk3XXVxQcIVhD1Ime
@ -465,6 +468,7 @@ in {
aliases = [ aliases = [
"eva.r" "eva.r"
"prometheus.r" "prometheus.r"
"alertmanager.r"
]; ];
tinc.pubkey = '' tinc.pubkey = ''
-----BEGIN PUBLIC KEY----- -----BEGIN PUBLIC KEY-----
@ -508,5 +512,33 @@ in {
}; };
}; };
}; };
bernie = {
owner = config.krebs.users.mic92;
nets = rec {
retiolum = {
addrs = [
config.krebs.hosts.bernie.nets.retiolum.ip4.addr
config.krebs.hosts.bernie.nets.retiolum.ip6.addr
];
ip4.addr = "10.243.29.169";
aliases = [ "bernie.r" ];
tinc.pubkey = ''
-----BEGIN RSA PUBLIC KEY-----
MIICCgKCAgEApH5nG/Lwe/LiBkdL38vk1QcjOG/kf8dUqifouB56OQqe+MXASTSM
vhipszZqXVGgWRVrSH3WSZt0YAXTQQGEjtnAr6fSSnUek21omRGFgr47LiGJp9R8
OuhGPQs1sykIyl3HNSvDxj2EfWrXO73bKQPYdGIlfJWmsL69akWGlyYdEK1kloLC
ld5+eYICjiTtqAQ8snZQNaPIucW4cGOa0sATUP4H1jbDWtFCKE2/mR/gGo/W/opC
oOcJM7d5mb63blWVp9Zji/Gb64QltR50N3qvwc6W5ANHXIV97jYcNhSGqTsV0CEd
n0cqUqymh2e8fJdmbB4DvwqhWITn6nwuFOWoVCSFMmbiidyTm3RAH9ztZARzsQRL
Nj8OmeAr+plrzNH7AJpSkz30zukawCnbt+qWjqXLULH4kxJfOwzVh+KDfLzy7iLe
OWWrblgJZA2GHKzCC5zntNujW6Nr2AliSY2Hch2XfkLTWeNtclKIEXMkRxif5oxm
XpEJJ3lqdXz9/e37R/mkWVrdhpVfll2/v5c/PlnKMzky2mgkGpzegO0IiQcdJjrl
fuXAsh5UbnE5kt6vKL5aducScatyd5FRkNumKG5ji26eZR4lZmXn380JLDInV4n7
SODZL2fQFBnSD1wTWcq9Q/luPh4FitzJUZzHexvNxR/KBZycZJtdVw8CAwEAAQ==
-----END RSA PUBLIC KEY-----
'';
};
};
};
}; };
} }

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOBXTForyB6oNMK5bbGpALKU4lPsKRGxNLhrE/PnHHq7 shannan@bernie

View File

@ -62,8 +62,8 @@ let
}; };
}; };
users.extraUsers = singleton { users.users.${user.name} = {
inherit (user) name uid; inherit (user) uid;
home = cfg.dataDir; home = cfg.dataDir;
}; };
}; };

View File

@ -12,6 +12,7 @@ with import <stockholm/lib>;
in { in {
hosts = mapAttrs hostDefaults { hosts = mapAttrs hostDefaults {
brauerei = { brauerei = {
ci = false;
nets = { nets = {
retiolum = { retiolum = {
ip4.addr = "10.243.27.29"; ip4.addr = "10.243.27.29";
@ -93,6 +94,7 @@ in {
}; };
bolide = { bolide = {
ci = false;
nets = { nets = {
retiolum = { retiolum = {
ip4.addr = "10.243.27.31"; ip4.addr = "10.243.27.31";
@ -130,6 +132,7 @@ in {
}; };
reagenzglas = { reagenzglas = {
ci = false;
nets = { nets = {
retiolum = { retiolum = {
ip4.addr = "10.243.27.32"; ip4.addr = "10.243.27.32";

View File

@ -645,6 +645,45 @@ in {
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPARXXe0HaP1r0pLqtInhnbYSZsP0g4VC6aaWP7qi5+w"; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPARXXe0HaP1r0pLqtInhnbYSZsP0g4VC6aaWP7qi5+w";
syncthing.id = "J6PHKTS-2JG5NOL-H5ZWOF6-6L6ENA7-L4RO6DV-BQHU7YL-CHOLDCC-S5YX3AC"; syncthing.id = "J6PHKTS-2JG5NOL-H5ZWOF6-6L6ENA7-L4RO6DV-BQHU7YL-CHOLDCC-S5YX3AC";
}; };
styx = {
cores = 1;
nets = {
retiolum = {
ip4.addr = "10.243.11.1";
ip6.addr = r6 "111";
aliases = [
"styx.r"
];
tinc.pubkey = ''
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAuMJFklzpbxoDGD8LQ3tn
ETYrLu/TJjq5iSQx/JbbonJriMS3X/0+m8JREzeol67svQDuZEXTEg5EfEldxrrU
aZpNmTSmFbj2NLLCIfNBL/oLOvg9ElzhN+f+4jvakfEKi7Y7LekV25VVGrHbOEVE
3G6XWfHx5qO5Vd6kqNWQKD3LG38aZ/Lx9XYDMbujYxPGCtOsabtAz8BKo/RgOZzi
6A/54RFhdecJm0VoQk3iKpp2YqyCN6dLfJVLil4cREs4sW6nDyF4Y4l3dtZdfskq
m/MoZt6fwOjNIKuI9DGdU4/X1hQelnemstzxY5x1XwG52cz+ww0h7pMF2aggsHqn
Vmaq3b0fXrbn066Ybkbhz3UEIU9zKQGYaANGCnXxbvkd5lWbIN60GEXGE3zYJSAt
EH3FLDTGa27fTNgAnbdnSV40KWKN4FM0iY/xrt3aOXfneTP9S2fqzTVEL9vd04C/
7RWvRjvZ7mlAi+kVKSHkOibFVjeo+Z4Pvw5YxCAavrjXCiWj8zP8o3MNWcq/bMao
Uk9zBMXymm8zX43w5LNnhf59oitBjiY/mzZ3NDI9N3szMvJsaUEnhO4Kq1CWtMs2
6/TpEyRSmen1UmNwgKKFx3rELuctwMmNbOLL8cGLotEBhIk7vnZKD7NvLVX7xtOF
wzhy2N6a3ypB4XqM7dBzzAUCAwEAAQ==
-----END PUBLIC KEY-----
'';
};
wiregrill = {
ip6.addr = w6 "111";
aliases = [
"styx.w"
];
wireguard.pubkey = ''
0BZfd8f0pZMRfyoHrdYZY0cR5zfFvJcS8gQLn6xGuFs=
'';
};
};
ssh.privkey.path = <secrets/ssh.id_ed25519>;
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII3OpzRB3382d7c2apdHC+U/R0ZlaWxXZa3GFAj54ZhU ";
};
}; };
users = rec { users = rec {
lass = lass-blue; lass = lass-blue;

View File

@ -112,13 +112,15 @@ let
hostsArchive = mkOption { hostsArchive = mkOption {
type = types.package; type = types.package;
default = pkgs.runCommand "retiolum-hosts.tar.bz2" {} '' default = pkgs.runCommand "retiolum-hosts.tar.bz2" {
nativeBuildInputs = [ pkgs.gnutar pkgs.coreutils ];
} ''
cp \ cp \
--no-preserve=mode \ --no-preserve=mode \
--recursive \ --recursive \
${tinc.config.hostsPackage} \ ${tinc.config.hostsPackage} \
hosts hosts
${pkgs.gnutar}/bin/tar -cjf $out hosts tar -cjf $out hosts
''; '';
readOnly = true; readOnly = true;
}; };

View File

@ -6,13 +6,13 @@
, time, transformers, unagi-chan, unix, unordered-containers , time, transformers, unagi-chan, unix, unordered-containers
, vector, wai, warp , vector, wai, warp
}: }:
mkDerivation { mkDerivation rec {
pname = "reaktor2"; pname = "reaktor2";
version = "0.3.0"; version = "0.4.0";
src = fetchgit { src = fetchgit {
url = "https://cgit.krebsco.de/reaktor2"; url = "https://cgit.krebsco.de/reaktor2";
sha256 = "02hqpq8wcfd6rvi8qk10zy3f3lrzzqnjwqal4cbvksjn3vahz36h"; sha256 = "0bnn23hjl57y0a5rf3h8kq078dziby7il7fandz5wh6s4i3psicp";
rev = "a6893c00f78a8acd0a4bfe7da87ab6889eabcf21"; rev = "v${version}";
fetchSubmodules = true; fetchSubmodules = true;
}; };
isLibrary = false; isLibrary = false;

View File

@ -11,7 +11,7 @@ buildGoModule rec {
sha256 = "09cciml1j8x76jpm2v5v6h2q6j1fkhsz1kswslmx8wl4wk40xgp4"; sha256 = "09cciml1j8x76jpm2v5v6h2q6j1fkhsz1kswslmx8wl4wk40xgp4";
}; };
modSha256 = "0nlnxkpcna7g7qslyz5i1619paw4jkb1ma4fgpsgvgx1spwrjm8h"; vendorSha256 = "1v0fgin8dn81b559zz4lqmrl7hikr46g4gb18sci4riql5qs1isj";
postInstall = '' postInstall = ''
install -D ./default.tmpl $out/templates/default.tmpl install -D ./default.tmpl $out/templates/default.tmpl
''; '';

View File

@ -1,7 +1,10 @@
{ {
"url": "https://github.com/NixOS/nixpkgs", "url": "https://github.com/NixOS/nixpkgs",
"rev": "34ad166a830d3ac1541dcce571c52231f2f0865a", "rev": "a322b32e9d74fb476944ff6cfb55833dc69cfaaa",
"date": "2020-11-02T21:18:15-05:00", "date": "2020-11-19T01:15:20+01:00",
"sha256": "1jvi1562x3kq65w642vfimpszv65zbc7c2nv8gakhzcx4n3f47xq", "path": "/nix/store/cgb65l8rr7v7dd4hk5sv05bnmqkcgl0n-nixpkgs",
"fetchSubmodules": false "sha256": "1r0mkiqxija75spnyksmh8x5j4smnrxv5f7768s81gsl570kls0l",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
} }

View File

@ -1,7 +1,7 @@
{ {
"url": "https://github.com/NixOS/nixpkgs", "url": "https://github.com/NixOS/nixpkgs",
"rev": "7c2a362b58a1c2ba72d24aa3869da3b1a91d39e1", "rev": "f41c0fc7d8e49d94220f74495d4d702922df2a67",
"date": "2020-10-20T09:32:31+02:00", "date": "2020-11-15T21:38:00-06:00",
"sha256": "0gl4xndyahasa9dv5mi3x9w8s457wl2xh9lcldizcn1irjvkrzs4", "sha256": "01wim7ayn69y056q28ifw2f0mdypidpc0z15dda54aj5yy5vai09",
"fetchSubmodules": false "fetchSubmodules": false
} }

View File

@ -3,7 +3,7 @@ dir=$(dirname $0)
oldrev=$(cat $dir/nixpkgs.json | jq -r .rev | sed 's/\(.\{7\}\).*/\1/') oldrev=$(cat $dir/nixpkgs.json | jq -r .rev | sed 's/\(.\{7\}\).*/\1/')
nix-shell -p nix-prefetch-git --run 'nix-prefetch-git \ nix-shell -p nix-prefetch-git --run 'nix-prefetch-git \
--url https://github.com/NixOS/nixpkgs \ --url https://github.com/NixOS/nixpkgs \
--rev refs/heads/nixos-20.03' \ --rev refs/heads/nixos-20.09' \
> $dir/nixpkgs.json > $dir/nixpkgs.json
newrev=$(cat $dir/nixpkgs.json | jq -r .rev | sed 's/\(.\{7\}\).*/\1/') newrev=$(cat $dir/nixpkgs.json | jq -r .rev | sed 's/\(.\{7\}\).*/\1/')
git commit $dir/nixpkgs.json -m "nixpkgs: $oldrev -> $newrev" git commit $dir/nixpkgs.json -m "nixpkgs: $oldrev -> $newrev"

View File

@ -19,7 +19,6 @@ with import <stockholm/lib>;
<stockholm/lass/2configs/syncthing.nix> <stockholm/lass/2configs/syncthing.nix>
<stockholm/lass/2configs/nfs-dl.nix> <stockholm/lass/2configs/nfs-dl.nix>
#<stockholm/lass/2configs/prism-share.nix> #<stockholm/lass/2configs/prism-share.nix>
<stockholm/lass/2configs/ssh-cryptsetup.nix>
<stockholm/lass/2configs/network-manager.nix> <stockholm/lass/2configs/network-manager.nix>
<stockholm/lass/2configs/home-media.nix> <stockholm/lass/2configs/home-media.nix>
]; ];

View File

@ -34,10 +34,7 @@
}; };
boot.initrd.luks = { boot.initrd.luks = {
cryptoModules = [ "aes" "sha512" "sha1" "xts" ]; cryptoModules = [ "aes" "sha512" "sha1" "xts" ];
devices = [{ devices.luksroot.device = "/dev/nvme0n1p3";
name = "luksroot";
device = "/dev/nvme0n1p3";
}];
}; };
services.udev.extraRules = '' services.udev.extraRules = ''

View File

@ -391,6 +391,15 @@ with import <stockholm/lib>;
{ predicate = "-i wiregrill -p udp --dport 4000:4002"; target = "ACCEPT"; } { predicate = "-i wiregrill -p udp --dport 4000:4002"; target = "ACCEPT"; }
]; ];
} }
{
users.users.shannan = {
uid = genid_uint31 "shannan";
isNormalUser = true;
openssh.authorizedKeys.keys = [
config.krebs.users.shannan.pubkey
];
};
}
{ {
nix.trustedUsers = [ "mic92" ]; nix.trustedUsers = [ "mic92" ];
users.users.mic92 = { users.users.mic92 = {

View File

@ -15,7 +15,6 @@ with import <stockholm/lib>;
<stockholm/lass/2configs/bitcoin.nix> <stockholm/lass/2configs/bitcoin.nix>
<stockholm/lass/2configs/backup.nix> <stockholm/lass/2configs/backup.nix>
<stockholm/lass/2configs/blue-host.nix> <stockholm/lass/2configs/blue-host.nix>
<stockholm/lass/2configs/ssh-cryptsetup.nix>
<stockholm/lass/2configs/nfs-dl.nix> <stockholm/lass/2configs/nfs-dl.nix>
<stockholm/lass/2configs/gg23.nix> <stockholm/lass/2configs/gg23.nix>
<stockholm/lass/2configs/hass> <stockholm/lass/2configs/hass>

View File

@ -0,0 +1,80 @@
{ config, pkgs, ... }:
with import <stockholm/lib>;
{
imports = [
<stockholm/lass>
<stockholm/lass/2configs/mouse.nix>
<stockholm/lass/2configs/retiolum.nix>
<stockholm/lass/2configs/baseX.nix>
<stockholm/lass/2configs/exim-retiolum.nix>
<stockholm/lass/2configs/browsers.nix>
<stockholm/lass/2configs/programs.nix>
<stockholm/lass/2configs/nfs-dl.nix>
# <stockholm/lass/2configs/gg23.nix>
# <stockholm/lass/2configs/hass>
# <stockholm/lass/2configs/br.nix>
<stockholm/lass/2configs/fetchWallpaper.nix>
<stockholm/lass/2configs/home-media.nix>
# <stockholm/lass/2configs/syncthing.nix>
# <stockholm/lass/2configs/sync/sync.nix>
# <stockholm/lass/2configs/idc.nix>
];
krebs.build.host = config.krebs.hosts.styx;
krebs.iptables.tables.filter.INPUT.rules = [
{ predicate = "-p tcp --dport ${toString config.services.smokeping.port}"; target = "ACCEPT"; }
];
services.smokeping = {
enable = true;
targetConfig = ''
probe = FPing
menu = top
title = top
+ Local
menu = Local
title = Local Network
++ LocalMachine
menu = Local Machine
title = This host
host = localhost
+ Internet
menu = internet
title = internet
++ CloudflareDNS
menu = Cloudflare DNS
title = Cloudflare DNS server
host = 1.1.1.1
++ GoogleDNS
menu = Google DNS
title = Google DNS server
host = 8.8.8.8
+ retiolum
menu = retiolum
title = retiolum
++ gum
menu = gum.r
title = gum.r
host = gum.r
++ ni
menu = ni.r
title = ni.r
host = ni.r
++ prism
menu = prism.r
title = prism.r
host = prism.r
'';
};
}

View File

@ -0,0 +1,34 @@
{ config, lib, pkgs, ... }:
{
imports = [
./config.nix
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.loader.grub.enable = true;
boot.loader.grub.efiSupport = true;
boot.loader.grub.device = "/dev/disk/by-id/ata-SanDisk_SSD_G5_BICS4_20248F446514";
boot.loader.grub.efiInstallAsRemovable = true;
fileSystems."/" =
{ device = "/dev/disk/by-uuid/ee5c9099-17fa-401e-852e-67cb4ae068f4";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/EAA5-88A9";
fsType = "vfat";
};
swapDevices = [ ];
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}

View File

@ -15,7 +15,7 @@
loader.systemd-boot.enable = true; loader.systemd-boot.enable = true;
loader.timeout = 5; loader.timeout = 5;
initrd.luks.devices = [ { name = "luksroot"; device = "/dev/sda2"; } ]; initrd.luks.devices.luksroot.device = "/dev/sda2";
initrd.luks.cryptoModules = [ "aes" "sha512" "sha1" "xts" ]; initrd.luks.cryptoModules = [ "aes" "sha512" "sha1" "xts" ];
initrd.availableKernelModules = [ "xhci_hcd" "ehci_pci" "ahci" "usb_storage" ]; initrd.availableKernelModules = [ "xhci_hcd" "ehci_pci" "ahci" "usb_storage" ];
#kernelModules = [ "kvm-intel" "msr" ]; #kernelModules = [ "kvm-intel" "msr" ];

View File

@ -25,9 +25,6 @@ in {
environment = { environment = {
DISPLAY = ":${toString config.services.xserver.display}"; DISPLAY = ":${toString config.services.xserver.display}";
}; };
path = with pkgs; [
qt5.full
];
serviceConfig = { serviceConfig = {
SyslogIdentifier = "copyq"; SyslogIdentifier = "copyq";
ExecStart = "${pkgs.copyq}/bin/copyq"; ExecStart = "${pkgs.copyq}/bin/copyq";

View File

@ -1,44 +0,0 @@
with import <stockholm/lib>;
{ ... }:
{
users.extraUsers = {
dcsovpn = rec {
name = "dcsovpn";
uid = genid "dcsovpn";
description = "user for running dcso openvpn";
home = "/home/${name}";
};
};
users.extraGroups.dcsovpn.gid = genid "dcsovpn";
services.openvpn.servers = {
dcso = {
config = ''
client
dev tun
tun-mtu 1356
mssfix
proto udp
float
remote 217.111.55.41 1194
nobind
user dcsovpn
group dcsovpn
persist-key
persist-tun
ca ${toString <secrets/dcsovpn/ca.pem>}
cert ${toString <secrets/dcsovpn/cert.pem>}
key ${toString <secrets/dcsovpn/cert.key>}
verb 3
mute 20
auth-user-pass ${toString <secrets/dcsovpn/login.txt>}
route-method exe
route-delay 2
'';
updateResolvConf = true;
};
};
}

View File

@ -2,7 +2,6 @@ with import <stockholm/lib>;
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = [ imports = [
<stockholm/krebs/2configs/nscd-fix.nix>
./binary-cache/client.nix ./binary-cache/client.nix
./backup.nix ./backup.nix
./gc.nix ./gc.nix
@ -223,4 +222,5 @@ with import <stockholm/lib>;
# use 24:00 time format, the default got sneakily changed around 20.03 # use 24:00 time format, the default got sneakily changed around 20.03
i18n.defaultLocale = mkDefault "C.UTF-8"; i18n.defaultLocale = mkDefault "C.UTF-8";
system.stateVersion = mkDefault "20.03";
} }

View File

@ -26,7 +26,7 @@ with import ./lib.nix { inherit lib; };
lovelaceConfigWritable = true; lovelaceConfigWritable = true;
}; };
lass.hass.config = let services.home-assistant.config = let
tasmota_s20 = name: topic: { tasmota_s20 = name: topic: {
platform = "mqtt"; platform = "mqtt";
inherit name; inherit name;

View File

@ -2,38 +2,38 @@
with import ../lib.nix { inherit lib; }; with import ../lib.nix { inherit lib; };
{ {
lass.hass.config = lib.mkMerge [ services.home-assistant.config = lib.mkMerge [
(lightswitch switches.dimmer.bett lights.bett) (lightswitch switches.dimmer.bett lights.bett)
]; ];
lass.hass.love = { # lass.hass.love = {
resources = [{ # resources = [{
url = "https://raw.githubusercontent.com/ljmerza/light-entity-card/master/dist/light-entity-card.js.map"; # url = "https://raw.githubusercontent.com/ljmerza/light-entity-card/master/dist/light-entity-card.js.map";
type = "js"; # type = "js";
}]; # }];
views = [{ # views = [{
title = "bett"; # title = "bett";
cards = [ # cards = [
{ # {
type = "markdown"; # type = "markdown";
title = "hello world"; # title = "hello world";
content = "This is just a test"; # content = "This is just a test";
} # }
{ # {
type = "light"; # type = "light";
entity = "light.${lights.bett}"; # entity = "light.${lights.bett}";
} # }
{ # {
type = "custom:light-entity-card"; # type = "custom:light-entity-card";
entity = "light.${lights.bett}"; # entity = "light.${lights.bett}";
} # }
{ # {
type = "history-graph"; # type = "history-graph";
entities = [ # entities = [
"light.${lights.bett}" # "light.${lights.bett}"
]; # ];
} # }
]; # ];
}]; # }];
}; # };
} }

View File

@ -2,7 +2,7 @@
with import ../lib.nix { inherit lib; }; with import ../lib.nix { inherit lib; };
{ {
lass.hass.config = lib.mkMerge [ services.home-assistant.config = lib.mkMerge [
(detect_movement sensors.movement.essen lights.essen 10) (detect_movement sensors.movement.essen lights.essen 10)
(lightswitch switches.dimmer.essen lights.essen) (lightswitch switches.dimmer.essen lights.essen)
]; ];

View File

@ -2,7 +2,7 @@
with import ../lib.nix { inherit lib; }; with import ../lib.nix { inherit lib; };
{ {
lass.hass.config = lib.mkMerge [ services.home-assistant.config = lib.mkMerge [
(detect_movement sensors.movement.nass lights.nass 100) (detect_movement sensors.movement.nass lights.nass 100)
(lightswitch switches.dimmer.nass lights.nass) (lightswitch switches.dimmer.nass lights.nass)
]; ];

View File

@ -35,7 +35,7 @@ in {
volumes = ["/var/lib/zigbee2mqtt:/app/data"]; volumes = ["/var/lib/zigbee2mqtt:/app/data"];
}; };
lass.hass.config = { services.home-assistant.config = {
sensor = [ sensor = [
# Sensor for monitoring the bridge state # Sensor for monitoring the bridge state
{ {

View File

@ -97,7 +97,6 @@ in {
overwriteProtocol = "https"; overwriteProtocol = "https";
}; };
https = true; https = true;
nginx.enable = true;
}; };
services.nginx.virtualHosts."o.xanf.org" = { services.nginx.virtualHosts."o.xanf.org" = {
enableACME = true; enableACME = true;

View File

@ -16,7 +16,6 @@ in {
email = "acme@lassul.us"; email = "acme@lassul.us";
acceptTerms = true; acceptTerms = true;
certs."lassul.us" = { certs."lassul.us" = {
allowKeysForGroup = true;
group = "lasscert"; group = "lasscert";
}; };
}; };
@ -78,7 +77,6 @@ in {
email = "lassulus@lassul.us"; email = "lassulus@lassul.us";
webroot = "/var/lib/acme/acme-challenge"; webroot = "/var/lib/acme/acme-challenge";
group = "nginx"; group = "nginx";
user = "nginx";
}; };

View File

@ -4,7 +4,6 @@ _:
./dnsmasq.nix ./dnsmasq.nix
./ejabberd ./ejabberd
./folderPerms.nix ./folderPerms.nix
./hass.nix
./hosts.nix ./hosts.nix
./klem.nix ./klem.nix
./mysql-backup.nix ./mysql-backup.nix

View File

@ -1,51 +0,0 @@
{ config, lib, pkgs, ... }:
with import <stockholm/lib>;
let
cfg = config.lass.hass;
in {
options.lass.hass = {
config = mkOption {
default = {};
type = with lib.types; let
valueType = nullOr (oneOf [
bool
int
float
str
(attrsOf valueType)
(listOf valueType)
]) // {
description = "Yaml value";
emptyValue.value = {};
};
in valueType;
};
love = mkOption {
default = {};
type = with lib.types; let
valueType = nullOr (oneOf [
bool
int
float
str
(attrsOf valueType)
(listOf valueType)
]) // {
description = "Yaml value";
emptyValue.value = {};
};
in valueType;
};
};
config =
assert versionOlder version "20.09";
mkIf (cfg.config != {})
{
services.home-assistant.config = cfg.config;
# services.home-assistant.lovelaceConfig = cfg.love;
};
}

View File

@ -82,8 +82,12 @@ in {
# ci # ci
# <stockholm/makefu/2configs/exim-retiolum.nix> # <stockholm/makefu/2configs/exim-retiolum.nix>
<stockholm/makefu/2configs/git/cgit-retiolum.nix> <stockholm/makefu/2configs/git/cgit-retiolum.nix>
###### Shack #####
# <stockholm/makefu/2configs/shack/events-publisher> # <stockholm/makefu/2configs/shack/events-publisher>
<stockholm/makefu/2configs/shack/gitlab-runner> # <stockholm/makefu/2configs/shack/gitlab-runner>
<stockholm/makefu/2configs/remote-build/slave.nix> <stockholm/makefu/2configs/remote-build/slave.nix>
<stockholm/makefu/2configs/remote-build/aarch64-community.nix> <stockholm/makefu/2configs/remote-build/aarch64-community.nix>
<stockholm/makefu/2configs/taskd.nix> <stockholm/makefu/2configs/taskd.nix>

View File

@ -47,6 +47,7 @@ in {
# <stockholm/makefu/2configs/legacy_only.nix> # <stockholm/makefu/2configs/legacy_only.nix>
<stockholm/makefu/2configs/share/omo.nix> <stockholm/makefu/2configs/share/omo.nix>
<stockholm/makefu/2configs/share/gum-client.nix>
<stockholm/makefu/2configs/dcpp/airdcpp.nix> <stockholm/makefu/2configs/dcpp/airdcpp.nix>
{ krebs.airdcpp.dcpp.shares = let { krebs.airdcpp.dcpp.shares = let
d = path: "/media/cryptX/${path}"; d = path: "/media/cryptX/${path}";
@ -91,7 +92,6 @@ in {
<stockholm/makefu/2configs/bluetooth-mpd.nix> <stockholm/makefu/2configs/bluetooth-mpd.nix>
<stockholm/makefu/2configs/ham> <stockholm/makefu/2configs/ham>
<stockholm/makefu/2configs/ham/zigbee2mqtt>
{ {
makefu.ps3netsrv = { makefu.ps3netsrv = {
enable = true; enable = true;

View File

@ -37,10 +37,11 @@
passwdqc-utils passwdqc-utils
gnupg gnupg
populate populate
(pkgs.writeScriptBin "tor-browser" '' # 20.09: torbrowser is broken
#! /bin/sh #(pkgs.writeScriptBin "tor-browser" ''
TOR_SKIP_LAUNCH=1 ${torbrowser}/bin/tor-browser # #! /bin/sh
'') # TOR_SKIP_LAUNCH=1 ${torbrowser}/bin/tor-browser
#'')
]; ];
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [

View File

@ -17,12 +17,14 @@ in {
PasswordAuthentication no PasswordAuthentication no
''; '';
}; };
users.users.auphonic = { users.users.auphonic = {
uid = genid "auphonic"; uid = genid "auphonic";
group = "nginx"; group = "nginx";
useDefaultShell = true; useDefaultShell = true;
openssh.authorizedKeys.keys = [ ident config.krebs.users.makefu.pubkey ]; openssh.authorizedKeys.keys = [ ident config.krebs.users.makefu.pubkey ];
}; };
services.logrotate = { services.logrotate = {
enable = true; enable = true;
config = '' config = ''
@ -36,6 +38,12 @@ in {
} }
''; '';
}; };
# 20.09 unharden nginx to write logs
systemd.services.nginx.serviceConfig.ReadWritePaths = [
"/var/spool/nginx/logs/"
];
services.nginx = { services.nginx = {
appendHttpConfig = '' appendHttpConfig = ''
types { types {
@ -55,15 +63,4 @@ in {
''; '';
}; };
}; };
environment.etc."netdata/python.d/web_log.conf".text = ''
nginx_log3:
name: 'nginx'
path: '/var/spool/nginx/logs/access.log'
nginx_log4:
name: 'bgt'
path: '${bgtaccess}'
'';
users.users.netdata.extraGroups = [ "nginx" ];
} }

View File

@ -1,84 +1,87 @@
[ {
{ alias = "Turn on Fernseher on group home"; services.home-assistant.config.automation =
trigger = { [
platform = "state"; { alias = "Turn on Fernseher on group home";
entity_id = "group.team"; trigger = {
from = "not_home";
to = "home";
for.seconds = 30;
};
action = [
{
service = "homeassistant.turn_on";
entity_id = [
"switch.fernseher"
"switch.feuer"
];
}
{
service = "media_player.kodi_call_method";
data = {
entity_id = "media_player.kodi";
method = "Player.Open";
item.partymode = "music";
};
}
{
service = "notify.telegrambot";
data = {
title = "Bureau Startup";
message = "Das Büro wurde eröffnet";
};
}
];
}
{ alias = "Turn off Fernseher after last in group left";
trigger = [
{ # trigger when movement was detected at the time
platform = "state"; platform = "state";
entity_id = "group.team"; entity_id = "group.team";
from = "home"; from = "not_home";
to = "not_home"; to = "home";
} for.seconds = 30;
{ # trigger at 18:00 no matter what };
# to avoid 'everybody left before 18:00:00' action = [
platform = "time";
at = "18:00:00";
}
];
action = [
{
service = "homeassistant.turn_off";
entity_id = [
"switch.fernseher"
"switch.feuer"
"light.status_felix"
"light.status_daniel"
];
}
{
service = "notify.telegrambot";
data_template = {
title = "Bureau Shutdown";
message = "All devices are turned off due to {{ trigger.platform }}";
};
}
];
condition =
{ condition = "and";
conditions = [
{ {
condition = "time"; service = "homeassistant.turn_on";
before = "06:30:00"; #only turn off between 6:30 and 18:00 entity_id = [
after = "18:00:00"; "switch.fernseher"
# weekday = [ "mon" "tue" "wed" "thu" "fri" ]; "switch.feuer"
];
} }
{ # if anybody is still there {
condition = "state"; service = "media_player.kodi_call_method";
entity_id = "group.team"; data = {
state = "not_home"; entity_id = "media_player.kodi";
method = "Player.Open";
item.partymode = "music";
};
}
{
service = "notify.telegrambot";
data = {
title = "Bureau Startup";
message = "Das Büro wurde eröffnet";
};
} }
]; ];
}; }
} { alias = "Turn off Fernseher after last in group left";
] trigger = [
{ # trigger when movement was detected at the time
platform = "state";
entity_id = "group.team";
from = "home";
to = "not_home";
}
{ # trigger at 18:00 no matter what
# to avoid 'everybody left before 18:00:00'
platform = "time";
at = "18:00:00";
}
];
action = [
{
service = "homeassistant.turn_off";
entity_id = [
"switch.fernseher"
"switch.feuer"
"light.status_felix"
"light.status_daniel"
];
}
{
service = "notify.telegrambot";
data_template = {
title = "Bureau Shutdown";
message = "All devices are turned off due to {{ trigger.platform }}";
};
}
];
condition =
{ condition = "and";
conditions = [
{
condition = "time";
before = "06:30:00"; #only turn off between 6:30 and 18:00
after = "18:00:00";
# weekday = [ "mon" "tue" "wed" "thu" "fri" ];
}
{ # if anybody is still there
condition = "state";
entity_id = "group.team";
state = "not_home";
}
];
};
}
];
}

View File

@ -1,31 +1,34 @@
[ {
{ alias = "State on HA start-up"; services.home-assistant.config.automation =
trigger = { [
platform = "homeassistant"; { alias = "State on HA start-up";
event = "start"; trigger = {
}; platform = "homeassistant";
action = [ event = "start";
# Startup State };
{ service = "mqtt.publish"; action = [
data = { # Startup State
topic = "/bam/sonoffs/cmnd/state"; { service = "mqtt.publish";
payload = ""; data = {
}; topic = "/bam/sonoffs/cmnd/state";
} payload = "";
# Firmware Version };
{ service = "mqtt.publish"; }
data = { # Firmware Version
topic = "/bam/sonoffs/cmnd/status"; { service = "mqtt.publish";
payload = "2"; data = {
}; topic = "/bam/sonoffs/cmnd/status";
} payload = "2";
# Will trigger restart of all devices! };
#{ service = "mqtt.publish"; }
# data = { # Will trigger restart of all devices!
# topic = "sonoffs/cmnd/SetOption59"; # configure sending state on power change #{ service = "mqtt.publish";
# payload = "1"; # data = {
# }; # topic = "sonoffs/cmnd/SetOption59"; # configure sending state on power change
#} # payload = "1";
]; # };
} #}
] ];
}
];
}

View File

@ -1,35 +1,38 @@
[ {
# TODO: trigger if it is before dusk and somebody arives but nachtlichter are services.home-assistant.config.automation =
# off from last day [
# TODO: do not have nachtlicht turned on at night # TODO: trigger if it is before dusk and somebody arives but nachtlichter are
{ # off from last day
alias = "Turn on Nachtlicht at dusk"; # when it gets dim # TODO: do not have nachtlicht turned on at night
trigger = {
{ platform = "numeric_state"; alias = "Turn on Nachtlicht at dusk"; # when it gets dim
entity_id = "sun.sun"; trigger =
value_template = "{{ state.attributes.elevation }}"; { platform = "numeric_state";
below = 10; entity_id = "sun.sun";
value_template = "{{ state.attributes.elevation }}";
below = 10;
}; };
action = action =
{ service = "homeassistant.turn_on"; { service = "homeassistant.turn_on";
entity_id = [ "group.nachtlicht" ]; entity_id = [ "group.nachtlicht" ];
}; };
} }
{ {
alias = "Turn off Nachtlicht at dawn"; alias = "Turn off Nachtlicht at dawn";
trigger = trigger =
{ platform = "sun"; { platform = "sun";
event = "sunrise"; event = "sunrise";
offset = "01:30:00"; # on dawn offset = "01:30:00"; # on dawn
}; };
# TODO: when somebody is still in the buero # TODO: when somebody is still in the buero
# condition = # condition =
#{ #{
#}; #};
action = action =
{ service = "homeassistant.turn_off"; { service = "homeassistant.turn_off";
entity_id = [ "group.nachtlicht" ]; entity_id = [ "group.nachtlicht" ];
}; };
} }
] ];
}

View File

@ -1,71 +1,75 @@
let let
long_threshold = 30; long_threshold = 30;
in [ in
{ {
alias = "Bad Air Alarm 60 seconds"; services.home-assistant.config.automation =
trigger = [
{ platform = "numeric_state"; {
entity_id = "sensor.air_quality"; alias = "Bad Air Alarm 60 seconds";
above = 1523; trigger =
for.seconds = 60; { platform = "numeric_state";
}; entity_id = "sensor.air_quality";
condition = { above = 1523;
condition = "and"; for.seconds = 60;
conditions = [ };
{ condition = "state"; condition = {
entity_id = "group.team"; condition = "and";
state = "home"; conditions = [
} { condition = "state";
{ condition = "time"; entity_id = "group.team";
after = "06:00:00"; state = "home";
before = "20:00:00"; }
{ condition = "time";
after = "06:00:00";
before = "20:00:00";
}
];
};
action = [
{ service = "homeassistant.turn_on";
entity_id = [
"script.schlechteluft"
];
} }
]; ];
}; }
{
action = [ alias = "Bad Air Alarm ${toString long_threshold} Minutes";
{ service = "homeassistant.turn_on"; trigger =
entity_id = [ { platform = "numeric_state";
"script.schlechteluft" entity_id = "sensor.air_quality";
above = 1523;
for.minutes = long_threshold;
};
condition = {
condition = "and";
conditions = [
{ condition = "state";
entity_id = "group.team";
state = "home";
}
{ condition = "time";
after = "06:00:00";
before = "20:00:00";
}
]; ];
} };
];
} action = [
{ { service = "homeassistant.turn_on";
alias = "Bad Air Alarm ${toString long_threshold} Minutes"; entity_id = [
trigger = "script.schlechteluft"
{ platform = "numeric_state"; ];
entity_id = "sensor.air_quality";
above = 1523;
for.minutes = long_threshold;
};
condition = {
condition = "and";
conditions = [
{ condition = "state";
entity_id = "group.team";
state = "home";
} }
{ condition = "time"; { service = "tts.google_say";
after = "06:00:00"; entity_id = "media_player.mpd";
before = "20:00:00"; data_template = {
message = "BEEP BEEP - Die luft ist schon ${toString long_threshold} Minuten schlecht! Student Nummer {{ range(1,500) | random }}, öffne ein Fenster.";
language = "de";
};
} }
]; ];
}; }
];
action = [ }
{ service = "homeassistant.turn_on";
entity_id = [
"script.schlechteluft"
];
}
{ service = "tts.google_say";
entity_id = "media_player.mpd";
data_template = {
message = "BEEP BEEP - Die luft ist schon ${toString long_threshold} Minuten schlecht! Student Nummer {{ range(1,500) | random }}, öffne ein Fenster.";
language = "de";
};
}
];
}
]

View File

@ -12,6 +12,9 @@ let
# expire_after = "5"; #expire after 5 seconds # expire_after = "5"; #expire after 5 seconds
qos = 1; qos = 1;
}; };
in [ in {
(tasmota_button "RedButton" "redbutton") services.home-assistant.config.binary_sensor =
] [
(tasmota_button "RedButton" "redbutton")
];
}

View File

@ -1,12 +1,15 @@
[ {
{ platform = "mqtt"; services.home-assistant.config.binary_sensor =
device_class = "motion"; [
name = "Motion"; { platform = "mqtt";
state_topic = "/bam/easy2/movement/Switch"; device_class = "motion";
payload_on = "1"; name = "Motion";
payload_off = "0"; state_topic = "/bam/easy2/movement/Switch";
availability_topic = "/bam/easy2/tele/LWT"; payload_on = "1";
payload_available = "Online"; payload_off = "0";
payload_not_available = "Offline"; availability_topic = "/bam/easy2/tele/LWT";
} payload_available = "Online";
] payload_not_available = "Offline";
}
];
}

View File

@ -1,10 +1,13 @@
[ {
{ name = "Poorly Drawn Lines"; services.home-assistant.config.camera =
platform = "generic"; [
still_image_url = http://127.0.0.1:8123/local/lines.png ; { name = "Poorly Drawn Lines";
} platform = "generic";
{ name = "XKCD"; still_image_url = http://127.0.0.1:8123/local/lines.png ;
platform = "generic"; }
still_image_url = http://127.0.0.1:8123/local/xkcd.png ; { name = "XKCD";
} platform = "generic";
] still_image_url = http://127.0.0.1:8123/local/xkcd.png ;
}
];
}

View File

@ -5,22 +5,26 @@ let
inherit name still_image_url; inherit name still_image_url;
platform = "generic"; platform = "generic";
}; };
in [ in
( cam "Max-Eyth-See" https://www.wav-stuttgart.de/webcam/_/webcam1.jpg ) {
( cam "Wilhelma" http://webcam.wilhelma.de/webcam02/webcam02.jpg ) services.home-assistant.config.camera =
( cam "Marktplatz" https://webcam.stuttgart.de/wcam007/current.jpg ) [
( cam "Schoch Areal" https://webcam.stuttgart.de/wcam004/current.jpg ) ( cam "Max-Eyth-See" https://www.wav-stuttgart.de/webcam/_/webcam1.jpg )
( cam "Leuze" https://webcam.stuttgart.de/wcam005/current.jpg ) ( cam "Wilhelma" http://webcam.wilhelma.de/webcam02/webcam02.jpg )
( cam "Straße Wilhelma" https://webcam.stuttgart.de/wcam006/current.jpg ) ( cam "Marktplatz" https://webcam.stuttgart.de/wcam007/current.jpg )
( cam "Fernsehturm 1" http://webcam.fernsehturmstuttgart.com/current.jpg ) ( cam "Schoch Areal" https://webcam.stuttgart.de/wcam004/current.jpg )
( cam "Fernsehturm 2" http://webcam.fernsehturmstuttgart.com/current2.jpg ) ( cam "Leuze" https://webcam.stuttgart.de/wcam005/current.jpg )
( cam "Feuerbach Lemberg" http://www.regio7.de/handy/current.jpg ) ( cam "Straße Wilhelma" https://webcam.stuttgart.de/wcam006/current.jpg )
( cam "Flughafen Stuttgart 1" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam2.jpg ) ( cam "Fernsehturm 1" http://webcam.fernsehturmstuttgart.com/current.jpg )
( cam "Flughafen Stuttgart 2" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam5.jpg ) ( cam "Fernsehturm 2" http://webcam.fernsehturmstuttgart.com/current2.jpg )
( cam "Flughafen Stuttgart 3" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam7.jpg ) ( cam "Feuerbach Lemberg" http://www.regio7.de/handy/current.jpg )
( cam "S21 1" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-03/s21-turm03.jpg ) ( cam "Flughafen Stuttgart 1" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam2.jpg )
( cam "S21 2" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-02/s21-turm-02.jpg ) ( cam "Flughafen Stuttgart 2" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam5.jpg )
( cam "S21 3" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-01/s21-turm-01.jpg ) ( cam "Flughafen Stuttgart 3" http://webcam.flughafen-stuttgart.de/Flughafen_Stuttgart_Webcam7.jpg )
( cam "S21 4" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Jaegerstrasse-Nordkopf/s21-jaegerstrassse-nordkopf.jpg ) ( cam "S21 1" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-03/s21-turm03.jpg )
( cam "S21 5" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Bahndirektion-Nord/S21-Bundesbahndirektion-Nord.jpg ) ( cam "S21 2" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-02/s21-turm-02.jpg )
] ( cam "S21 3" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Turm-01/s21-turm-01.jpg )
( cam "S21 4" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Jaegerstrasse-Nordkopf/s21-jaegerstrassse-nordkopf.jpg )
( cam "S21 5" http://webcam-bahnprojekt-stuttgart-ulm.de/S21-Bahndirektion-Nord/S21-Bundesbahndirektion-Nord.jpg )
];
}

View File

@ -1,14 +1,17 @@
[ {
{ name = "Baumarkt"; services.home-assistant.config.camera =
platform = "generic"; [
still_image_url = http://t4915209254324-p80-c0-h6jv2afnujcoftrcstsafb45kdrqv4buy.webdirect.mdex.de/oneshotimage ;# baumarkt { name = "Baumarkt";
} platform = "generic";
{ name = "Autobahn Heilbronn"; still_image_url = http://t4915209254324-p80-c0-h6jv2afnujcoftrcstsafb45kdrqv4buy.webdirect.mdex.de/oneshotimage ;# baumarkt
platform = "generic"; }
still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K10 ; { name = "Autobahn Heilbronn";
} platform = "generic";
{ name = "Autobahn Singen"; still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K10 ;
platform = "generic"; }
still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K11 ; { name = "Autobahn Singen";
} platform = "generic";
] still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K11 ;
}
];
}

View File

@ -1,44 +1,53 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
kodi-host = "192.168.8.11"; kodi-host = "192.168.8.11";
ten_hours = import ./multi/10h_timers.nix { inherit lib; }; # provides: timer automation script
mittagessen = import ./multi/mittagessen.nix { inherit lib; }; # provides: automation script
matrix = import ./multi/matrix.nix { inherit lib; }; # provides: matrix automation
frosch = import ./multi/frosch.nix { inherit lib; }; # provides: sensor binary_sensor switch light script automation
aramark = import ./multi/aramark.nix { inherit lib; }; # provides: sensor binary_sensor
standup = import ./multi/daily-standup.nix { inherit lib; }; # provides: automation script
in { in {
imports = [ imports = [
./ota.nix ./ota.nix
./comic-updater.nix ./comic-updater.nix
./puppy-proxy.nix ./puppy-proxy.nix
# hass config
## complex configs
./multi/daily-standup.nix
./multi/aramark.nix
./multi/matrix.nix
./multi/frosch.nix
./multi/mittagessen.nix
./multi/10h_timers.nix
./switch/tasmota_switch.nix
./switch/rfbridge.nix
./light/statuslight.nix
./light/buzzer.nix
./script/multi_blink.nix
./binary_sensor/buttons.nix
./binary_sensor/motion.nix
# ./sensor/pollen.nix requires dwd_pollen
./sensor/espeasy.nix
./sensor/airquality.nix
./sensor/outside.nix
./sensor/tasmota_firmware.nix
./camera/verkehrskamera.nix
./camera/comic.nix
./camera/stuttgart.nix
./automation/bureau-shutdown.nix
./automation/nachtlicht.nix
./automation/schlechteluft.nix
./automation/hass-restart.nix
./device_tracker/openwrt.nix
./person/team.nix
]; ];
networking.firewall.allowedTCPPorts = [ 8123 ]; networking.firewall.allowedTCPPorts = [ 8123 ];
state = [ "/var/lib/hass/known_devices.yaml" ]; state = [ "/var/lib/hass/known_devices.yaml" ];
services.home-assistant = let
dwd_pollen = pkgs.fetchFromGitHub { services.home-assistant = {
owner = "marcschumacher";
repo = "dwd_pollen";
rev = "0.1";
sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1";
};
in {
enable = true; enable = true;
package = (pkgs.home-assistant.overrideAttrs (old: {
# TODO: find correct python package
installCheckPhase = ''
echo LOLLLLLLLLLLLLLL
'';
postInstall = ''
cp -r ${dwd_pollen} $out/lib/python3.7/site-packages/homeassistant/components/dwd_pollen
'';
})).override {
extraPackages = ps: with ps; [
pkgs.picotts
python-forecastio jsonrpc-async jsonrpc-websocket mpd2
(callPackage ./deps/openwrt-luci-rpc.nix { })
];
};
autoExtraComponents = true; autoExtraComponents = true;
config = { config = {
config = {}; config = {};
@ -73,7 +82,6 @@ in {
source = "hass"; source = "hass";
}; };
}; };
matrix = matrix.matrix;
mqtt = { mqtt = {
discovery = true; discovery = true;
discovery_prefix = "homeassistant"; discovery_prefix = "homeassistant";
@ -95,13 +103,6 @@ in {
retain = true; retain = true;
}; };
}; };
switch = (import ./switch/tasmota_switch.nix)
++ frosch.switch
++ (import ./switch/rfbridge.nix);
light = (import ./light/statuslight.nix)
++ (import ./light/buzzer.nix)
++ frosch.light;
timer = ten_hours.timer;
notify = [ notify = [
{ {
platform = "kodi"; platform = "kodi";
@ -115,7 +116,7 @@ in {
(builtins.fromJSON (builtins.readFile (builtins.fromJSON (builtins.readFile
<secrets/hass/telegram-bot.json>)).allowed_chat_ids 0; <secrets/hass/telegram-bot.json>)).allowed_chat_ids 0;
} }
] ++ matrix.notify; ];
media_player = [ media_player = [
{ platform = "kodi"; { platform = "kodi";
host = kodi-host; host = kodi-host;
@ -124,37 +125,10 @@ in {
host = "127.0.0.1"; host = "127.0.0.1";
} }
]; ];
script = lib.fold lib.recursiveUpdate {} [
((import ./script/multi_blink.nix) {inherit lib;})
frosch.script
ten_hours.script
mittagessen.script
# standup.script
];
binary_sensor =
(import ./binary_sensor/buttons.nix)
++ (import ./binary_sensor/motion.nix)
++ frosch.binary_sensor
++ aramark.binary_sensor;
sensor = [] sensor = [{ platform = "version"; }]; # pyhaversion
++ [{ platform = "version"; }] # pyhaversion
++ (import ./sensor/pollen.nix)
++ (import ./sensor/espeasy.nix)
++ (import ./sensor/airquality.nix)
++ ((import ./sensor/outside.nix) {inherit lib;})
++ (import ./sensor/influxdb.nix)
++ (import ./sensor/tasmota_firmware.nix)
++ frosch.sensor
++ aramark.sensor;
camera =
(import ./camera/verkehrskamera.nix)
++ (import ./camera/comic.nix)
++ (import ./camera/stuttgart.nix);
person =
(import ./person/team.nix );
frontend = { }; frontend = { };
http = { http = {
@ -285,16 +259,6 @@ in {
# feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ]; # feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ];
# we don't use imports because the expressions do not merge in # we don't use imports because the expressions do not merge in
# home-assistant # home-assistant
automation = (import ./automation/bureau-shutdown.nix)
++ (import ./automation/nachtlicht.nix)
++ (import ./automation/schlechteluft.nix)
++ (import ./automation/hass-restart.nix)
++ ten_hours.automation
++ matrix.automation
# ++ standup.automation
++ frosch.automation
++ mittagessen.automation;
device_tracker = (import ./device_tracker/openwrt.nix );
}; };
}; };
} }

View File

@ -1,32 +0,0 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, python
, voluptuous
}:
buildPythonPackage rec {
format = "other";
pname = "dwd_pollen";
version = "0.1";
src = fetchFromGitHub {
owner = "marcschumacher";
repo = "dwd_pollen";
rev = version;
sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1";
};
propagatedBuildInputs = [
voluptuous
];
installPhase = ''
install -D -t $out/${python.sitePackages}/homeassistant/components/sensor/dwd_pollen *
'';
meta = with lib; {
description = "Home Assistant component to retrieve Pollen data from DWD (Germany)";
homepage = https://github.com/marcschumacher/dwd_pollen;
license = licenses.mit;
maintainers = [ maintainers.makefu ];
};
}

View File

@ -1,16 +1,19 @@
# requires `opkg install luci-mod-rpc` on router # requires `opkg install luci-mod-rpc` on router
# see https://www.home-assistant.io/components/luci/ # see https://www.home-assistant.io/components/luci/
[ {
{ platform = "luci"; services.home-assistant.config.device_tracker =
host = "192.168.8.1"; [
username = "root"; { platform = "luci";
password = import <secrets/hass/router.nix>; host = "192.168.8.1";
interval_seconds = 30; # instead of 12seconds username = "root";
consider_home = 300; # 5 minutes timeout password = import <secrets/hass/router.nix>;
new_device_defaults = { interval_seconds = 30; # instead of 12seconds
track_new_devices = true; consider_home = 300; # 5 minutes timeout
hide_if_away = false; new_device_defaults = {
}; track_new_devices = true;
} hide_if_away = false;
] };
}
];
}

View File

@ -12,6 +12,9 @@
WorkingDirectory = "/var/lib/kalauerbot"; WorkingDirectory = "/var/lib/kalauerbot";
ExecStart = "${pkgs.kalauerbot}/bin/kalauerbot"; ExecStart = "${pkgs.kalauerbot}/bin/kalauerbot";
PrivateTmp = true; PrivateTmp = true;
Restart = "always";
RuntimeMaxSec = "12h";
}; };
}; };
} }

View File

@ -21,8 +21,10 @@ let
optimistic = false; optimistic = false;
qos = 0; qos = 0;
}; };
in in {
[ services.home-assistant.config.light =
# (tasmota_pwm "RedButton LED" "redbutton" 1 1023) #LED PWM1 [
(tasmota_pwm "RedButton Buzzer" "redbutton" 2 512) #buzzer PWM2 # (tasmota_pwm "RedButton LED" "redbutton" 1 1023) #LED PWM1
] (tasmota_pwm "RedButton Buzzer" "redbutton" 2 512) #buzzer PWM2
];
}

View File

@ -48,9 +48,11 @@ let
12 # fire pattern 12 # fire pattern
]; ];
}; };
in in {
[ services.home-assistant.config.light =
(tasmota_rgb "Status Felix" "status1") [
(tasmota_rgb "Status Daniel" "status2") (tasmota_rgb "Status Felix" "status1")
(tasmota_rgb "Buslicht" "buslicht") (tasmota_rgb "Status Daniel" "status2")
] (tasmota_rgb "Buslicht" "buslicht")
];
}

View File

@ -198,11 +198,13 @@ let
]; ];
in in
{ {
timer =lib.fold lib.recursiveUpdate {} services.home-assistant.config = {
(map tmr_10h persons); timer =lib.fold lib.recursiveUpdate {}
automation = (lib.flatten (map automation_10h persons)); (map tmr_10h persons);
script = lib.fold lib.recursiveUpdate {} ( automation = (lib.flatten (map automation_10h persons));
(map announce_user persons) ++ script = lib.fold lib.recursiveUpdate {} (
(map zu_lange_user persons) (map announce_user persons) ++
); (map zu_lange_user persons)
);
};
} }

View File

@ -1,3 +0,0 @@
# Combination Folder
files return a dictionary of different types used in home-assistant instead of
a single thing.

View File

@ -12,13 +12,16 @@ let
((aramark "${menue}/price" "${menue} Preis") // { unit_of_measurement = ""; }) ((aramark "${menue}/price" "${menue} Preis") // { unit_of_measurement = ""; })
]; ];
in in
{ {
sensor = (aramark_menue "Menü 1") services.home-assistant.config =
++ (aramark_menue "Menü 2") {
++ (aramark_menue "Mercato") sensor = (aramark_menue "Menü 1")
++ (aramark_menue "Aktion"); ++ (aramark_menue "Menü 2")
binary_sensor = ++ (aramark_menue "Mercato")
[ ++ (aramark_menue "Aktion");
((aramark "pommes" "Pommes" ) // { payload_on = "True"; payload_off = "False"; }) binary_sensor =
]; [
((aramark "pommes" "Pommes" ) // { payload_on = "True"; payload_off = "False"; })
];
};
} }

View File

@ -1,4 +1,4 @@
{ lib }: {lib, ... }:
let let
random_daily_text = ''{{ [ random_daily_text = ''{{ [
"Es ist so weit, es ist Standup Zeit!", "Es ist so weit, es ist Standup Zeit!",
@ -9,46 +9,49 @@ let
"Morgens, halb elf in Deutschland - das Standupchen" ] | random }}''; "Morgens, halb elf in Deutschland - das Standupchen" ] | random }}'';
in { in {
script = services.home-assistant.config =
{ "random_daily" = { {
alias = "Random Daily Introduction"; script =
{ "random_daily" = {
alias = "Random Daily Introduction";
sequence = [ sequence = [
{ service = "media_player.play_media"; { service = "media_player.play_media";
data = { data = {
entity_id = "media_player.mpd"; entity_id = "media_player.mpd";
media_content_type = "playlist"; media_content_type = "playlist";
media_content_id = "ansage"; media_content_id = "ansage";
}; };
} }
{ delay.seconds = 5; } { delay.seconds = 5; }
{ service = "tts.google_say"; { service = "tts.google_say";
entity_id = "media_player.mpd"; entity_id = "media_player.mpd";
data_template = { data_template = {
message = random_daily_text; message = random_daily_text;
language = "de"; language = "de";
}; };
} }
]; ];
};
};
automation = [
{
alias = "Daily Standup";
trigger = {
platform = "time";
at = "10:35:00";
}; };
action = };
[ automation = [
{ service = "homeassistant.turn_on"; {
entity_id = [ alias = "Daily Standup";
"script.blitz_10s" trigger = {
"script.random_daily" platform = "time";
]; at = "10:35:00";
} };
]; action =
[
{ service = "homeassistant.turn_on";
entity_id = [
"script.blitz_10s"
"script.random_daily"
];
}
];
} }
]; ];
};
} }

View File

@ -1,4 +1,4 @@
{ lib }: {lib, ... }:
# needs: binary_sensor.pommes # needs: binary_sensor.pommes
# notify.matrix_notify # notify.matrix_notify
let let
@ -17,83 +17,87 @@ let
"Der Weltmarktpreis von Pommes ist durch verschiedene Weltkrisen leider so hoch, dass Aramark den Verkaufspreis verdoppeln musste.", "Der Weltmarktpreis von Pommes ist durch verschiedene Weltkrisen leider so hoch, dass Aramark den Verkaufspreis verdoppeln musste.",
"Vorfreude, schönste Freude, Freude bei Aramark. Pommes in die Schale rein, alle Kunden werden glücklich sein.", "Vorfreude, schönste Freude, Freude bei Aramark. Pommes in die Schale rein, alle Kunden werden glücklich sein.",
"In 15 Minuten ist es wieder so weit, es ist Pommes Zeit!"] | random }}''; "In 15 Minuten ist es wieder so weit, es ist Pommes Zeit!"] | random }}'';
in { in
sensor = [ {
{ platform = "mqtt"; services.home-assistant.config =
name = "frosch brightness"; {
device_class = "illuminance"; sensor = [
state_topic = "/bam/frosch/sensor/brightness/state"; { platform = "mqtt";
availability_topic = "/bam/frosch/status"; name = "frosch brightness";
payload_available = "online"; device_class = "illuminance";
payload_not_available = "offline"; state_topic = "/bam/frosch/sensor/brightness/state";
} availability_topic = "/bam/frosch/status";
]; payload_available = "online";
binary_sensor = [ payload_not_available = "offline";
{ platform = "mqtt"; }
name = "frosch auge"; ];
state_topic = "/bam/frosch/binary_sensor/froschauge/state"; binary_sensor = [
availability_topic = "/bam/frosch/status"; { platform = "mqtt";
payload_available = "online"; name = "frosch auge";
payload_not_available = "offline"; state_topic = "/bam/frosch/binary_sensor/froschauge/state";
} availability_topic = "/bam/frosch/status";
]; payload_available = "online";
switch = [ payload_not_available = "offline";
{ platform = "mqtt"; }
name = "frosch blasen"; ];
state_topic = "/bam/frosch/switch/blasen/state"; switch = [
command_topic = "/bam/frosch/switch/blasen/command"; { platform = "mqtt";
availability_topic = "/bam/frosch/status"; name = "frosch blasen";
payload_available = "online"; state_topic = "/bam/frosch/switch/blasen/state";
payload_not_available = "offline"; command_topic = "/bam/frosch/switch/blasen/command";
} availability_topic = "/bam/frosch/status";
]; payload_available = "online";
light = []; payload_not_available = "offline";
automation = [ }
{ alias = "Pommeszeit"; ];
trigger = { light = [];
platform = "time"; automation = [
at = "11:00:00"; { alias = "Pommeszeit";
trigger = {
platform = "time";
at = "11:00:00";
};
condition = {
condition = "state";
entity_id = "binary_sensor.pommes"; # from multi/aramark.nix
state = "on";
};
action = [
{ service = "homeassistant.turn_on";
entity_id = [
"script.pommes_announce"
"script.seifenblasen_30s" # from script/multi_blink.nix
];
}
];
}
];
script = {
pommes_announce = {
alias = "Random Pommes announce";
sequence = [
{
service = "media_player.play_media";
data = {
entity_id = "media_player.mpd";
media_content_type = "playlist";
media_content_id = "ansage";
};
}
{ delay.seconds = 5; }
{
service = "tts.google_say";
entity_id = "media_player.mpd";
data_template = {
message = random_pommes;
language = "de";
};
}
{ service = "notify.matrix_notify";
data_template.message = random_pommes;
}
];
}; };
condition = {
condition = "state";
entity_id = "binary_sensor.pommes"; # from multi/aramark.nix
state = "on";
};
action = [
{ service = "homeassistant.turn_on";
entity_id = [
"script.pommes_announce"
"script.seifenblasen_30s" # from script/multi_blink.nix
];
}
];
}
];
script = {
pommes_announce = {
alias = "Random Pommes announce";
sequence = [
{
service = "media_player.play_media";
data = {
entity_id = "media_player.mpd";
media_content_type = "playlist";
media_content_id = "ansage";
};
}
{ delay.seconds = 5; }
{
service = "tts.google_say";
entity_id = "media_player.mpd";
data_template = {
message = random_pommes;
language = "de";
};
}
{ service = "notify.matrix_notify";
data_template.message = random_pommes;
}
];
}; };
}; };
} }

View File

@ -8,58 +8,62 @@
# name: my_command # name: my_command
let let
mom_room = "!kTQjvTQvfVsvfEtmth:thales.citadel.team"; mom_room = "!kTQjvTQvfVsvfEtmth:thales.citadel.team";
in { in
matrix = {
services.home-assistant.config =
{ {
# secrets: matrix =
# homeserver, username, password {
homeserver = "https://ext01.citadel.team"; # secrets:
rooms = [ # homeserver, username, password
mom_room homeserver = "https://ext01.citadel.team";
rooms = [
mom_room
];
commands = [
{
# alternative: expression for regexp
word = "version";
name = "version";
}
{
word = "luftqualität";
name = "luftqualitaet";
}
]; ];
commands = [ } // (builtins.fromJSON (builtins.readFile
{ <secrets/hass/citadel-bot.json>));
# alternative: expression for regexp automation = [
word = "version"; {
name = "version"; alias = "React to !version";
} trigger = {
{ platform = "event";
word = "luftqualität"; event_type = "matrix_command";
name = "luftqualitaet"; event_data.command = "version";
} };
]; action = {
} // (builtins.fromJSON (builtins.readFile service = "notify.matrix_notify";
<secrets/hass/citadel-bot.json>)); data_template.message = "Running home-assistant {{states.sensor.current_version.state}}";
automation = [ };
{ }
alias = "React to !version"; {
trigger = { alias = "React to !luftqualität";
platform = "event"; trigger = {
event_type = "matrix_command"; platform = "event";
event_data.command = "version"; event_type = "matrix_command";
}; event_data.command = "luftqualitaet";
action = { };
service = "notify.matrix_notify"; action = {
data_template.message = "Running home-assistant {{states.sensor.current_version.state}}"; service = "notify.matrix_notify";
}; data_template.message = ''Temp: {{states.sensor.notizen_temperature.state_with_unit | replace (" ","")}}, Hum:{{states.sensor.notizen_humidity.state_with_unit | replace (" ","")}}, airquality:{{states.sensor.air_quality.state_with_unit}}'';
} };
{ }
alias = "React to !luftqualität";
trigger = {
platform = "event";
event_type = "matrix_command";
event_data.command = "luftqualitaet";
};
action = {
service = "notify.matrix_notify";
data_template.message = ''Temp: {{states.sensor.notizen_temperature.state_with_unit | replace (" ","")}}, Hum:{{states.sensor.notizen_humidity.state_with_unit | replace (" ","")}}, airquality:{{states.sensor.air_quality.state_with_unit}}'';
};
}
]; ];
notify = [{ notify = [{
name = "matrix_notify"; name = "matrix_notify";
platform = "matrix"; platform = "matrix";
default_room = mom_room; default_room = mom_room;
}]; }];
};
} }

View File

@ -38,52 +38,55 @@ let
"Jetzt nur noch kurz die Mail fertig schreiben und schon kann es los gehen.", "Jetzt nur noch kurz die Mail fertig schreiben und schon kann es los gehen.",
"Es ist 13 Uhr und die Mittagspause ist bald vorbei .... Kleiner Scherz, es ist erst 12:30, aber Ihr hättet auch nicht wirklich etwas verpasst.", "Es ist 13 Uhr und die Mittagspause ist bald vorbei .... Kleiner Scherz, es ist erst 12:30, aber Ihr hättet auch nicht wirklich etwas verpasst.",
"Hallo, es ist nun 12 Uhr 30! Dies entspricht der Essenszeit aller Büroinsassen. Bitte begebt euch zur Aramark Essensausgabe um euren menschlichen Bedürfnissen nachzukommen."] | random }}''; "Hallo, es ist nun 12 Uhr 30! Dies entspricht der Essenszeit aller Büroinsassen. Bitte begebt euch zur Aramark Essensausgabe um euren menschlichen Bedürfnissen nachzukommen."] | random }}'';
in { in
automation = [ {
{ alias = "Mittagessen"; services.home-assistant.config = {
trigger = { automation = [
platform = "time"; { alias = "Mittagessen";
at = "12:30:00"; trigger = {
platform = "time";
at = "12:30:00";
};
action = [
{ service = "homeassistant.turn_on";
entity_id = [
"script.mittagessen_announce"
"script.blitz_10s"
"script.mittagessenlicht"
];
}
];
}
];
script = {
mittagessenlicht = (flash_entity {
entity = "switch.bauarbeiterlampe";
alias = "Bauarbeiterlampe Mittagessenlicht";
delay = 1000;
count = 5;
});
mittagessen_announce = {
alias = "Random Mittagessen announce";
sequence = [
{
service = "media_player.play_media";
data = {
entity_id = "media_player.mpd";
media_content_type = "playlist";
media_content_id = "ansage";
};
}
{ delay.seconds = 5; }
{
service = "tts.google_say";
entity_id = "media_player.mpd";
data_template = {
message = random_mittagessen;
language = "de";
};
}
];
}; };
action = [
{ service = "homeassistant.turn_on";
entity_id = [
"script.mittagessen_announce"
"script.blitz_10s"
"script.mittagessenlicht"
];
}
];
}
];
script = {
mittagessenlicht = (flash_entity {
entity = "switch.bauarbeiterlampe";
alias = "Bauarbeiterlampe Mittagessenlicht";
delay = 1000;
count = 5;
});
mittagessen_announce = {
alias = "Random Mittagessen announce";
sequence = [
{
service = "media_player.play_media";
data = {
entity_id = "media_player.mpd";
media_content_type = "playlist";
media_content_id = "ansage";
};
}
{ delay.seconds = 5; }
{
service = "tts.google_say";
entity_id = "media_player.mpd";
data_template = {
message = random_mittagessen;
language = "de";
};
}
];
}; };
}; };
} }

View File

@ -1,72 +1,81 @@
[ {
{ name = "Thorsten"; services.home-assistant.config.person =
id = 1; [
device_trackers = [ { name = "Thorsten";
"device_tracker.thorsten_phone" id = 1;
#"device_tracker.thorsten_arbeitphone" device_trackers = [
]; "device_tracker.thorsten_phone"
} #"device_tracker.thorsten_arbeitphone"
{ name = "Felix"; ];
id = 2; }
device_trackers = [ { name = "Felix";
"device_tracker.felix_phone" id = 2;
"device_tracker.felix_laptop" device_trackers = [
]; "device_tracker.felix_phone"
} "device_tracker.felix_laptop"
{ name = "Ecki"; ];
id = 3; }
device_trackers = [ { name = "Ecki";
"device_tracker.ecki_phone" id = 3;
"device_tracker.ecki_tablet" device_trackers = [
]; "device_tracker.ecki_phone"
} "device_tracker.ecki_tablet"
{ name = "Daniel"; ];
id = 4; }
device_trackers = [ { name = "Daniel";
"device_tracker.daniel_phone" id = 4;
]; device_trackers = [
} "device_tracker.daniel_phone"
{ name = "Thierry"; ];
id = 5; }
device_trackers = [ { name = "Thierry";
"device_tracker.thierry_phone" id = 5;
]; device_trackers = [
} "device_tracker.thierry_phone"
{ name = "Frank"; ];
id = 6; }
device_trackers = [ { name = "Frank";
"device_tracker.frank_phone" id = 6;
]; device_trackers = [
} "device_tracker.frank_phone"
{ name = "Carsten"; ];
id = 7; }
device_trackers = [ #{ name = "Carsten";
"device_tracker.carsten_phone" # id = 7;
]; # device_trackers = [
} # "device_tracker.carsten_phone"
{ name = "Emeka"; # ];
id = 8; #}
device_trackers = [ { name = "Emeka";
"device_tracker.emeka_phone" id = 8;
]; device_trackers = [
} "device_tracker.emeka_phone"
{ name = "Sabine"; ];
id = 9; }
device_trackers = [ { name = "Sabine";
"device_tracker.sabine_phone" id = 9;
]; device_trackers = [
} "device_tracker.sabine_phone"
{ name = "Tobias"; ];
id = 10; }
device_trackers = [ #{ name = "Tobias";
"device_tracker.tobias_phone" # id = 10;
]; # device_trackers = [
} # "device_tracker.tobias_phone"
{ name = "Tancrede"; # ];
id = 11; #}
device_trackers = [ #{ name = "Tancrede";
"device_tracker.tancrede_phone" # id = 11;
"device_tracker.tancrede_laptop" # device_trackers = [
]; # "device_tracker.tancrede_phone"
} # "device_tracker.tancrede_laptop"
] # ];
#}
{ name = "Chris";
id = 12;
device_trackers = [
"device_tracker.chris_phone"
];
}
];
}

View File

@ -19,39 +19,42 @@ let
) count); ) count);
}; };
in { in {
buzz_red_led = (flash_entity { services.home-assistant.config.script =
entity = "light.redbutton_buzzer"; {
alias = "Red Button Buzz"; buzz_red_led = (flash_entity {
count = 4; entity = "light.redbutton_buzzer";
}); alias = "Red Button Buzz";
buzz_red_led_fast = (flash_entity { count = 4;
entity = "light.redbutton_buzzer"; });
delay = 250; buzz_red_led_fast = (flash_entity {
count = 2; entity = "light.redbutton_buzzer";
alias = "Red Button Buzz fast"; delay = 250;
}); count = 2;
blitz_10s = (flash_entity { alias = "Red Button Buzz fast";
entity = "switch.blitzdings"; });
delay = 10000; blitz_10s = (flash_entity {
count = 1; entity = "switch.blitzdings";
alias = "blitz for 10 seconds"; delay = 10000;
}); count = 1;
blasen_10s = (flash_entity { alias = "blitz for 10 seconds";
entity = "switch.frosch_blasen"; });
delay = 10000; blasen_10s = (flash_entity {
count = 1; entity = "switch.frosch_blasen";
alias = "blasen for 10 seconds"; delay = 10000;
}); count = 1;
blasen_30s = (flash_entity { alias = "blasen for 10 seconds";
entity = "switch.frosch_blasen"; });
delay = 30000; blasen_30s = (flash_entity {
count = 1; entity = "switch.frosch_blasen";
alias = "blasen for 30 seconds"; delay = 30000;
}); count = 1;
schlechteluft = (flash_entity { alias = "blasen for 30 seconds";
entity = "switch.bauarbeiterlampe"; });
alias = "Schlechte Luft Lampe 5 secs"; schlechteluft = (flash_entity {
delay = 5000; entity = "switch.bauarbeiterlampe";
count = 1; alias = "Schlechte Luft Lampe 5 secs";
}); delay = 5000;
count = 1;
});
};
} }

View File

@ -1,9 +1,12 @@
[ {
# coming from 2configs/stats/telegraf/ services.home-assistant.config.sensor =
{ platform = "mqtt"; [
name = "Air Quality"; # coming from 2configs/stats/telegraf/
state_topic = "/telegraf/wbob/airquality"; { platform = "mqtt";
value_template = "{{ value_json.fields.value }}"; name = "Air Quality";
unit_of_measurement = "VOC"; state_topic = "/telegraf/wbob/airquality";
} value_template = "{{ value_json.fields.value }}";
] unit_of_measurement = "VOC";
}
];
}

View File

@ -24,8 +24,10 @@ let
payload_available = "Online"; payload_available = "Online";
payload_not_available = "Offline"; payload_not_available = "Offline";
}; };
in in {
(espeasy_dht22 "easy1") ++ services.home-assistant.config.sensor =
(espeasy_dht22 "easy2") ++ [ (espeasy_dht22 "easy1") ++
(espeasy_ds18 "easy3" ) (espeasy_dht22 "easy2") ++ [
] (espeasy_ds18 "easy3" )
];
}

View File

@ -1,18 +0,0 @@
[
#{ platform = "influxdb";
# queries = [
# { name = "mean value of feinstaub P1";
# where = '' "node" = 'esp8266-1355142' '';
# measurement = "feinstaub";
# database = "telegraf";
# field = "P1";
# }
# { name = "mean value of feinstaub P2";
# where = '' "node" = 'esp8266-1355142' '';
# measurement = "feinstaub";
# database = "telegraf";
# field = "P2";
# }
# ];
#}
]

View File

@ -1,25 +1,29 @@
{lib,...}: [ {lib,...}:
{ platform = "darksky"; {
api_key = lib.removeSuffix "\n" services.home-assistant.config.sensor =
(builtins.readFile <secrets/hass/darksky.apikey>); [
language = "de"; { platform = "darksky";
monitored_conditions = [ api_key = lib.removeSuffix "\n"
"summary" "icon" (builtins.readFile <secrets/hass/darksky.apikey>);
"nearest_storm_distance" "precip_probability" language = "de";
"precip_intensity" monitored_conditions = [
"temperature" # "temperature_high" "temperature_low" "summary" "icon"
"apparent_temperature" "nearest_storm_distance" "precip_probability"
"hourly_summary" # next 24 hours text "precip_intensity"
"humidity" "temperature" # "temperature_high" "temperature_low"
"pressure" "apparent_temperature"
"uv_index" "hourly_summary" # next 24 hours text
]; "humidity"
units = "si" ; "pressure"
scan_interval = "00:30:00"; "uv_index"
} ];
{ platform = "luftdaten"; units = "si" ;
name = "Ditzingen"; scan_interval = "00:30:00";
sensorid = "5341"; }
monitored_conditions = [ "P1" "P2" ]; { platform = "luftdaten";
} name = "Ditzingen";
] sensorid = "5341";
monitored_conditions = [ "P1" "P2" ];
}
];
}

View File

@ -9,8 +9,11 @@ let
payload_not_available= "Offline"; payload_not_available= "Offline";
}; };
in in
{
services.home-assistant.config.sensor =
map tasmota_firmware [ map tasmota_firmware [
"plug" "plug2" "plug3" "plug4" "plug5" "plug" "plug2" "plug3" "plug4" "plug5"
"status1" "status2" "buslicht" "status1" "status2" "buslicht"
"rfbridge" "rfbridge"
] ];
}

View File

@ -8,10 +8,12 @@ let
payload_available= "Online"; payload_available= "Online";
payload_not_available= "Offline"; payload_not_available= "Offline";
}; };
in in {
[ services.home-assistant.config.switch =
(bridge "Nachtlicht A" "#414551" "#414554") [
(bridge "Nachtlicht B" "#415151" "#415154") (bridge "Nachtlicht A" "#414551" "#414554")
(bridge "Nachtlicht C" "#415451" "#415454") (bridge "Nachtlicht B" "#415151" "#415154")
(bridge "Nachtlicht D" "#41551F" "#415514") (bridge "Nachtlicht C" "#415451" "#415454")
] (bridge "Nachtlicht D" "#41551F" "#415514")
];
}

View File

@ -13,10 +13,13 @@ let
retain = false; retain = false;
qos = 1; qos = 1;
}; };
in [ in {
(tasmota_plug "Bauarbeiterlampe" "plug") services.home-assistant.config.switch =
(tasmota_plug "Blitzdings" "plug2") [
(tasmota_plug "Fernseher" "plug3") (tasmota_plug "Bauarbeiterlampe" "plug")
(tasmota_plug "Feuer" "plug4") (tasmota_plug "Blitzdings" "plug2")
(tasmota_plug "Blaulicht" "plug5") (tasmota_plug "Fernseher" "plug3")
] (tasmota_plug "Feuer" "plug4")
(tasmota_plug "Blaulicht" "plug5")
];
}

View File

@ -43,9 +43,6 @@ with import <stockholm/lib>;
boot.tmpOnTmpfs = true; boot.tmpOnTmpfs = true;
systemd.tmpfiles.rules = [
"d /tmp 1777 root root - -"
];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
jq jq

View File

@ -14,8 +14,18 @@ with lib;
let let
phpPackage = let
base = pkgs.php74;
in
base.buildEnv {
extensions = { enabled, all }: with all;
enabled ++ [
apcu redis memcached imagick
];
};
# TODO: copy-paste from lass/2/websites/util.nix # TODO: copy-paste from lass/2/websites/util.nix
nextcloud = pkgs.nextcloud18; nextcloud = pkgs.nextcloud20;
serveCloud = domains: serveCloud = domains:
let let
domain = head domains; domain = head domains;
@ -126,6 +136,7 @@ let
services.phpfpm.pools."${domain}" = { services.phpfpm.pools."${domain}" = {
user = "nginx"; user = "nginx";
group = "nginx"; group = "nginx";
phpPackage = phpPackage;
settings = { settings = {
"listen.owner" = "nginx"; "listen.owner" = "nginx";
"pm" = "dynamic"; "pm" = "dynamic";
@ -138,7 +149,7 @@ let
"php_admin_flag[log_errors]" = "on"; "php_admin_flag[log_errors]" = "on";
"catch_workers_output" = true; "catch_workers_output" = true;
}; };
phpEnv."PATH" = lib.makeBinPath [ pkgs.php ]; phpEnv."PATH" = lib.makeBinPath [ phpPackage ];
}; };
services.phpfpm.phpOptions = '' services.phpfpm.phpOptions = ''
opcache.enable=1 opcache.enable=1
@ -149,7 +160,7 @@ let
opcache.save_comments=1 opcache.save_comments=1
opcache.revalidate_freq=1 opcache.revalidate_freq=1
opcache.file_cache = .opcache opcache.file_cache = .opcache
zend_extension=${pkgs.php}/lib/php/extensions/opcache.so zend_extension=${phpPackage}/lib/php/extensions/opcache.so
display_errors = on display_errors = on
display_startup_errors = on display_startup_errors = on
@ -157,14 +168,15 @@ let
error_reporting = E_ALL | E_STRICT error_reporting = E_ALL | E_STRICT
html_errors = On html_errors = On
date.timezone = "Europe/Berlin" date.timezone = "Europe/Berlin"
# extension=${pkgs.phpPackages.memcached}/lib/php/extensions/memcached.so extension=${phpPackage}/lib/php/extensions/memcached.so
extension=${pkgs.phpPackages.redis}/lib/php/extensions/redis.so extension=${phpPackage}/lib/php/extensions/redis.so
extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so extension=${phpPackage}/lib/php/extensions/apcu.so
''; '';
systemd.services."nextcloud-cron-${domain}" = { systemd.services."nextcloud-cron-${domain}" = {
serviceConfig = { serviceConfig = {
User = "nginx"; User = "nginx";
ExecStart = "${pkgs.php}/bin/php -f ${root}/cron.php"; ExecStart = "${phpPackage}/bin/php -f ${root}/cron.php";
}; };
startAt = "*:0/15"; startAt = "*:0/15";
}; };

View File

@ -3,10 +3,8 @@
{ {
environment.systemPackages = [ environment.systemPackages = [
pkgs.python27Full # required for youcompleteme ((pkgs.vim_configurable.override { python = pkgs.python3; }).customize {
(pkgs.vim_configurable.customize {
name = "vim"; name = "vim";
vimrcConfig.customRC = builtins.readFile ./vimrc; vimrcConfig.customRC = builtins.readFile ./vimrc;
vimrcConfig.vam.knownPlugins = pkgs.vimPlugins; vimrcConfig.vam.knownPlugins = pkgs.vimPlugins;
vimrcConfig.vam.pluginDictionaries = [ vimrcConfig.vam.pluginDictionaries = [

View File

@ -31,8 +31,10 @@ in
awesome.luaModules = [ pkgs.luaPackages.vicious ]; awesome.luaModules = [ pkgs.luaPackages.vicious ];
}; };
displayManager.defaultSession = lib.mkDefault "none+awesome"; displayManager.defaultSession = lib.mkDefault "none+awesome";
displayManager.lightdm = { enable = true; autoLogin.enable = true; autoLogin.user = mainUser; }; displayManager.autoLogin = {
desktopManager.xterm.enable = false; enable = true;
user = mainUser;
};
}; };
environment.systemPackages = [ pkgs.gnome3.defaultIconTheme ]; environment.systemPackages = [ pkgs.gnome3.defaultIconTheme ];
# lid switch is handled via button presses # lid switch is handled via button presses

View File

@ -7,27 +7,31 @@ let
}; };
}; };
sec = seconds: { delay.seconds = seconds; }; sec = seconds: { delay.seconds = seconds; };
in [ in
{ {
alias = "Nightly reboot of firetv"; services.home-assistant.config.automation =
trigger = { [
platform = "time"; {
at = "03:00:00"; alias = "Nightly reboot of firetv";
}; trigger = {
action = [ platform = "time";
(cmd "reboot") at = "03:00:00";
(sec 90) # go to my music because apparently select_source does not seem to always work };
(cmd "HOME") action = [
(sec 2) (cmd "reboot")
(cmd "DOWN") (sec 90) # go to my music because apparently select_source does not seem to always work
(sec 2) (cmd "HOME")
(cmd "DOWN") (sec 2)
(sec 2) (cmd "DOWN")
(cmd "ENTER") (sec 2)
(sec 4) (cmd "DOWN")
(cmd "RIGHT") (sec 2)
(sec 2) (cmd "ENTER")
(cmd "RIGHT") (sec 4)
]; (cmd "RIGHT")
} (sec 2)
] (cmd "RIGHT")
];
}
];
}

View File

@ -2,7 +2,12 @@ let
cred = import <secrets/ham/nextcloud-calendar>; cred = import <secrets/ham/nextcloud-calendar>;
in in
{ {
platform = "caldav"; services.home-assistant.config.calendar =
inherit (cred) username password; [
url = "https://o.euer.krebsco.de/remote.php/dav"; {
platform = "caldav";
inherit (cred) username password;
url = "https://o.euer.krebsco.de/remote.php/dav";
}
];
} }

View File

@ -4,39 +4,33 @@
## wake-on-lan server ## wake-on-lan server
## ##
let let
upkgs = (import <nixpkgs-unstable> {}).pkgs; prefix = (import ./lib).prefix;
hlib = (import ./lib);
prefix = hlib.prefix;
tasmota = hlib.tasmota;
firetv_stick = "192.168.1.24"; firetv_stick = "192.168.1.24";
hassdir = "/var/lib/hass"; hassdir = "/var/lib/hass";
zigbee = import ./multi/zigbee2mqtt.nix;
#flurlicht = import ./multi/flurlicht.nix;
kurzzeitwecker = import ./multi/kurzzeitwecker.nix;
firetv_restart = import ./multi/firetv_restart.nix;
the_playlist = import ./multi/the_playlist.nix;
fliegen-counter = import ./multi/fliegen-couter.nix;
# switch
# automation
# binary_sensor
# sensor
# input_select
# timer
in { in {
imports = [ imports = [
./mqtt.nix ./mqtt.nix
./zigbee2mqtt/default.nix
# hass config
./zigbee2mqtt/hass.nix
# ./multi/flurlicht.nix
./multi/kurzzeitwecker.nix
./multi/the_playlist.nix
./multi/fliegen-couter.nix
./device_tracker/openwrt.nix
./sensor/outside.nix
./calendar/nextcloud.nix
./automation/firetv_restart.nix
./light/groups.nix
]; ];
services.home-assistant = { services.home-assistant = {
package = (upkgs.home-assistant.overrideAttrs (old: {
doCheck = false;
checkPhase = ":";
installCheckPhase = ":";
})).override {
extraPackages = ps: with ps; [
python-forecastio jsonrpc-async jsonrpc-websocket mpd2 pkgs.picotts androidtv
];
};
config = { config = {
influxdb = { influxdb = {
database = "ham"; database = "ham";
@ -48,8 +42,6 @@ in {
}; };
config = {}; config = {};
input_select = zigbee.input_select; # dict
timer = zigbee.timer // kurzzeitwecker.timer; # dict
homeassistant = { homeassistant = {
name = "Home"; time_zone = "Europe/Berlin"; name = "Home"; time_zone = "Europe/Berlin";
latitude = "48.7687"; latitude = "48.7687";
@ -60,12 +52,10 @@ in {
conversation = {}; conversation = {};
history = {}; history = {};
logbook = {}; logbook = {};
counter = fliegen-counter.counter;
logger = { logger = {
default = "info"; default = "info";
}; };
rest_command = {} rest_command = {};
// the_playlist.rest_command;
tts = [ tts = [
{ platform = "google_translate"; { platform = "google_translate";
language = "de"; language = "de";
@ -81,7 +71,7 @@ in {
# "platform": "broadcast", # "platform": "broadcast",
# "api_key": "", # talk to Botfather /newbot # "api_key": "", # talk to Botfather /newbot
# "allowed_chat_ids": [ ID ] # curl -X GET # https://api.telegram.org/bot<YOUR_API_TOKEN>/getUpdates # "allowed_chat_ids": [ ID ] # curl -X GET # https://api.telegram.org/bot<YOUR_API_TOKEN>/getUpdates
#} # }
(builtins.fromJSON (builtins.fromJSON
(builtins.readFile <secrets/hass/telegram-bot.json>)) (builtins.readFile <secrets/hass/telegram-bot.json>))
]; ];
@ -101,7 +91,6 @@ in {
]; ];
sun.elevation = 247; sun.elevation = 247;
recorder = {}; recorder = {};
device_tracker = (import ./device_tracker/openwrt.nix);
media_player = [ media_player = [
{ platform = "FireTV Stick kodi"; { platform = "FireTV Stick kodi";
host = firetv_stick; host = firetv_stick;
@ -149,25 +138,12 @@ in {
monitored_conditions = [ "ping" "download" "upload" ]; monitored_conditions = [ "ping" "download" "upload" ];
} }
# https://www.home-assistant.io/cookbook/automation_for_rainy_days/ # https://www.home-assistant.io/cookbook/automation_for_rainy_days/
] ];
++ ((import ./sensor/outside.nix) {inherit lib;})
++ the_playlist.sensor
++ zigbee.sensor ;
frontend = { }; frontend = { };
calendar = [ (import ./calendar/nextcloud.nix) ];
# light = flurlicht.light;
http = { }; http = { };
switch = []; switch = [];
automation = [] automation = [];
++ (import ./automation/firetv_restart.nix) script = { };
++ kurzzeitwecker.automation
#++ flurlicht.automation
++ the_playlist.automation
++ fliegen-counter.automation
++ zigbee.automation;
script =
{ }
// kurzzeitwecker.script; # dict
}; };
enable = true; enable = true;
configDir = hassdir; configDir = hassdir;

View File

@ -1,10 +1,13 @@
[ {
{ platform = "luci"; services.home-assistant.config.device_tracker =
host = "192.168.1.5"; [
username = "root"; { platform = "luci";
password = import <secrets/hass/router.nix>; host = "192.168.1.5";
interval_seconds = 30; # instead of 12seconds username = "root";
consider_home = 300; # 5 minutes timeout password = import <secrets/hass/router.nix>;
new_device_defaults.track_new_devices = true; interval_seconds = 30; # instead of 12seconds
} consider_home = 300; # 5 minutes timeout
] new_device_defaults.track_new_devices = true;
}
];
}

View File

@ -0,0 +1,41 @@
let
arbeitszimmer_licht = [
"light.led_wand"
"light.arbeitszimmer_led1_led_strip" # LED-Kreis in cube
"light.arbeitszimmer_flur_osram_light"
"light.arbeitszimmer_schrank_dimmer_light"
"light.arbeitszimmer_schrank_osram_light"
];
wohnzimmer_licht = [
"light.wohnzimmer_fernseher_led_strip" # led um fernseher
"light.wohnzimmer_komode_osram_light"
"light.wohnzimmer_schrank_osram_light"
"light.wohnzimmer_stehlampe_osram_light"
];
schlafzimmer_licht = [
"schlafzimmer_komode_osram_light"
];
in {
services.home-assistant.config.light = [
{
platform = "group";
name = "Arbeitszimmer Lichter";
entities = arbeitszimmer_licht;
}
{
platform = "group";
name = "Wohnzimmer Lichter";
entities = wohnzimmer_licht;
}
{
platform = "group";
name = "Schlafzimmer Lichter";
entities = schlafzimmer_licht;
}
{
platform = "group";
name = "Alle Lichter";
entities = arbeitszimmer_licht ++ wohnzimmer_licht ++ schlafzimmer_licht;
}
];
}

View File

@ -15,53 +15,57 @@ let
data.entity_id = "counter.${for}_fliegen"; data.entity_id = "counter.${for}_fliegen";
}) incr; }) incr;
}; };
in { in
counter = { {
felix_fliegen = {}; services.home-assistant.config =
misa_fliegen = {}; {
counter = {
felix_fliegen = {};
misa_fliegen = {};
};
automation = [
(fly_swat "misa" "btn1" "single" 1)
(fly_swat "misa" "btn1" "double" 2)
(fly_swat "misa" "btn1" "triple" 3)
(fly_swat "felix" "btn2" "single" 1)
(fly_swat "felix" "btn2" "double" 2)
(fly_swat "felix" "btn2" "triple" 3)
{
alias = "Send Fly Counter Update";
trigger = [
{
platform = "state";
entity_id = "counter.felix_fliegen";
}
{
platform = "state";
entity_id = "counter.misa_fliegen";
#above = -1;
}
];
action = {
service = "mqtt.publish";
data_template = { # gauge-style
payload = "{{ trigger.to_state.state }}";
topic = "${hlib.prefix}/flycounter/{{ trigger.to_state.object_id }}";
};
};
}
{
alias = "Reset Fly counters on midnight";
trigger = {
platform = "time";
at = "01:00:00";
};
action = [
{ service = "counter.reset";
data.entity_id = "counter.misa_fliegen";
}
{ service = "counter.reset";
data.entity_id = "counter.felix_fliegen";
}
];
}
];
}; };
automation = [
(fly_swat "misa" "btn1" "single" 1)
(fly_swat "misa" "btn1" "double" 2)
(fly_swat "misa" "btn1" "triple" 3)
(fly_swat "felix" "btn2" "single" 1)
(fly_swat "felix" "btn2" "double" 2)
(fly_swat "felix" "btn2" "triple" 3)
{
alias = "Send Fly Counter Update";
trigger = [
{
platform = "state";
entity_id = "counter.felix_fliegen";
}
{
platform = "state";
entity_id = "counter.misa_fliegen";
#above = -1;
}
];
action = {
service = "mqtt.publish";
data_template = { # gauge-style
payload = "{{ trigger.to_state.state }}";
topic = "${hlib.prefix}/flycounter/{{ trigger.to_state.object_id }}";
};
};
}
{
alias = "Reset Fly counters on midnight";
trigger = {
platform = "time";
at = "01:00:00";
};
action = [
{ service = "counter.reset";
data.entity_id = "counter.misa_fliegen";
}
{ service = "counter.reset";
data.entity_id = "counter.felix_fliegen";
}
];
}
];
} }

View File

@ -8,125 +8,128 @@
# notify.telegrambot # notify.telegrambot
let let
button = "sensor.zigbee_btn2_click"; button = "sensor.zigbee_btn2_click";
in { in
timer.kurzzeitwecker = {
{ services.home-assistant.config = {
name = "Zigbee Kurzzeitwecker"; timer.kurzzeitwecker =
duration = 300;
};
script.add_5_minutes_to_kurzzeitwecker =
{ {
alias = "Add 5 minutes to kurzzeitwecker"; name = "Zigbee Kurzzeitwecker";
sequence = [ duration = 300;
{ service = "timer.pause"; };
entity_id = "timer.kurzzeitwecker"; script.add_5_minutes_to_kurzzeitwecker =
} {
{ service = "timer.start"; alias = "Add 5 minutes to kurzzeitwecker";
data_template = { sequence = [
{ service = "timer.pause";
entity_id = "timer.kurzzeitwecker"; entity_id = "timer.kurzzeitwecker";
duration = '' }
{% set r = state_attr('timer.kurzzeitwecker', 'remaining') ~ '-0000' %} { service = "timer.start";
{% set t = strptime(r, '%H:%M:%S.%f%z') %} data_template = {
{{ (as_timestamp(t) + 300) | timestamp_custom('%H:%M:%S', false) }} entity_id = "timer.kurzzeitwecker";
''; duration = ''
{% set r = state_attr('timer.kurzzeitwecker', 'remaining') ~ '-0000' %}
{% set t = strptime(r, '%H:%M:%S.%f%z') %}
{{ (as_timestamp(t) + 300) | timestamp_custom('%H:%M:%S', false) }}
'';
};
}
];
};
automation =
[
{
alias = "Start Timer 5min";
trigger = {
platform = "state";
entity_id = button;
to = "single";
}; };
condition =
{ condition = "state";
entity_id = "timer.kurzzeitwecker";
state = "idle";
};
action = [
{ service = "timer.start";
entity_id = "timer.kurzzeitwecker";
data.duration = "00:05:00";
}
{
service = "notify.telegrambot";
data.message = "Timer gestartet {{state_attr('timer.kurzzeitwecker', 'remaining') }}, verbleibend ";
}
];
}
{
alias = "Add Timer 5min";
trigger = {
platform = "state";
entity_id = button;
to = "single";
};
condition =
{ condition = "state";
entity_id = "timer.kurzzeitwecker";
state = "active";
};
action = [
{ service = "homeassistant.turn_on";
entity_id = "script.add_5_minutes_to_kurzzeitwecker";
}
{
service = "notify.telegrambot";
data.message = ''Timer um 5 minuten verlängert, {{ state_attr('timer.kurzzeitwecker', 'remaining') | truncate(9,True," ") }} verbleibend '';
}
];
}
{
alias = "Stop timer on double click";
trigger = [
{
platform = "state";
entity_id = button;
to = "double";
}
{
platform = "state";
entity_id = button;
to = "triple";
}
];
condition =
{
condition = "state";
entity_id = "timer.kurzzeitwecker";
state = "active";
};
action = [
{
service = "timer.cancel";
entity_id = "timer.kurzzeitwecker";
}
{
service = "notify.telegrambot";
data.message = "Timer gestoppt, abgebrochen";
}
];
}
{
alias = "Timer Finished";
trigger = {
platform = "event";
event_type = "timer.finished";
event_data.entity_id = "timer.kurzzeitwecker";
};
action = [
{
service = "notify.telegrambot";
data.message = "Timer beendet";
}
];
} }
]; ];
}; };
automation =
[
{
alias = "Start Timer 5min";
trigger = {
platform = "state";
entity_id = button;
to = "single";
};
condition =
{ condition = "state";
entity_id = "timer.kurzzeitwecker";
state = "idle";
};
action = [
{ service = "timer.start";
entity_id = "timer.kurzzeitwecker";
data.duration = "00:05:00";
}
{
service = "notify.telegrambot";
data.message = "Timer gestartet {{state_attr('timer.kurzzeitwecker', 'remaining') }}, verbleibend ";
}
];
}
{
alias = "Add Timer 5min";
trigger = {
platform = "state";
entity_id = button;
to = "single";
};
condition =
{ condition = "state";
entity_id = "timer.kurzzeitwecker";
state = "active";
};
action = [
{ service = "homeassistant.turn_on";
entity_id = "script.add_5_minutes_to_kurzzeitwecker";
}
{
service = "notify.telegrambot";
data.message = ''Timer um 5 minuten verlängert, {{ state_attr('timer.kurzzeitwecker', 'remaining') | truncate(9,True," ") }} verbleibend '';
}
];
}
{
alias = "Stop timer on double click";
trigger = [
{
platform = "state";
entity_id = button;
to = "double";
}
{
platform = "state";
entity_id = button;
to = "triple";
}
];
condition =
{
condition = "state";
entity_id = "timer.kurzzeitwecker";
state = "active";
};
action = [
{
service = "timer.cancel";
entity_id = "timer.kurzzeitwecker";
}
{
service = "notify.telegrambot";
data.message = "Timer gestoppt, abgebrochen";
}
];
}
{
alias = "Timer Finished";
trigger = {
platform = "event";
event_type = "timer.finished";
event_data.entity_id = "timer.kurzzeitwecker";
};
action = [
{
service = "notify.telegrambot";
data.message = "Timer beendet";
}
];
}
];
} }

View File

@ -7,77 +7,80 @@
# automation # automation
# sensor # sensor
{ {
rest_command = { services.home-assistant.config =
good_song = { {
url = "http://prism.r:8001/good"; rest_command = {
method = "POST"; good_song = {
}; url = "http://prism.r:8001/good";
bad_song = { method = "POST";
url = "http://prism.r:8001/skip"; };
method = "POST"; bad_song = {
url = "http://prism.r:8001/skip";
method = "POST";
};
}; };
automation = [
{
alias = "playlist song publish";
trigger = {
#platform = "event";
#event_data.entity_id = "sensor.the_playlist_song";
platform = "state";
entity_id = "sensor.the_playlist_song";
};
action = {
service = "mqtt.publish";
data = {
topic = "/ham/the_playlist/song";
payload_template = "{{ states.sensor.the_playlist_song.state }}";
};
};
}
{
alias = "playlist upvote on button";
trigger = {
platform = "state";
entity_id = "binary_sensor.playlist_button_good";
from = "off";
to = "on";
};
action.service = "rest_command.good_song";
}
{
alias = "playlist downvote on button";
trigger = {
platform = "state";
entity_id = "binary_sensor.playlist_button_bad";
from = "off";
to = "on";
};
action.service = "rest_command.bad_song";
}
];
sensor = [
{ platform = "rest";
name = "pl";
resource = "http://prism.r:8001/current";
scan_interval = 30;
value_template = "1";
json_attributes = [ "name" "filename" "youtube" ];
}
{ platform = "template";
sensors = {
the_playlist_song = {
friendly_name = "Current Song";
value_template = ''{{ states.sensor.pl.attributes['name'] }}'';
};
the_playlist_url = {
friendly_name = "Song Youtube URL";
value_template = ''{{ states.sensor.pl.attributes['youtube'] }}'';
};
the_playlist_filename = {
friendly_name = "Song Filename";
value_template = ''{{ states.sensor.pl.attributes['filename'] }}'';
};
};
}
];
}; };
automation = [
{
alias = "playlist song publish";
trigger = {
#platform = "event";
#event_data.entity_id = "sensor.the_playlist_song";
platform = "state";
entity_id = "sensor.the_playlist_song";
};
action = {
service = "mqtt.publish";
data = {
topic = "/ham/the_playlist/song";
payload_template = "{{ states.sensor.the_playlist_song.state }}";
};
};
}
{
alias = "playlist upvote on button";
trigger = {
platform = "state";
entity_id = "binary_sensor.playlist_button_good";
from = "off";
to = "on";
};
action.service = "rest_command.good_song";
}
{
alias = "playlist downvote on button";
trigger = {
platform = "state";
entity_id = "binary_sensor.playlist_button_bad";
from = "off";
to = "on";
};
action.service = "rest_command.bad_song";
}
];
sensor = [
{ platform = "rest";
name = "pl";
resource = "http://prism.r:8001/current";
scan_interval = 30;
value_template = "1";
json_attributes = [ "name" "filename" "youtube" ];
}
{ platform = "template";
sensors = {
the_playlist_song = {
friendly_name = "Current Song";
value_template = ''{{ states.sensor.pl.attributes['name'] }}'';
};
the_playlist_url = {
friendly_name = "Song Youtube URL";
value_template = ''{{ states.sensor.pl.attributes['youtube'] }}'';
};
the_playlist_filename = {
friendly_name = "Song Filename";
value_template = ''{{ states.sensor.pl.attributes['filename'] }}'';
};
};
}
];
} }

View File

@ -1,127 +0,0 @@
# provides:
# switch
# automation
# binary_sensor
# sensor
# input_select
# timer
let
inherit (import ../lib) zigbee;
prefix = zigbee.prefix;
in {
sensor =
[
# Sensor for monitoring the bridge state
{
platform = "mqtt";
name = "Zigbee2mqtt Bridge state";
state_topic = "${prefix}/bridge/state";
icon = "mdi:router-wireless";
}
# Sensor for Showing the Zigbee2mqtt Version
{
platform = "mqtt";
name = "Zigbee2mqtt Version";
state_topic = "${prefix}/bridge/config";
value_template = "{{ value_json.version }}";
icon = "mdi:zigbee";
}
# Sensor for Showing the Coordinator Version
{
platform = "mqtt";
name = "Coordinator Version";
state_topic = "${prefix}/bridge/config";
value_template = "{{ value_json.coordinator }}";
icon = "mdi:chip";
}
];
switch = [
{
platform = "mqtt";
name = "Zigbee2mqtt Main join";
state_topic = "${prefix}/bridge/config/permit_join";
command_topic = "${prefix}/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 = "${prefix}/bridge/config/log_level";
};
}
];
}
# Automation to start timer when enable join is turned on
{
id = "zigbee_join_enabled";
alias = "Zigbee Join Enabled";
trigger =
{
platform = "state";
entity_id = "switch.zigbee2mqtt_main_join";
to = "on";
};
action =
{
service = "timer.start";
entity_id = "timer.zigbee_permit_join";
};
}
# # Automation to stop timer when switch turned off and turn off switch when timer finished
{
id = "zigbee_join_disabled";
alias = "Zigbee Join Disabled";
trigger = [
{
platform = "event";
event_type = "timer.finished";
event_data.entity_id = "timer.zigbee_permit_join";
}
{
platform = "state";
entity_id = "switch.zigbee2mqtt_main_join";
to = "off";
}
];
action = [
{ service = "timer.cancel";
data.entity_id = "timer.zigbee_permit_join";
}
{ service = "switch.turn_off";
entity_id = "switch.zigbee2mqtt_main_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 =
{
name = "Zigbee Time remaining";
duration = 120;
};
}

View File

@ -1,20 +1,25 @@
{lib,...}: [ {lib,...}:
{ platform = "darksky";
api_key = lib.removeSuffix "\n" {
(builtins.readFile <secrets/hass/darksky.apikey>); services.home-assistant.config.sensor =
language = "de"; [
monitored_conditions = [ { platform = "darksky";
"summary" "icon" api_key = lib.removeSuffix "\n"
"nearest_storm_distance" "precip_probability" (builtins.readFile <secrets/hass/darksky.apikey>);
"precip_intensity" language = "de";
"temperature" # "temperature_high" "temperature_low" monitored_conditions = [
"apparent_temperature" "summary" "icon"
"hourly_summary" # next 24 hours text "nearest_storm_distance" "precip_probability"
"humidity" "precip_intensity"
"pressure" "temperature" # "temperature_high" "temperature_low"
"uv_index" "apparent_temperature"
]; "hourly_summary" # next 24 hours text
units = "si" ; "humidity"
scan_interval = "00:30:00"; "pressure"
} "uv_index"
] ];
units = "si" ;
scan_interval = "00:30:00";
}
];
}

Some files were not shown because too many files have changed in this diff Show More