summaryrefslogtreecommitdiffstats
path: root/makefu
diff options
context:
space:
mode:
authorjeschli <jeschli@gmail.com>2019-03-21 20:09:09 +0100
committerjeschli <jeschli@gmail.com>2019-03-21 20:09:09 +0100
commita045a7f054859efcb40baf8ded13bcb7fd706d01 (patch)
treedf23b0d31db9fc0b0087f4d5d4c7b3dd7a88b44c /makefu
parented499a84a9fe067c80e5a4768482333863c1e9ad (diff)
parent550faa1f64434951cd3949bc96a25012349f0090 (diff)
Merge branch 'master' of prism.r:stockholm into new-master
Diffstat (limited to 'makefu')
-rw-r--r--makefu/0tests/data/secrets/id_nixBuild0
-rw-r--r--makefu/1systems/cake/config.nix13
-rw-r--r--makefu/1systems/crapi/config.nix33
-rw-r--r--makefu/1systems/crapi/hardware-config.nix39
-rw-r--r--makefu/1systems/gum/config.nix1
-rw-r--r--makefu/1systems/gum/hardware-config.nix18
-rw-r--r--makefu/1systems/wbob/config.nix3
-rw-r--r--makefu/1systems/x/config.nix26
-rw-r--r--makefu/2configs/bureautomation/automation/10h_timer.nix147
-rw-r--r--makefu/2configs/bureautomation/automation/bureau-shutdown.nix55
-rw-r--r--makefu/2configs/bureautomation/automation/nachtlicht.nix43
-rw-r--r--makefu/2configs/bureautomation/binary_sensor/buttons.nix17
-rw-r--r--makefu/2configs/bureautomation/binary_sensor/motion.nix12
-rw-r--r--makefu/2configs/bureautomation/camera/verkehrskamera.nix14
-rw-r--r--makefu/2configs/bureautomation/hass.nix315
-rw-r--r--makefu/2configs/bureautomation/led-fader.nix (renamed from makefu/2configs/deployment/led-fader.nix)2
-rw-r--r--makefu/2configs/bureautomation/light/buzzer.nix28
-rw-r--r--makefu/2configs/bureautomation/light/statuslight.nix56
-rw-r--r--makefu/2configs/bureautomation/script/multi_blink.nix37
-rw-r--r--makefu/2configs/bureautomation/sensor/espeasy.nix31
-rw-r--r--makefu/2configs/bureautomation/sensor/influxdb.nix18
-rw-r--r--makefu/2configs/bureautomation/sensor/outside.nix25
-rw-r--r--makefu/2configs/bureautomation/switch/tasmota_switch.nix19
-rw-r--r--makefu/2configs/dict.nix1
-rw-r--r--makefu/2configs/git/cgit-retiolum.nix9
-rw-r--r--makefu/2configs/home-manager/desktop.nix9
-rw-r--r--makefu/2configs/home-manager/zsh.nix3
-rw-r--r--makefu/2configs/homeautomation/default.nix69
-rw-r--r--makefu/2configs/homeautomation/google-muell.nix16
-rw-r--r--makefu/2configs/remote-build/gum.nix15
-rw-r--r--makefu/2configs/remote-build/slave.nix1
-rw-r--r--makefu/2configs/save-diskspace.nix4
-rw-r--r--makefu/2configs/tools/core-gui.nix1
-rw-r--r--makefu/2configs/tools/core.nix2
-rw-r--r--makefu/2configs/tools/dev.nix1
-rw-r--r--makefu/2configs/tools/games.nix2
-rw-r--r--makefu/5pkgs/Fluffy/default.nix42
-rw-r--r--makefu/5pkgs/ampel/default.nix6
-rw-r--r--makefu/5pkgs/awesomecfg/default.nix3
-rw-r--r--makefu/5pkgs/awesomecfg/full.cfg1
-rw-r--r--makefu/5pkgs/init-host/default.nix47
-rw-r--r--makefu/krops.nix1
-rw-r--r--makefu/nixpkgs.json6
43 files changed, 848 insertions, 343 deletions
diff --git a/makefu/0tests/data/secrets/id_nixBuild b/makefu/0tests/data/secrets/id_nixBuild
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/makefu/0tests/data/secrets/id_nixBuild
diff --git a/makefu/1systems/cake/config.nix b/makefu/1systems/cake/config.nix
index e40042b2d..8617578f0 100644
--- a/makefu/1systems/cake/config.nix
+++ b/makefu/1systems/cake/config.nix
@@ -1,9 +1,16 @@
{ config, lib, pkgs, ... }:
-{
+let
+ primaryInterface = "eth0";
+in {
imports = [
<stockholm/makefu>
./hardware-config.nix
- <stockholm/makefu/2configs/tools/core.nix>
+ # <stockholm/makefu/2configs/tools/core.nix>
+ { environment.systemPackages = with pkgs;[ rsync screen curl git ];}
+ <stockholm/makefu/2configs/binary-cache/nixos.nix>
+ #<stockholm/makefu/2configs/support-nixos.nix>
+ <stockholm/makefu/2configs/homeautomation/default.nix>
+ <stockholm/makefu/2configs/homeautomation/google-muell.nix>
# configure your hw:
# <stockholm/makefu/2configs/save-diskspace.nix>
];
@@ -12,7 +19,7 @@
tinc.retiolum.enable = true;
build.host = config.krebs.hosts.cake;
};
-
+ networking.firewall.trustedInterfaces = [ primaryInterface ];
documentation.info.enable = false;
documentation.man.enable = false;
services.nixosManual.enable = false;
diff --git a/makefu/1systems/crapi/config.nix b/makefu/1systems/crapi/config.nix
index d96b872d5..e7c6c3666 100644
--- a/makefu/1systems/crapi/config.nix
+++ b/makefu/1systems/crapi/config.nix
@@ -1,46 +1,15 @@
{ config, pkgs, lib, ... }:
{
- # :l <nixpkgs>
- # builtins.readDir (pkgs.fetchFromGitHub { owner = "nixos"; repo = "nixpkgs-channels"; rev = "6c064e6b"; sha256 = "1rqzh475xn43phagrr30lb0fd292c1s8as53irihsnd5wcksnbyd"; })
imports = [
<stockholm/makefu>
+ ./hardware-config.nix
<stockholm/makefu/2configs>
<stockholm/makefu/2configs/tinc/retiolum.nix>
<stockholm/makefu/2configs/save-diskspace.nix>
];
krebs.build.host = config.krebs.hosts.crapi;
- # NixOS wants to enable GRUB by default
- boot.loader.grub.enable = false;
- # Enables the generation of /boot/extlinux/extlinux.conf
- boot.loader.generic-extlinux-compatible.enable = true;
-
- boot.kernelPackages = pkgs.linuxPackages_rpi;
-
- nix.binaryCaches = [ "http://nixos-arm.dezgeg.me/channel" ];
- nix.binaryCachePublicKeys = [ "nixos-arm.dezgeg.me-1:xBaUKS3n17BZPKeyxL4JfbTqECsT+ysbDJz29kLFRW0=%" ];
-
- fileSystems = {
- "/boot" = {
- device = "/dev/disk/by-label/NIXOS_BOOT";
- fsType = "vfat";
- };
- "/" = {
- device = "/dev/disk/by-label/NIXOS_SD";
- fsType = "ext4";
- };
- };
-
- system.activationScripts.create-swap = ''
- if [ ! -e /swapfile ]; then
- fallocate -l 2G /swapfile
- mkswap /swapfile
- fi
- '';
- swapDevices = [ { device = "/swapfile"; size = 2048; } ];
-
- nix.package = lib.mkForce pkgs.nixStable;
services.openssh.enable = true;
}
diff --git a/makefu/1systems/crapi/hardware-config.nix b/makefu/1systems/crapi/hardware-config.nix
new file mode 100644
index 000000000..bba31dabd
--- /dev/null
+++ b/makefu/1systems/crapi/hardware-config.nix
@@ -0,0 +1,39 @@
+{ pkgs, lib, ... }:
+{
+ #raspi1
+ boot.kernelParams = ["cma=32M" "console=ttyS0,115200n8" "console=tty0" "console=ttyS1,115200n8" ];
+
+ boot.loader.grub.enable = false;
+ boot.loader.raspberryPi.enable = true;
+ boot.loader.raspberryPi.version = 1;
+ boot.loader.raspberryPi.uboot.enable = true;
+ boot.loader.raspberryPi.uboot.configurationLimit = 1;
+ boot.loader.generationsDir.enable = lib.mkDefault false;
+ hardware.enableRedistributableFirmware = true;
+ boot.cleanTmpDir = true;
+ environment.systemPackages = [ pkgs.raspberrypi-tools ];
+ boot.kernelPackages = pkgs.linuxPackages_rpi;
+
+ nix.binaryCaches = [ "http://nixos-arm.dezgeg.me/channel" ];
+ nix.binaryCachePublicKeys = [ "nixos-arm.dezgeg.me-1:xBaUKS3n17BZPKeyxL4JfbTqECsT+ysbDJz29kLFRW0=%" ];
+
+ fileSystems = {
+ "/boot" = {
+ device = "/dev/disk/by-label/NIXOS_BOOT";
+ fsType = "vfat";
+ };
+ "/" = {
+ device = "/dev/disk/by-label/NIXOS_SD";
+ fsType = "ext4";
+ };
+ };
+
+ system.activationScripts.create-swap = ''
+ if [ ! -e /swapfile ]; then
+ fallocate -l 2G /swapfile
+ mkswap /swapfile
+ chmod 600 /swapfile
+ fi
+ '';
+ swapDevices = [ { device = "/swapfile"; size = 4096; } ];
+}
diff --git a/makefu/1systems/gum/config.nix b/makefu/1systems/gum/config.nix
index e274b4bf8..7bc06f833 100644
--- a/makefu/1systems/gum/config.nix
+++ b/makefu/1systems/gum/config.nix
@@ -84,6 +84,7 @@ in {
<stockholm/makefu/2configs/shack/events-publisher>
<stockholm/makefu/2configs/shack/gitlab-runner>
<stockholm/makefu/2configs/remote-build/slave.nix>
+ <stockholm/makefu/2configs/remote-build/aarch64-community.nix>
<stockholm/makefu/2configs/taskd.nix>
# services
diff --git a/makefu/1systems/gum/hardware-config.nix b/makefu/1systems/gum/hardware-config.nix
index 542b79fe7..857fad7aa 100644
--- a/makefu/1systems/gum/hardware-config.nix
+++ b/makefu/1systems/gum/hardware-config.nix
@@ -41,36 +41,36 @@ in {
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.devices = [ main-disk ];
- boot.initrd.kernelModules = [ "dm-raid" ];
+ boot.initrd.kernelModules = [ "dm-raid" "dm_cache" ];
boot.initrd.availableKernelModules = [
"ata_piix" "vmw_pvscsi" "virtio_pci" "sd_mod" "ahci"
"xhci_pci" "ehci_pci" "ahci" "sd_mod"
];
- boot.kernelModules = [ "dm-thin-pool" "kvm-intel" ];
+ boot.kernelModules = [ "dm-raid" "dm_cache" "dm-thin-pool" "kvm-intel" ];
hardware.enableRedistributableFirmware = true;
fileSystems."/" = {
- device = "/dev/mapper/nixos-root";
+ device = "/dev/nixos/root";
fsType = "ext4";
};
fileSystems."/var/lib" = {
- device = "/dev/mapper/nixos-lib";
+ device = "/dev/nixos/lib";
fsType = "ext4";
};
fileSystems."/var/log" = {
- device = "/dev/mapper/nixos-log";
+ device = "/dev/nixos/log";
fsType = "ext4";
};
fileSystems."/var/download" = {
- device = "/dev/mapper/nixos-download";
+ device = "/dev/nixos/download";
fsType = "ext4";
};
fileSystems."/var/www/binaergewitter" = {
- device = "/dev/mapper/nixos-binaergewitter";
+ device = "/dev/nixos/binaergewitter";
fsType = "ext4";
- options = [ "nofail" ];
+ options = [ "nofail" "x-systemd.automount" "x-systemd.device-timeout=5s" "x-systemd.mount-timeout=5s" ];
};
fileSystems."/var/lib/borgbackup" = {
- device = "/dev/mapper/nixos-backup";
+ device = "/dev/nixos/backup";
fsType = "ext4";
};
fileSystems."/boot" = {
diff --git a/makefu/1systems/wbob/config.nix b/makefu/1systems/wbob/config.nix
index 3930406b1..ab77f16dd 100644
--- a/makefu/1systems/wbob/config.nix
+++ b/makefu/1systems/wbob/config.nix
@@ -9,6 +9,7 @@ in {
imports =
[ # Include the results of the hardware scan.
<stockholm/makefu>
+ <stockholm/makefu/2configs/support-nixos.nix>
<stockholm/makefu/2configs/zsh-user.nix>
<stockholm/makefu/2configs/tools/core.nix>
# <stockholm/makefu/2configs/disable_v6.nix>
@@ -39,7 +40,6 @@ in {
<stockholm/makefu/2configs/stats/telegraf/europastats.nix>
<stockholm/makefu/2configs/stats/external/aralast.nix>
<stockholm/makefu/2configs/stats/arafetch.nix>
- <stockholm/makefu/2configs/deployment/led-fader.nix>
<stockholm/makefu/2configs/hw/mceusb.nix>
# <stockholm/makefu/2configs/stats/telegraf/bamstats.nix>
{ environment.systemPackages = [ pkgs.vlc ]; }
@@ -51,6 +51,7 @@ in {
];
}
<stockholm/makefu/2configs/bureautomation>
+ <stockholm/makefu/2configs/bureautomation/led-fader.nix>
<stockholm/makefu/2configs/bureautomation/mpd.nix>
<stockholm/makefu/2configs/bureautomation/hass.nix>
(let
diff --git a/makefu/1systems/x/config.nix b/makefu/1systems/x/config.nix
index 138735d91..de55e9e89 100644
--- a/makefu/1systems/x/config.nix
+++ b/makefu/1systems/x/config.nix
@@ -15,6 +15,13 @@
<stockholm/makefu/2configs/extra-fonts.nix>
<stockholm/makefu/2configs/tools/all.nix>
<stockholm/makefu/2configs/dict.nix>
+ #<stockholm/makefu/3modules/netboot_server.nix>
+ #{
+ # netboot_server = {
+ # network.wan = "wlp3s0";
+ # network.lan = "enp0s25";
+ # };
+ #}
<stockholm/makefu/2configs/backup/state.nix>
# <stockholm/makefu/2configs/dnscrypt/client.nix>
@@ -53,20 +60,22 @@
<stockholm/makefu/2configs/virtualisation/libvirt.nix>
<stockholm/makefu/2configs/virtualisation/docker.nix>
<stockholm/makefu/2configs/virtualisation/virtualbox.nix>
- {
- networking.firewall.allowedTCPPorts = [ 8080 ];
- networking.nat = {
- enable = true;
- externalInterface = "wlp3s0";
- internalInterfaces = [ "vboxnet0" ];
- };
- }
+ #{
+ # networking.firewall.allowedTCPPorts = [ 8080 ];
+ # networking.nat = {
+ # enable = true;
+ # externalInterface = "wlp3s0";
+ # internalInterfaces = [ "vboxnet0" ];
+ # };
+ #}
# Services
<stockholm/makefu/2configs/git/brain-retiolum.nix>
<stockholm/makefu/2configs/tor.nix>
<stockholm/makefu/2configs/vpn/vpngate.nix>
# <stockholm/makefu/2configs/buildbot-standalone.nix>
<stockholm/makefu/2configs/remote-build/aarch64-community.nix>
+ <stockholm/makefu/2configs/remote-build/gum.nix>
+ { nixpkgs.overlays = [ (self: super: super.prefer-remote-fetch self super) ]; }
# Hardware
<stockholm/makefu/2configs/hw/tp-x230.nix>
@@ -162,7 +171,6 @@
"/home/makefu/docs"
"/home/makefu/.password-store"
"/home/makefu/.secrets-pass"
- "/home/makefu/autosync/Database.kdb"
];
services.syncthing.user = lib.mkForce "makefu";
diff --git a/makefu/2configs/bureautomation/automation/10h_timer.nix b/makefu/2configs/bureautomation/automation/10h_timer.nix
new file mode 100644
index 000000000..a311d468c
--- /dev/null
+++ b/makefu/2configs/bureautomation/automation/10h_timer.nix
@@ -0,0 +1,147 @@
+[
+ { alias = "start Felix 10h";
+ trigger = {
+ platform = "state";
+ entity_id = "binary_sensor.redbutton";
+ to = "on";
+ };
+ condition = {
+ condition = "and";
+ conditions = [
+ {
+ condition = "state";
+ entity_id = "timer.felix_10h";
+ state = "idle";
+ }
+ {
+ condition = "time";
+ after = "06:00:00";
+ before = "12:00:00";
+ }
+ ];
+ };
+ action = [
+ { service = "timer.start";
+ entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ] ;
+ }
+ { service = "homeassistant.turn_on";
+ entity_id = [
+ "script.buzz_red_led_fast"
+ "script.blitz_10s"
+ ];
+ }
+ { service = "light.turn_on";
+ data = {
+ effect = "2";
+ entity_id = [ "light.status_felix" ];
+ };
+ }
+ ];
+ }
+
+ { alias = "Disable Felix timer at button press";
+ trigger = {
+ platform = "state";
+ entity_id = "binary_sensor.redbutton";
+ to = "on";
+ };
+ condition = {
+ condition = "and";
+ conditions = [
+ {
+ condition = "state";
+ entity_id = "timer.felix_10h";
+ state = "active";
+ }
+ {
+ condition = "time";
+ after = "12:00:00";
+ before = "22:00:00";
+ }
+ ];
+ };
+ action =
+ [
+ {
+ service = "timer.cancel";
+ entity_id = [ "timer.felix_10h" "timer.felix_8_30h" "timer.felix_7h" ];
+ }
+ {
+ service = "homeassistant.turn_on";
+ entity_id = [ "script.buzz_red_led_fast" ];
+ }
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [ "light.status_felix" ];
+ }
+ ];
+ }
+
+ {
+ alias = "Genug gearbeitet Felix";
+ trigger =
+ {
+ platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.felix_7h";
+ };
+ action =
+ [
+ { service = "light.turn_on";
+ data = {
+ rgb_color= [0 255 0];
+ # effect = "0";
+ entity_id = [ "light.status_felix" ];
+ };
+ }
+ ];
+ }
+
+ {
+ alias = "nun aber nach hause";
+ trigger =
+ {
+ platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.felix_8_30h";
+ };
+ action =
+ [
+ { service = "light.turn_on";
+ data = {
+ rgb_color= [255 255 0];
+ # effect = "0";
+ entity_id = [ "light.status_felix" ];
+ };
+ }
+ ];
+ }
+
+ {
+ alias = "Zu lange Felix!";
+ trigger =
+ {
+ platform = "event";
+ event_type = "timer.finished";
+ event_data.entity_id = "timer.felix_10h";
+ };
+ action =
+ [
+ # TODO: Pushbullet
+ {
+ service = "homeassistant.turn_on";
+ entity_id = [
+ "script.buzz_red_led"
+ "script.blitz_10s"
+ ];
+ }
+ { service = "light.turn_on";
+ data = {
+ rgb_color= [255 0 0];
+ effect = "0";
+ entity_id = [ "light.status_felix" ];
+ };
+ }
+ ];
+ }
+]
diff --git a/makefu/2configs/bureautomation/automation/bureau-shutdown.nix b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
new file mode 100644
index 000000000..9e6574300
--- /dev/null
+++ b/makefu/2configs/bureautomation/automation/bureau-shutdown.nix
@@ -0,0 +1,55 @@
+[
+ { alias = "Turn on Fernseher on movement";
+ trigger = {
+ platform = "state";
+ entity_id = "binary_sensor.motion";
+ to = "on";
+ };
+ action = {
+ service = "homeassistant.turn_on";
+ entity_id = [
+ "switch.fernseher"
+ "switch.feuer"
+ ];
+ };
+ }
+ { alias = "Turn off Fernseher 10 minutes after last movement";
+ trigger = [
+ { # trigger when movement was detected at the time
+ platform = "state";
+ entity_id = "binary_sensor.motion";
+ to = "off";
+ for.minutes = 10;
+ }
+ { # trigger at 20: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"
+ ];
+ };
+ 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" ];
+ }
+ {
+ condition = "state";
+ entity_id = "binary_sensor.motion";
+ state = "off";
+ }
+ ];
+ };
+ }
+]
diff --git a/makefu/2configs/bureautomation/automation/nachtlicht.nix b/makefu/2configs/bureautomation/automation/nachtlicht.nix
new file mode 100644
index 000000000..066e9b06c
--- /dev/null
+++ b/makefu/2configs/bureautomation/automation/nachtlicht.nix
@@ -0,0 +1,43 @@
+[
+ {
+ alias = "Turn off Nachtlicht on sunrise";
+ trigger =
+ {
+ platform = "sun";
+ event = "sunrise";
+ };
+ action =
+ {
+ service = "homeassistant.turn_off";
+ entity_id = [ "switch.nachtlicht" ];
+ };
+ }
+
+ {
+ alias = "Turn on Nachtlicht on motion and dusk";
+ trigger =
+ {
+ platform = "state";
+ entity_id = "binary_sensor.motion";
+ to = "on";
+ };
+ condition = # 'when dark'
+ {
+ condition = "or";
+ conditions = [
+ { condition = "sun";
+ after = "sunset";
+ after_offset = "-00:45:00"; # on dusk
+ }
+ { condition = "sun";
+ before = "sunrise";
+ }
+ ];
+ };
+ action =
+ {
+ service = "homeassistant.turn_on";
+ entity_id = [ "switch.nachtlicht" ];
+ };
+ }
+]
diff --git a/makefu/2configs/bureautomation/binary_sensor/buttons.nix b/makefu/2configs/bureautomation/binary_sensor/buttons.nix
new file mode 100644
index 000000000..e23c4a362
--- /dev/null
+++ b/makefu/2configs/bureautomation/binary_sensor/buttons.nix
@@ -0,0 +1,17 @@
+let
+ tasmota_button = name: topic:
+ # detects a pushbutton press from tasmota
+ { platform = "mqtt";
+ inherit name;
+ state_topic = "/bam/${topic}/cmnd/POWER";
+ availability_topic = "/bam/${topic}/tele/LWT";
+ payload_on = "ON";
+ payload_off = "OFF";
+ payload_available= "Online";
+ payload_not_available= "Offline";
+ # expire_after = "5"; #expire after 5 seconds
+ qos = 1;
+ };
+in [
+ (tasmota_button "RedButton" "redbutton")
+]
diff --git a/makefu/2configs/bureautomation/binary_sensor/motion.nix b/makefu/2configs/bureautomation/binary_sensor/motion.nix
new file mode 100644
index 000000000..ad8fab038
--- /dev/null
+++ b/makefu/2configs/bureautomation/binary_sensor/motion.nix
@@ -0,0 +1,12 @@
+[
+ { platform = "mqtt";
+ device_class = "motion";
+ name = "Motion";
+ state_topic = "/bam/easy2/movement/Switch";
+ payload_on = "1";
+ payload_off = "0";
+ availability_topic = "/bam/easy2/tele/LWT";
+ payload_available = "Online";
+ payload_not_available = "Offline";
+ }
+]
diff --git a/makefu/2configs/bureautomation/camera/verkehrskamera.nix b/makefu/2configs/bureautomation/camera/verkehrskamera.nix
new file mode 100644
index 000000000..f2dfdcd91
--- /dev/null
+++ b/makefu/2configs/bureautomation/camera/verkehrskamera.nix
@@ -0,0 +1,14 @@
+[
+ { name = "Baumarkt";
+ platform = "generic";
+ still_image_url = http://t4915209254324-p80-c0-h6jv2afnujcoftrcstsafb45kdrqv4buy.webdirect.mdex.de/oneshotimage ;# baumarkt
+ }
+ { name = "Autobahn Heilbronn";
+ platform = "generic";
+ still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K10 ;
+ }
+ { name = "Autobahn Singen";
+ platform = "generic";
+ still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K11 ;
+ }
+]
diff --git a/makefu/2configs/bureautomation/hass.nix b/makefu/2configs/bureautomation/hass.nix
index b70c9b030..007d00b09 100644
--- a/makefu/2configs/bureautomation/hass.nix
+++ b/makefu/2configs/bureautomation/hass.nix
@@ -1,76 +1,5 @@
{ pkgs, lib, ... }:
let
- tasmota_rgb = name: topic:
-# LED WS2812b
-# effect_state_topic: "stat/led/Scheme"
-# effect_command_topic: "cmnd/led/Scheme"
-# effect_value_template: "{{ value_json.Scheme }}"
- { platform = "mqtt";
- inherit name;
- retain = false;
- qos = 1;
- optimistic = false;
- # state
- # TODO: currently broken, will not use the custom state topic
- state_topic = "/bam/${topic}/stat/POWER";
- command_topic = "/bam/${topic}/cmnd/POWER";
- availability_topic = "/bam/${topic}/tele/LWT";
- payload_on= "ON";
- payload_off= "OFF";
- payload_available= "Online";
- payload_not_available= "Offline";
- # brightness
- brightness_state_topic = "/bam/${topic}/stat/Dimmer";
- brightness_command_topic = "/bam/${topic}/cmnd/Dimmer";
- brightness_value_template = "{{ value_json.Dimmer }}";
- brightness_scale = 100;
- # color
- rgb_state_topic = "/bam/${topic}/stat/Color";
- rgb_command_topic = "/bam/${topic}/cmnd/Color2";
- rgb_command_mode = "hex";
- rgb_command_template = "{{ '%02x%02x%02x' | format(red, green, blue)}}";
- # effects
- effect_state_topic = "/bam/${topic}/stat/Scheme";
- effect_command_topic = "/bam/${topic}/cmnd/Scheme";
- effect_value_template = "{{ value_json.Scheme }}";
- effect_list = [ 0 1 2 3 4 5 6 7 8 9 10 11 12 ];
-};
- tasmota_plug = name: topic:
- { platform = "mqtt";
- inherit name;
- state_topic = "/bam/${topic}/stat/POWER";
- command_topic = "/bam/${topic}/cmnd/POWER";
- availability_topic = "/bam/${topic}/tele/LWT";
- payload_on= "ON";
- payload_off= "OFF";
- payload_available= "Online";
- payload_not_available= "Offline";
- };
- espeasy_dht22 = name: [
- { platform = "mqtt";
- name = "${name} DHT22 Temperature";
- device_class = "temperature";
- state_topic = "/bam/${name}/dht22/Temperature";
- availability_topic = "/bam/${name}/tele/LWT";
- payload_available = "Online";
- payload_not_available = "Offline";
- }
- { platform = "mqtt";
- device_class = "humidity";
- name = "${name} DHT22 Humidity";
- state_topic = "/bam/${name}/dht22/Humidity";
- availability_topic = "/bam/${name}/tele/LWT";
- payload_available = "Online";
- payload_not_available = "Offline";
- }];
- espeasy_ds18 = name:
- { platform = "mqtt";
- name = "${name} DS18 Temperature";
- state_topic = "/bam/${name}/ds18/Temperature";
- availability_topic = "/bam/${name}/tele/LWT";
- payload_available = "Online";
- payload_not_available = "Offline";
- };
in {
networking.firewall.allowedTCPPorts = [ 8123 ];
@@ -104,90 +33,43 @@ in {
retain = true;
};
};
- switch = [
- (tasmota_plug "Bauarbeiterlampe" "plug")
- (tasmota_plug "Blitzdings" "plug2")
- (tasmota_plug "Fernseher" "plug3")
- (tasmota_plug "Feuer" "plug4")
- (tasmota_plug "Nachtlicht" "plug5")
- ];
- light = [
- (tasmota_rgb "Status Felix" "status1")
- ];
- binary_sensor = [
- { platform = "mqtt";
- device_class = "motion";
- name = "Motion";
- state_topic = "/bam/easy2/movement/Switch";
- payload_on = "1";
- payload_off = "0";
- availability_topic = "/bam/easy2/tele/LWT";
- payload_available = "Online";
- payload_not_available = "Offline";
+ switch = (import ./switch/tasmota_switch.nix);
+ light = (import ./light/statuslight.nix) ++
+ (import ./light/buzzer.nix);
+ timer = {
+ felix_10h = {
+ name = "Felix 10h Timer";
+ duration = "10:00:00";
+ };
+ felix_8_30h = {
+ name = "Felix 8_30h Timer";
+ duration = "08:30:00";
+ };
+ felix_7h = {
+ name = "Felix 7h Timer";
+ duration = "07:00:00";
+ };
+ };
+ notify = [
+ {
+ platform = "kodi";
+ name = "wbob";
+ host = "192.168.8.11";
}
];
+ script = (import ./script/multi_blink.nix) {inherit lib;};
+ binary_sensor =
+ (import ./binary_sensor/buttons.nix) ++
+ (import ./binary_sensor/motion.nix);
+
sensor =
- (espeasy_dht22 "easy1") ++
- (espeasy_dht22 "easy2") ++
- [ (espeasy_ds18 "easy3" )
- { platform = "luftdaten";
- name = "Ditzingen";
- sensorid = "5341";
- monitored_conditions = [ "P1" "P2" ];
- }
+ (import ./sensor/espeasy.nix) ++
+ ((import ./sensor/outside.nix) {inherit lib;}) ++
+ (import ./sensor/influxdb.nix);
+
+ camera =
+ (import ./camera/verkehrskamera.nix);
- { platform = "darksky";
- api_key = lib.removeSuffix "\n"
- (builtins.readFile <secrets/hass/darksky.apikey>);
- language = "de";
- monitored_conditions = [ "summary" "icon"
- "nearest_storm_distance" "precip_probability"
- "precip_intensity"
- "temperature" # "temperature_high" "temperature_low"
- "apparent_temperature"
- "hourly_summary" # next 24 hours text
- "humidity"
- "pressure"
- "uv_index" ];
- units = "si" ;
- update_interval = {
- days = 0;
- hours = 0;
- minutes = 30;
- seconds = 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";
- # }
- # ];
- #}
- ];
- camera = [
- { name = "Baumarkt";
- platform = "generic";
- still_image_url = http://t4915209254324-p80-c0-h6jv2afnujcoftrcstsafb45kdrqv4buy.webdirect.mdex.de/oneshotimage ;# baumarkt
- }
- { name = "Autobahn Heilbronn";
- platform = "generic";
- still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K10 ;
- }
- { name = "Autobahn Singen";
- platform = "generic";
- still_image_url = https://api.svz-bw.de/v2/verkehrskameras/kameras/K11 ;
- }
- ];
frontend = { };
http = { };
conversation = {};
@@ -203,13 +85,14 @@ in {
"group.outside"
"group.switches"
"group.automation"
- "group.camera"
+ # "group.camera"
];
};
automation = [
- "automation.turn_off_fernseher_10_minutes_after_last_movement"
- "automation.turn_off_nachtlicht_on_sunrise"
- "automation.turn_on_nachtlicht_on_motion_and_dusk"
+ "timer.felix_10h"
+ "script.blitz_10s"
+ "script.buzz_red_led_fast"
+ "camera.Baumarkt"
];
switches = [
"switch.bauarbeiterlampe"
@@ -218,125 +101,37 @@ in {
"switch.feuer"
"switch.nachtlicht"
"light.status_felix"
+ "light.status_daniel"
+ "light.buslicht"
+ "light.redbutton_buzzer"
];
- camera = [
- "camera.Baumarkt"
- "camera.Autobahn_Heilbronn"
- "camera.Autobahn_Singen"
- ];
+
+ camera = [ ];
sensors = [
"binary_sensor.motion"
+ "binary_sensor.redbutton"
"sensor.easy2_dht22_humidity"
"sensor.easy2_dht22_temperature"
];
outside = [
- "sensor.ditzingen_pm10"
- "sensor.ditzingen_pm25"
+ # "sensor.ditzingen_pm10"
+ # "sensor.ditzingen_pm25"
"sensor.dark_sky_temperature"
"sensor.dark_sky_humidity"
- "sensor.dark_sky_pressure"
+ # "sensor.dark_sky_pressure"
"sensor.dark_sky_hourly_summary"
- "sensor.dark_sky_minutely_summary"
+ "camera.Autobahn_Heilbronn"
+ "camera.Autobahn_Singen"
];
};
# only for automation
# feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ];
- automation = [
- { alias = "Turn on Fernseher on movement";
- trigger = {
- platform = "state";
- entity_id = "binary_sensor.motion";
- to = "on";
- };
- action = {
- service = "homeassistant.turn_on";
- entity_id = [
- "switch.fernseher"
- "switch.feuer"
- "light.status_felix"
- ];
- };
- }
- {
- alias = "Turn off Nachtlicht on sunrise";
- trigger =
- {
- platform = "sun";
- event = "sunrise";
- };
- action =
- {
- service = "homeassistant.turn_off";
- entity_id = [ "switch.nachtlicht" ];
- };
- }
- {
- alias = "Turn on Nachtlicht on motion and dusk";
- trigger =
- {
- platform = "state";
- entity_id = "binary_sensor.motion";
- to = "on";
- };
- condition = # 'when dark'
- {
- condition = "or";
- conditions = [
- { condition = "sun";
- after = "sunset";
- after_offset = "-00:45:00"; # on dusk
- }
- { condition = "sun";
- before = "sunrise";
- }
- ];
- };
- action =
- {
- service = "homeassistant.turn_on";
- entity_id = [ "switch.nachtlicht" ];
- };
- }
- { alias = "Turn off Fernseher 10 minutes after last movement";
- trigger = [
- { # trigger when movement was detected at the time
- platform = "state";
- entity_id = "binary_sensor.motion";
- to = "off";
- for.minutes = 10;
- }
- { # trigger at 20: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"
- ];
- };
- 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" ];
- }
- {
- condition = "state";
- entity_id = "binary_sensor.motion";
- state = "off";
- }
- ];
- };
- }
- ];
+ # we don't use imports because the expressions do not merge in
+ # home-assistant
+ automation = (import ./automation/bureau-shutdown.nix) ++
+ (import ./automation/nachtlicht.nix) ++
+ (import ./automation/10h_timer.nix);
+
};
};
}
diff --git a/makefu/2configs/deployment/led-fader.nix b/makefu/2configs/bureautomation/led-fader.nix
index d34b66125..d7f728534 100644
--- a/makefu/2configs/deployment/led-fader.nix
+++ b/makefu/2configs/bureautomation/led-fader.nix
@@ -14,7 +14,7 @@ in {
serviceConfig = {
# User = "nobody"; # need a user with permissions to run nix-shell
ExecStartPre = pkgs.writeDash "sleep.sh" "sleep 2";
- ExecStart = "${pkg}/bin/ampel 4";
+ ExecStart = "${pkg}/bin/ampel";
Restart = "always";
RestartSec = 10;
PrivateTmp = true;
diff --git a/makefu/2configs/bureautomation/light/buzzer.nix b/makefu/2configs/bureautomation/light/buzzer.nix
new file mode 100644
index 000000000..2067e47bf
--- /dev/null
+++ b/makefu/2configs/bureautomation/light/buzzer.nix
@@ -0,0 +1,28 @@
+let
+ tasmota_pwm = name: topic: pwmid: max:
+ let
+ id = "PWM${toString pwmid}";
+ in { platform = "mqtt";
+ inherit name;
+ state_topic = "/bam/${topic}/stat/RESULT";
+ state_value_template = ''{%- if value_json["PWM"]["${id}"]| int > 0 -%} ${toString max} {%- else -%} 0 {%- endif -%}'';
+
+ command_topic = "/bam/${topic}/cmnd/${id}";
+ on_command_type = "brightness";
+ brightness_command_topic = "/bam/${topic}/cmnd/${id}";
+ brightness_value_template = ''{{value_json["PWM"]["${id}"]}}'';
+ brightness_scale = max;
+ payload_on = "${toString max}";
+ payload_off = "0";
+ availability_topic = "/bam/${topic}/tele/LWT";
+ payload_available= "Online";
+ payload_not_available= "Offline";
+ retain = true;
+ optimistic = false;
+ qos = 0;
+ };
+in
+[
+# (tasmota_pwm "RedButton LED" "redbutton" 1 1023) #LED PWM1
+ (tasmota_pwm "RedButton Buzzer" "redbutton" 2 512) #buzzer PWM2
+]
diff --git a/makefu/2configs/bureautomation/light/statuslight.nix b/makefu/2configs/bureautomation/light/statuslight.nix
new file mode 100644
index 000000000..3a9582f2f
--- /dev/null
+++ b/makefu/2configs/bureautomation/light/statuslight.nix
@@ -0,0 +1,56 @@
+let
+ tasmota_rgb = name: topic:
+# LED WS2812b
+# effect_state_topic: "stat/led/Scheme"
+# effect_command_topic: "cmnd/led/Scheme"
+# effect_value_template: "{{ value_json.Scheme }}"
+ { platform = "mqtt";
+ inherit name;
+ retain = false;
+ qos = 1;
+ optimistic = false;
+ # state
+ # TODO: currently broken, will not use the custom state topic
+ state_topic = "/bam/${topic}/stat/POWER";
+ command_topic = "/bam/${topic}/cmnd/POWER";
+ availability_topic = "/bam/${topic}/tele/LWT";
+ payload_on= "ON";
+ payload_off= "OFF";
+ payload_available= "Online";
+ payload_not_available= "Offline";
+ # brightness
+ brightness_state_topic = "/bam/${topic}/stat/Dimmer";
+ brightness_command_topic = "/bam/${topic}/cmnd/Dimmer";
+ brightness_value_template = "{{ value_json.Dimmer }}";
+ brightness_scale = 100;
+ # color
+ rgb_state_topic = "/bam/${topic}/stat/Color";
+ rgb_command_topic = "/bam/${topic}/cmnd/Color2";
+ rgb_command_mode = "hex";
+ rgb_command_template = "{{ '%02x%02x%02x' | format(red, green, blue)}}";
+ # effects
+ effect_state_topic = "/bam/${topic}/stat/Scheme";
+ effect_command_topic = "/bam/${topic}/cmnd/Scheme";
+ effect_value_template = "{{ value_json.Scheme }}";
+ effect_list = [
+ 0 # single color for LED light
+ 1 # start wake up sequence (same as Wakeup)
+ 2 # cycle up through colors using Speed option
+ 3 # cycle down through colors using Speed option
+ 4 # random cycle through colors using Speed and Fade
+ 5 # clock mode (example)
+ 6 # candlelight pattern
+ 7 # RGB pattern
+ 8 # Christmas pattern
+ 9 # Hannukah pattern
+ 10 # Kwanzaa pattern
+ 11 # rainbow pattern
+ 12 # fire pattern
+ ];
+ };
+in
+[
+ (tasmota_rgb "Status Felix" "status1")
+ (tasmota_rgb "Status Daniel" "status2")
+ (tasmota_rgb "Buslicht" "buslicht")
+]
diff --git a/makefu/2configs/bureautomation/script/multi_blink.nix b/makefu/2configs/bureautomation/script/multi_blink.nix
new file mode 100644
index 000000000..bb28dd46f
--- /dev/null
+++ b/makefu/2configs/bureautomation/script/multi_blink.nix
@@ -0,0 +1,37 @@
+{lib, ... }:
+let
+ # let an entity blink for X times with a delay of Y milliseconds
+ flash_entity = { entity, delay ? 500, count ? 4, alias ? "${entity}_blink_${toString count}_${toString delay}" }:
+ {
+ inherit alias;
+ sequence = lib.flatten (builtins.genList (i: [
+ { service = "homeassistant.turn_on";
+ data.entity_id = entity;
+ }
+ { delay.milliseconds = delay; }
+ { service = "homeassistant.turn_off";
+ data.entity_id = entity;
+ }
+ { delay.milliseconds = delay; }
+ ]
+ ) count);
+ };
+in {
+ buzz_red_led = (flash_entity {
+ entity = "light.redbutton_buzzer";
+ alias = "Red Button Buzz";
+ count = 4;
+ });
+ buzz_red_led_fast = (flash_entity {
+ entity = "light.redbutton_buzzer";
+ delay = 250;
+ count = 2;
+ alias = "Red Button Buzz fast";
+ });
+ blitz_10s = (flash_entity {
+ entity = "switch.blitzdings";
+ delay = 10000;
+ count = 1;
+ alias = "blitz for 10 seconds";
+ });
+}
diff --git a/makefu/2configs/bureautomation/sensor/espeasy.nix b/makefu/2configs/bureautomation/sensor/espeasy.nix
new file mode 100644
index 000000000..4b78ee84e
--- /dev/null
+++ b/makefu/2configs/bureautomation/sensor/espeasy.nix
@@ -0,0 +1,31 @@
+let
+ espeasy_dht22 = name: [
+ { platform = "mqtt";
+ name = "${name} DHT22 Temperature";
+ device_class = "temperature";
+ state_topic = "/bam/${name}/dht22/Temperature";
+ availability_topic = "/bam/${name}/tele/LWT";
+ payload_available = "Online";
+ payload_not_available = "Offline";
+ }
+ { platform = "mqtt";
+ device_class = "humidity";
+ name = "${name} DHT22 Humidity";
+ state_topic = "/bam/${name}/dht22/Humidity";
+ availability_topic = "/bam/${name}/tele/LWT";
+ payload_available = "Online";
+ payload_not_available = "Offline";
+ }];
+ espeasy_ds18 = name:
+ { platform = "mqtt";
+ name = "${name} DS18 Temperature";
+ state_topic = "/bam/${name}/ds18/Temperature";
+ availability_topic = "/bam/${name}/tele/LWT";
+ payload_available = "Online";
+ payload_not_available = "Offline";
+ };
+in
+(espeasy_dht22 "easy1") ++
+(espeasy_dht22 "easy2") ++ [
+ (espeasy_ds18 "easy3" )
+]
diff --git a/makefu/2configs/bureautomation/sensor/influxdb.nix b/makefu/2configs/bureautomation/sensor/influxdb.nix
new file mode 100644
index 000000000..820a56c4d
--- /dev/null
+++ b/makefu/2configs/bureautomation/sensor/influxdb.nix
@@ -0,0 +1,18 @@
+[
+ #{ 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";
+ # }
+ # ];
+ #}
+]
diff --git a/makefu/2configs/bureautomation/sensor/outside.nix b/makefu/2configs/bureautomation/sensor/outside.nix
new file mode 100644
index 000000000..7dbc192a4
--- /dev/null
+++ b/makefu/2configs/bureautomation/sensor/outside.nix
@@ -0,0 +1,25 @@
+{lib,...}: [
+ { platform = "darksky";
+ api_key = lib.removeSuffix "\n"
+ (builtins.readFile <secrets/hass/darksky.apikey>);
+ language = "de";
+ monitored_conditions = [
+ "summary" "icon"
+ "nearest_storm_distance" "precip_probability"
+ "precip_intensity"
+ "temperature" # "temperature_high" "temperature_low"
+ "apparent_temperature"
+ "hourly_summary" # next 24 hours text
+ "humidity"
+ "pressure"
+ "uv_index"
+ ];
+ units = "si" ;
+ update_interval = { days = 0; hours = 0; minutes = 30; seconds = 0; };
+ }
+ { platform = "luftdaten";
+ name = "Ditzingen";
+ sensorid = "5341";
+ monitored_conditions = [ "P1" "P2" ];
+ }
+ ]
diff --git a/makefu/2configs/bureautomation/switch/tasmota_switch.nix b/makefu/2configs/bureautomation/switch/tasmota_switch.nix
new file mode 100644
index 000000000..b00a8e454
--- /dev/null
+++ b/makefu/2configs/bureautomation/switch/tasmota_switch.nix
@@ -0,0 +1,19 @@
+let
+ tasmota_plug = name: topic:
+ { platform = "mqtt";
+ inherit name;
+ state_topic = "/bam/${topic}/stat/POWER";
+ command_topic = "/bam/${topic}/cmnd/POWER";
+ availability_topic = "/bam/${topic}/tele/LWT";
+ payload_on= "ON";
+ payload_off= "OFF";
+ payload_available= "Online";
+ payload_not_available= "Offline";
+ };
+in [
+ (tasmota_plug "Bauarbeiterlampe" "plug")
+ (tasmota_plug "Blitzdings" "plug2")
+ (tasmota_plug "Fernseher" "plug3")
+ (tasmota_plug "Feuer" "plug4")
+ (tasmota_plug "Nachtlicht" "plug5")
+]
diff --git a/makefu/2configs/dict.nix b/makefu/2configs/dict.nix
index 6db9102ba..08f1f8502 100644
--- a/makefu/2configs/dict.nix
+++ b/makefu/2configs/dict.nix
@@ -1,5 +1,6 @@
{ pkgs, ... }:
{
+ environment.shellAliases.dict = "dict -h 127.0.0.1";
services.dictd.enable = true;
services.dictd.DBs = with pkgs.dictdDBs; [ wiktionary wordnet deu2eng eng2deu ];
}
diff --git a/makefu/2configs/git/cgit-retiolum.nix b/makefu/2configs/git/cgit-retiolum.nix
index 4890e4afe..0ff855980 100644
--- a/makefu/2configs/git/cgit-retiolum.nix
+++ b/makefu/2configs/git/cgit-retiolum.nix
@@ -62,6 +62,15 @@ let
make-krebs-repo = with git; name: { cgit ? {}, ... }: {
inherit cgit name;
public = true;
+ hooks = {
+ post-receive = pkgs.git-hooks.irc-announce {
+ nick = config.networking.hostName;
+ verbose = config.krebs.build.host.name == "gum";
+ channel = "#xxx";
+ # TODO remove the hardcoded hostname
+ server = "irc.r";
+ };
+ };
};
diff --git a/makefu/2configs/home-manager/desktop.nix b/makefu/2configs/home-manager/desktop.nix
index 3be020faa..63a5cdbef 100644
--- a/makefu/2configs/home-manager/desktop.nix
+++ b/makefu/2configs/home-manager/desktop.nix
@@ -11,6 +11,15 @@
services.network-manager-applet.enable = true;
services.blueman-applet.enable = true;
services.pasystray.enable = true;
+ services.flameshot.enable = true;
+ home.file.".config/Dharkael/flameshot.ini".text = ''
+ [General]
+ disabledTrayIcon=false
+ drawColor=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\xff\xff\0\0)
+ drawThickness=0
+ filenamePattern=%F_%T_shot
+ '';
+
systemd.user.services.pasystray.Service.Environment = "PATH=" + (lib.makeBinPath (with pkgs;[ pavucontrol paprefs /* pavumeter */ /* paman */ ]) );
programs.chromium = {
enable = true;
diff --git a/makefu/2configs/home-manager/zsh.nix b/makefu/2configs/home-manager/zsh.nix
index 59658e667..6c7b632e1 100644
--- a/makefu/2configs/home-manager/zsh.nix
+++ b/makefu/2configs/home-manager/zsh.nix
@@ -86,7 +86,8 @@
share = true;
};
sessionVariables = {
- TERM = "rxvt-unicode-256color";
+ # TERM = "rxvt-unicode-256color";
+ TERM = "xterm";
LANG = "en_US.UTF8";
LS_COLORS = ":di=1;31:";
EDITOR = "vim";
diff --git a/makefu/2configs/homeautomation/default.nix b/makefu/2configs/homeautomation/default.nix
index 596d0002a..4e9ac0ee3 100644
--- a/makefu/2configs/homeautomation/default.nix
+++ b/makefu/2configs/homeautomation/default.nix
@@ -55,7 +55,8 @@ let
payload_not_available = "Offline";
};
- firetv = "192.168.1.238";
+ firetv = "192.168.1.183";
+ hassdir = "/var/lib/hass";
tasmota_plug = name: topic:
{ platform = "mqtt";
inherit name;
@@ -105,13 +106,7 @@ in {
imports = [
./mqtt.nix
];
- #systemd.services.firetv = {
- # wantedBy = [ "multi-user.target" ];
- # serviceConfig = {
- # User = "nobody";
- # ExecStart = "${pkgs.python-firetv}/bin/firetv-server -d ${firetv}:5555";
- # };
- #};
+
services.home-assistant = {
config = {
homeassistant = {
@@ -133,9 +128,11 @@ in {
{ platform = "kodi";
host = firetv;
}
- #{ platform = "firetv";
- # # assumes python-firetv running
- #}
+ { platform = "firetv";
+ name = "FireTV Stick";
+ host = firetv;
+ adbkey = <secrets/hass/adbkey>;
+ }
];
mqtt = {
broker = "localhost";
@@ -211,9 +208,12 @@ in {
flur = [
"light.flurlicht"
"binary_sensor.flur_bewegung"
+ "automation.dunkel_bei_sonnenuntergang"
+ "automation.hell_bei_sonnenaufgang"
];
wohnzimmer = [
"media_player.kodi"
+ "media_player.firetv_stick"
];
draussen = [
"sensor.dark_sky_temperature"
@@ -240,6 +240,47 @@ in {
];
light = [ (tasmota_rgb "Flurlicht" "flurlicht" ) ];
automation = [
+ { alias = "Dunkel bei Sonnenuntergang";
+ trigger = {
+ platform = "sun";
+ event = "sunset";
+ # offset: "-00:45:00"
+ };
+ action = [
+ {
+ service= "light.turn_on";
+ data = {
+ entity_id= "light.flurlicht";
+ # rgb_color = [ 0,0,0 ]; <-- TODO default color
+ brightness_pct = 15;
+ };
+ }
+ {
+ service= "light.turn_off";
+ entity_id= "light.flurlicht";
+ }
+ ];
+ }
+ { alias = "Hell bei Sonnenaufgang";
+ trigger = {
+ platform = "sun";
+ event = "sunrise";
+ # offset: "-00:00:00"
+ };
+ action = [
+ {
+ service= "light.turn_on";
+ data = {
+ entity_id= "light.flurlicht";
+ brightness_pct = 85;
+ };
+ }
+ {
+ service= "light.turn_off";
+ entity_id= "light.flurlicht";
+ }
+ ];
+ }
{ alias = "Staubsauger Strom aus nach 6h";
trigger = {
platform = "state";
@@ -255,6 +296,10 @@ in {
];
};
enable = true;
- #configDir = "/var/lib/hass";
+ configDir = hassdir;
};
+ nixpkgs.config.permittedInsecurePackages = [
+ "homeassistant-0.77.2"
+ ];
+
}
diff --git a/makefu/2configs/homeautomation/google-muell.nix b/makefu/2configs/homeautomation/google-muell.nix
index 235cc1546..c81eae201 100644
--- a/makefu/2configs/homeautomation/google-muell.nix
+++ b/makefu/2configs/homeautomation/google-muell.nix
@@ -3,13 +3,21 @@ with import <stockholm/lib>;
let
pkg = pkgs.ampel;
home = "/var/lib/ampel";
- sec = "${toString <secrets>}/google-muell.json";
+ sec = "${toString <secrets>}/ampel/google-muell.json";
ampelsec = "${home}/google-muell.json";
- cred = "${toString <secrets>}/google-muell-creds.json";
+ cred = "${toString <secrets>}/ampel/google-muell-creds.json";
# TODO: generate this credential file locally
ampelcred = "${home}/google-muell-creds.json";
- esp = "192.168.8.204";
sleepval = "1800";
+ # default-color = "18,63,40";
+ default-color = "255,127,0";
+ config_json = toFile "config.json" (toJSON {
+ mq_hostname = "localhost";
+ mq_port = 1883;
+ mq_username = "sensor";
+ mq_topic = "/ham/flurlicht/cmnd/MEM1";
+ mq_password = replaceChars ["\n"] [""] (readFile "${toString <secrets>}/mqtt/sensor");
+ });
in {
users.users.ampel = {
uid = genid "ampel";
@@ -27,7 +35,7 @@ in {
install -m600 -o ampel ${sec} ${ampelsec}
install -m600 -o ampel ${cred} ${ampelcred}
'';
- ExecStart = "${pkg}/bin/google-muell --esp=${esp} --client-secrets=${ampelsec} --credential-path=${ampelcred} --sleepval=${sleepval}";
+ ExecStart = "${pkg}/bin/google-muell --config ${config_json} --default-color=${default-color} --client-secrets=${ampelsec} --credential-path=${ampelcred} --sleepval=${sleepval}";
PermissionsStartOnly = true;
Restart = "always";
RestartSec = 10;
diff --git a/makefu/2configs/remote-build/gum.nix b/makefu/2configs/remote-build/gum.nix
new file mode 100644
index 000000000..98e2e58b5
--- /dev/null
+++ b/makefu/2configs/remote-build/gum.nix
@@ -0,0 +1,15 @@
+{
+ nix = {
+ distributedBuilds = true;
+ buildMachines = [
+ {
+ hostName = "gum.krebsco.de";
+ maxJobs = 8;
+ sshKey = toString <secrets/id_nixBuild>;
+ sshUser = "nixBuild";
+ system = "x86_64-linux";
+ supportedFeatures = [ ];
+ }
+ ];
+ };
+}
diff --git a/makefu/2configs/remote-build/slave.nix b/makefu/2configs/remote-build/slave.nix
index 89121ffd6..0227f512a 100644
--- a/makefu/2configs/remote-build/slave.nix
+++ b/makefu/2configs/remote-build/slave.nix
@@ -5,6 +5,7 @@
useDefaultShell = true;
openssh.authorizedKeys.keys = [
config.krebs.users.buildbotSlave.pubkey
+ config.krebs.users.makefu-remote-builder.pubkey
];
};
}
diff --git a/makefu/2configs/save-diskspace.nix b/makefu/2configs/save-diskspace.nix
index 4fd569768..b6725e730 100644
--- a/makefu/2configs/save-diskspace.nix
+++ b/makefu/2configs/save-diskspace.nix
@@ -4,8 +4,8 @@ _:
environment.noXlibs = true;
nix.gc.automatic = true;
nix.gc.dates = "03:10";
- programs.info.enable = false;
- programs.man.enable = false;
+ documentation.info.enable = false;
+ documentation.man.enable = false;
services.journald.extraConfig = "SystemMaxUse=50M";
services.nixosManual.enable = false;
}
diff --git a/makefu/2configs/tools/core-gui.nix b/makefu/2configs/tools/core-gui.nix
index 1e85da53c..582d941a6 100644
--- a/makefu/2configs/tools/core-gui.nix
+++ b/makefu/2configs/tools/core-gui.nix
@@ -2,6 +2,7 @@
{
users.users.makefu.packages = with pkgs; [
+ at_spi2_core
chromium
feh
clipit
diff --git a/makefu/2configs/tools/core.nix b/makefu/2configs/tools/core.nix
index 33e896d4c..b4c3a431e 100644
--- a/makefu/2configs/tools/core.nix
+++ b/makefu/2configs/tools/core.nix
@@ -8,7 +8,6 @@
( pkgs.writeScriptBin "unknow" ''#!/bin/sh
${gnused}/bin/sed -i "''${1}d" ~/.ssh/known_hosts
'')
- at_spi2_core
acpi
bc
rsync
@@ -17,6 +16,7 @@ ${gnused}/bin/sed -i "''${1}d" ~/.ssh/known_hosts
lsof
which
binutils
+ screen
# fs
cifs-utils
diff --git a/makefu/2configs/tools/dev.nix b/makefu/2configs/tools/dev.nix
index 0c877fc7b..fe25bd49a 100644
--- a/makefu/2configs/tools/dev.nix
+++ b/makefu/2configs/tools/dev.nix
@@ -26,5 +26,6 @@
nix-review
# git-related
tig
+ init-host
];
}
diff --git a/makefu/2configs/tools/games.nix b/makefu/2configs/tools/games.nix
index 40ea4523d..0f1e61791 100644
--- a/makefu/2configs/tools/games.nix
+++ b/makefu/2configs/tools/games.nix
@@ -2,7 +2,7 @@
{
imports = [
- ./steam.nix
+ # ./steam.nix
];
users.users.makefu.packages = with pkgs; [
games-user-env
diff --git a/makefu/5pkgs/Fluffy/default.nix b/makefu/5pkgs/Fluffy/default.nix
new file mode 100644
index 000000000..59a04a52d
--- /dev/null
+++ b/makefu/5pkgs/Fluffy/default.nix
@@ -0,0 +1,42 @@
+{ lib, pkgs, python3Packages, ... }:
+
+with python3Packages; buildPythonApplication rec {
+ name = "Fluffy-${version}";
+ format = "other";
+ version = "2.7";
+
+ src = pkgs.fetchFromGitHub {
+ owner = "fourminute";
+ repo = "Fluffy";
+ rev = "v${version}";
+ sha256 = "1l346bklidcl40q91cfdszrfskdwlmfjbmsc3mgs0i8wi1yhvq99";
+ };
+
+ prePatch = ''
+ sed -e "s|/tmp|$HOME/.config/fluffy|" -i linux/fluffy.desktop
+ '';
+
+ installPhase = ''
+ env
+ install -Dm 644 linux/80-fluffy-switch.rules "$out/etc/udev/rules.d/80-fluffy-switch.rules"
+ install -Dm 644 linux/fluffy.desktop "$out/usr/share/applications/fluffy.desktop"
+ install -Dm 644 icons/16x16/fluffy.png "$out/share/icons/hicolor/16x16/apps/fluffy.png"
+ install -Dm 644 icons/24x24/fluffy.png "$out/share/icons/hicolor/24x24/apps/fluffy.png"
+ install -Dm 644 icons/32x32/fluffy.png "$out/share/icons/hicolor/32x32/apps/fluffy.png"
+ install -Dm 644 icons/48x48/fluffy.png "$out/share/icons/hicolor/48x48/apps/fluffy.png"
+ install -Dm 644 icons/64x64/fluffy.png "$out/share/icons/hicolor/64x64/apps/fluffy.png"
+ install -Dm 644 icons/128x128/fluffy.png "$out/share/icons/hicolor/128x128/apps/fluffy.png"
+ install -Dm 755 fluffy.pyw "$out/bin/fluffy"
+ wrapProgram "$out/bin/fluffy" --set PYTHONPATH "$PYTHONPATH"
+ '';
+
+ propagatedBuildInputs = [
+ pyqt5 pyusb libusb1 configparser tkinter
+ ];
+
+ meta = {
+ homepage = https://github.com/fourminute/Fluffy;
+ description = "A feature-rich tool for installing NSPs";
+ license = lib.licenses.gpl3;
+ };
+}
diff --git a/makefu/5pkgs/ampel/default.nix b/makefu/5pkgs/ampel/default.nix
index 9792c2c59..fb722a52f 100644
--- a/makefu/5pkgs/ampel/default.nix
+++ b/makefu/5pkgs/ampel/default.nix
@@ -2,7 +2,7 @@
with pkgs.python3Packages;buildPythonPackage rec {
name = "ampel-${version}";
- version = "0.2.1";
+ version = "0.2.5";
propagatedBuildInputs = [
docopt
@@ -16,8 +16,8 @@ with pkgs.python3Packages;buildPythonPackage rec {
src = pkgs.fetchgit {
url = "http://cgit.euer.krebsco.de/ampel";
- rev = "92321d7";
- sha256 = "0mvpbpf1rx8sc589qjb73gl8z6fir2zs3gl3br1pbhg5jgn0ij4n";
+ rev = "ce239876820699f02054e71b4fd0950509833379";
+ sha256 = "1ja32lr04lwq4shi49kppa1zzjw0zlqaqy71pr5sbajgp4zj7kh8";
};
meta = {
homepage = http://cgit.euer.krebsco.de/ampel;
diff --git a/makefu/5pkgs/awesomecfg/default.nix b/makefu/5pkgs/awesomecfg/default.nix
index 486c0ddf6..1ae2f50d9 100644
--- a/makefu/5pkgs/awesomecfg/default.nix
+++ b/makefu/5pkgs/awesomecfg/default.nix
@@ -5,6 +5,7 @@
, networkmanagerapplet
, blueman
, clipit
+, flameshot
, modkey ? "Mod4"
, locker? "${pkgs.xlock}/bin/xlock -mode blank"
, ... }:
@@ -13,7 +14,7 @@
# replace: @alsaUtils@ @xlockmore@ @xbacklight@ @modkey@
full = lib.makeOverridable pkgs.substituteAll {
name = "awesome_full_config";
- inherit alsaUtils locker xbacklight modkey networkmanagerapplet blueman clipit;
+ inherit alsaUtils locker xbacklight modkey networkmanagerapplet blueman clipit flameshot ;
isExecutable = false;
src = ./full.cfg;
};
diff --git a/makefu/5pkgs/awesomecfg/full.cfg b/makefu/5pkgs/awesomecfg/full.cfg
index 11f9f59b8..83dd79b4d 100644
--- a/makefu/5pkgs/awesomecfg/full.cfg
+++ b/makefu/5pkgs/awesomecfg/full.cfg
@@ -410,6 +410,7 @@ clientkeys = awful.util.table.join(
-- minimized, since minimized clients can't have the focus.
c.minimized = true
end),
+ awful.key({ }, "Print", function () awful.util.spawn("@flameshot@/bin/flameshot gui") end),
awful.key({ modkey, }, "m",
function (c)
c.maximized = not c.maximized
diff --git a/makefu/5pkgs/init-host/default.nix b/makefu/5pkgs/init-host/default.nix
new file mode 100644
index 000000000..d1d3f7195
--- /dev/null
+++ b/makefu/5pkgs/init-host/default.nix
@@ -0,0 +1,47 @@
+{ pkgs }:
+pkgs.writeDashBin "generate-secrets" ''
+ set -euf
+ HOSTNAME="''${1?must provide hostname}"
+ TMPDIR=$(${pkgs.coreutils}/bin/mktemp -d)
+ PASSWORD=$(${pkgs.pwgen}/bin/pwgen 25 1)
+ HASHED_PASSWORD=$(echo $PASSWORD | ${pkgs.hashPassword}/bin/hashPassword -s) > /dev/null
+
+ ${pkgs.openssh}/bin/ssh-keygen -t ed25519 -f $TMPDIR/ssh.id_ed25519 -P "" -C "" >/dev/null
+ ${pkgs.openssl}/bin/openssl genrsa -out $TMPDIR/retiolum.rsa_key.priv 4096 2>/dev/null > /dev/null
+ ${pkgs.openssl}/bin/openssl rsa -in $TMPDIR/retiolum.rsa_key.priv -pubout -out $TMPDIR/retiolum.rsa_key.pub 2>/dev/null > /dev/null
+ cat <<EOF > $TMPDIR/hashedPasswords.nix
+ {
+ root = "$HASHED_PASSWORD";
+ }
+ EOF
+
+ cd $TMPDIR
+ for x in *; do
+ ${pkgs.coreutils}/bin/cat $x | secrets insert -m $HOSTNAME/$x > /dev/null
+ done
+ echo $PASSWORD | secrets insert -m $HOSTNAME/root > /dev/null
+
+ cat <<EOF
+ $HOSTNAME = {
+ cores = 1;
+ owner = config.krebs.users.makefu;
+ nets = {
+ retiolum = {
+ ip4.addr = "10.243.0.changeme";
+ ip6.addr = "42:0:0:0:0:0:0:changeme";
+ aliases = [
+ "$HOSTNAME.r"
+ ];
+ tinc.pubkey = ${"''"}
+ $(cat $TMPDIR/retiolum.rsa_key.pub)
+ ${"''"};
+ };
+ };
+ ssh.privkey.path = <secrets/ssh.id_ed25519>;
+ ssh.pubkey = "$(cat $TMPDIR/ssh.id_ed25519.pub)";
+ };
+ EOF
+
+ rm -rf $TMPDIR
+''
+
diff --git a/makefu/krops.nix b/makefu/krops.nix
index 57a3b3bbf..7c3fbcf4a 100644
--- a/makefu/krops.nix
+++ b/makefu/krops.nix
@@ -23,6 +23,7 @@
# nixos-18.09 @ 2018-09-18
# + uhub/sqlite: 5dd7610401747
# + hovercraft: 7134801b17d72
+ # + PR#53934: eac6797380af1
nixpkgs = if host-src.arm6 then {
# TODO: we want to track the unstable channel
symlink = "/nix/var/nix/profiles/per-user/root/channels/nixos/";
diff --git a/makefu/nixpkgs.json b/makefu/nixpkgs.json
index d62fd65ca..08dd7156e 100644
--- a/makefu/nixpkgs.json
+++ b/makefu/nixpkgs.json
@@ -1,7 +1,7 @@
{
"url": "https://github.com/makefu/nixpkgs",
- "rev": "125873064a6eabd2896833d00aede7778a453fdf",
- "date": "2019-01-11T14:24:21+01:00",
- "sha256": "1ki50426m9simqvxdzckfgycibz5rdhwl6hzi31i72dqiafl8j6s",
+ "rev": "cba65c1ab2aec20f0eaa77d6747f16798688e1bb",
+ "date": "2019-02-25T00:04:17+01:00",
+ "sha256": "1h6d9kghs7n7nql7fw5v9fpmpgdq6xq62npc7cfvyam8g4ma9iwn",
"fetchSubmodules": false
}
[cgit] Unable to lock slot /tmp/cgit/f1200000.lock: No such file or directory (2)