From db9163a6005ad7e6f78a67c6a306cb4fa183698f Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 1 Feb 2019 22:31:43 +0100 Subject: ma nixpkgs: 1258730 -> 30a126c --- makefu/nixpkgs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'makefu') diff --git a/makefu/nixpkgs.json b/makefu/nixpkgs.json index d62fd65ca..1788a17fb 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": "30a126c41eb81e96474d7f8488635fc36d78dd25", + "date": "2019-02-01T22:09:16+01:00", + "sha256": "1s5y22fs08wyw1izmaqd5dcnflw3rvkm3880vmlwv20g1phwhhi2", "fetchSubmodules": false } -- cgit v1.2.3 From 80c2ab739d2d51bf47b07fd6f39508a85077b0e6 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 3 Feb 2019 23:17:52 +0100 Subject: ma dict: actually use the dict server --- makefu/2configs/dict.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'makefu') 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 ]; } -- cgit v1.2.3 From 0b668099468313b4547e1044efdc380d58e1d43e Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 5 Feb 2019 22:32:28 +0100 Subject: ma flameshot: init --- makefu/2configs/home-manager/desktop.nix | 9 +++++++++ makefu/5pkgs/awesomecfg/default.nix | 3 ++- makefu/5pkgs/awesomecfg/full.cfg | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'makefu') 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/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 -- cgit v1.2.3 From d47dcb07825f548c76323143d6f3e04d6a9c773e Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 5 Feb 2019 22:32:53 +0100 Subject: ma gum: use aarch64 builder --- makefu/1systems/gum/config.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'makefu') 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 { + # services -- cgit v1.2.3 From 0132d371e6403f19bd8d188e8af836c9303db3fc Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 5 Feb 2019 22:33:09 +0100 Subject: ma zsh: revert back to TERM=xterm --- makefu/2configs/home-manager/zsh.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'makefu') 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"; -- cgit v1.2.3 From 6dc21884dcc140922c8c2e295a2ed026becdab30 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 5 Feb 2019 22:33:26 +0100 Subject: ma homeautomation: permit Insecure homeassistant --- makefu/2configs/homeautomation/default.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'makefu') diff --git a/makefu/2configs/homeautomation/default.nix b/makefu/2configs/homeautomation/default.nix index 596d0002a..2af311c3b 100644 --- a/makefu/2configs/homeautomation/default.nix +++ b/makefu/2configs/homeautomation/default.nix @@ -257,4 +257,8 @@ in { enable = true; #configDir = "/var/lib/hass"; }; + nixpkgs.config.permittedInsecurePackages = [ + "homeassistant-0.77.2" + ]; + } -- cgit v1.2.3 From c9314cac8226da1d422ca5d3c73dab3fbb42513a Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 5 Feb 2019 22:33:54 +0100 Subject: ma tools: move at_spi2_core to gui --- makefu/2configs/tools/core-gui.nix | 1 + makefu/2configs/tools/core.nix | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'makefu') 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 -- cgit v1.2.3 From 7f0354f2bae42e9eb6a341c079aeadfa1fc88e5b Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 8 Feb 2019 15:14:54 +0100 Subject: ma tools/games: disable steam (for now) --- makefu/2configs/tools/games.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'makefu') 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 -- cgit v1.2.3 From 6788519e4be7390c76bffacadd05d49f8fc3cace Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 8 Feb 2019 15:17:23 +0100 Subject: ma x: enable remote builder --- makefu/1systems/x/config.nix | 27 +++++++++++++++++---------- makefu/2configs/remote-build/gum.nix | 15 +++++++++++++++ makefu/2configs/remote-build/slave.nix | 1 + 3 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 makefu/2configs/remote-build/gum.nix (limited to 'makefu') diff --git a/makefu/1systems/x/config.nix b/makefu/1systems/x/config.nix index 138735d91..7ed63837f 100644 --- a/makefu/1systems/x/config.nix +++ b/makefu/1systems/x/config.nix @@ -15,6 +15,13 @@ + # + #{ + # netboot_server = { + # network.wan = "wlp3s0"; + # network.lan = "enp0s25"; + # }; + #} # @@ -52,21 +59,22 @@ # Virtualization - - { - 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 # + # Hardware @@ -162,7 +170,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/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 ; + 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 ]; }; } -- cgit v1.2.3 From 6e82401de73d1a95a5e465fe75974d91c6595c15 Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 9 Feb 2019 23:19:19 +0100 Subject: ma cake.r: now perform the important tasks of omo --- makefu/1systems/cake/config.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'makefu') 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 = [ ./hardware-config.nix - + # + { environment.systemPackages = with pkgs;[ rsync screen curl git ];} + + # + + # configure your hw: # ]; @@ -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; -- cgit v1.2.3 From 7661181528df06f3b7e15128c1efcb6ac1854f31 Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 9 Feb 2019 23:19:53 +0100 Subject: ma google-muell: bump to latest version, use new config --- makefu/2configs/homeautomation/google-muell.nix | 15 +++++++++++---- makefu/5pkgs/ampel/default.nix | 6 +++--- 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'makefu') diff --git a/makefu/2configs/homeautomation/google-muell.nix b/makefu/2configs/homeautomation/google-muell.nix index 235cc1546..5870f298d 100644 --- a/makefu/2configs/homeautomation/google-muell.nix +++ b/makefu/2configs/homeautomation/google-muell.nix @@ -3,13 +3,20 @@ with import ; let pkg = pkgs.ampel; home = "/var/lib/ampel"; - sec = "${toString }/google-muell.json"; + sec = "${toString }/ampel/google-muell.json"; ampelsec = "${home}/google-muell.json"; - cred = "${toString }/google-muell-creds.json"; + cred = "${toString }/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 = "244,220,66"; + 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 }/mqtt/sensor"); + }); in { users.users.ampel = { uid = genid "ampel"; @@ -27,7 +34,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/5pkgs/ampel/default.nix b/makefu/5pkgs/ampel/default.nix index 9792c2c59..70fdfda78 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.4"; 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 = "04e1c8c38ffe53175ae719121ad88534a8a662db"; + sha256 = "00jgr3jg2yi91hd7388v8rncfbq8fx8dvr03sg749dzpsg58hfxn"; }; meta = { homepage = http://cgit.euer.krebsco.de/ampel; -- cgit v1.2.3 From 78803cf974c0828170ff360b353bd1b67f2d7da9 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 10 Feb 2019 08:01:01 +0100 Subject: ma tests/secrets: add id_nixBuild --- makefu/0tests/data/secrets/id_nixBuild | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 makefu/0tests/data/secrets/id_nixBuild (limited to 'makefu') diff --git a/makefu/0tests/data/secrets/id_nixBuild b/makefu/0tests/data/secrets/id_nixBuild new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3 From d64c6bb976f61b2173a2c170ea1ba6f26c57147e Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 10 Feb 2019 09:53:45 +0100 Subject: Revert "ma cgit: disable irc hook" This reverts commit 1f8ad80695e93687999b8151ddd2e7f2c40b085b. --- makefu/2configs/git/cgit-retiolum.nix | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'makefu') 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"; + }; + }; }; -- cgit v1.2.3 From a68144db9fef2a46a5817da7449fe2ba89e600ee Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 11 Feb 2019 17:52:22 +0100 Subject: ma gum.r: also load dm-raid at startup of kernel to mount binaergewitter --- makefu/1systems/gum/hardware-config.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'makefu') 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" = { -- cgit v1.2.3 From f26eda6481e470f19b41d64539f282b15e23b389 Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 16 Feb 2019 22:31:35 +0100 Subject: ma nixpkgs: 30a126c -> 16fc627 --- makefu/nixpkgs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'makefu') diff --git a/makefu/nixpkgs.json b/makefu/nixpkgs.json index 1788a17fb..7c14f78a8 100644 --- a/makefu/nixpkgs.json +++ b/makefu/nixpkgs.json @@ -1,7 +1,7 @@ { "url": "https://github.com/makefu/nixpkgs", - "rev": "30a126c41eb81e96474d7f8488635fc36d78dd25", - "date": "2019-02-01T22:09:16+01:00", - "sha256": "1s5y22fs08wyw1izmaqd5dcnflw3rvkm3880vmlwv20g1phwhhi2", + "rev": "16fc6279dddabc42f8556d6368ed4215d916794f", + "date": "2019-02-16T22:29:33+01:00", + "sha256": "0bgm0gybqysy1si2zd8b2h6200hgmi8qsyi6qhcnvd4n555f3iic", "fetchSubmodules": false } -- cgit v1.2.3 From 93a2ebaa6de0a3e450a28d109ee5d4a92d20f2d8 Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 16 Feb 2019 22:37:29 +0100 Subject: ma x.r: prefer remote fetch of sources --- makefu/1systems/x/config.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'makefu') diff --git a/makefu/1systems/x/config.nix b/makefu/1systems/x/config.nix index 7ed63837f..ceeccc0b2 100644 --- a/makefu/1systems/x/config.nix +++ b/makefu/1systems/x/config.nix @@ -75,6 +75,7 @@ # + { nixpkgs.overlays = [ (self: super: super.prefer-remote-fetch self super) ]; } # Hardware -- cgit v1.2.3 From fb1d5f4addd1b3b564248b1359253bf788b1c08a Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 4 Mar 2019 08:47:18 +0100 Subject: ma pkgs.Fluffy: init at 2.7 --- makefu/5pkgs/Fluffy/default.nix | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 makefu/5pkgs/Fluffy/default.nix (limited to 'makefu') 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; + }; +} -- cgit v1.2.3 From 9c702551abbf5c486d9dac3becc4d5e998511a52 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 6 Mar 2019 16:42:27 +0100 Subject: ma bureautomation: split into files --- makefu/1systems/wbob/config.nix | 3 +- .../bureautomation/automation/10h_timer.nix | 147 ++++++++++ .../bureautomation/automation/bureau-shutdown.nix | 55 ++++ .../bureautomation/automation/nachtlicht.nix | 43 +++ .../bureautomation/binary_sensor/buttons.nix | 17 ++ .../bureautomation/binary_sensor/motion.nix | 12 + .../bureautomation/camera/verkehrskamera.nix | 14 + makefu/2configs/bureautomation/hass.nix | 315 ++++----------------- makefu/2configs/bureautomation/led-fader.nix | 23 ++ makefu/2configs/bureautomation/light/buzzer.nix | 28 ++ .../2configs/bureautomation/light/statuslight.nix | 56 ++++ .../2configs/bureautomation/script/multi_blink.nix | 37 +++ makefu/2configs/bureautomation/sensor/espeasy.nix | 31 ++ makefu/2configs/bureautomation/sensor/influxdb.nix | 18 ++ makefu/2configs/bureautomation/sensor/outside.nix | 25 ++ .../bureautomation/switch/tasmota_switch.nix | 19 ++ makefu/2configs/deployment/led-fader.nix | 23 -- 17 files changed, 582 insertions(+), 284 deletions(-) create mode 100644 makefu/2configs/bureautomation/automation/10h_timer.nix create mode 100644 makefu/2configs/bureautomation/automation/bureau-shutdown.nix create mode 100644 makefu/2configs/bureautomation/automation/nachtlicht.nix create mode 100644 makefu/2configs/bureautomation/binary_sensor/buttons.nix create mode 100644 makefu/2configs/bureautomation/binary_sensor/motion.nix create mode 100644 makefu/2configs/bureautomation/camera/verkehrskamera.nix create mode 100644 makefu/2configs/bureautomation/led-fader.nix create mode 100644 makefu/2configs/bureautomation/light/buzzer.nix create mode 100644 makefu/2configs/bureautomation/light/statuslight.nix create mode 100644 makefu/2configs/bureautomation/script/multi_blink.nix create mode 100644 makefu/2configs/bureautomation/sensor/espeasy.nix create mode 100644 makefu/2configs/bureautomation/sensor/influxdb.nix create mode 100644 makefu/2configs/bureautomation/sensor/outside.nix create mode 100644 makefu/2configs/bureautomation/switch/tasmota_switch.nix delete mode 100644 makefu/2configs/deployment/led-fader.nix (limited to 'makefu') 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. + # @@ -39,7 +40,6 @@ in { - # { environment.systemPackages = [ pkgs.vlc ]; } @@ -51,6 +51,7 @@ in { ]; } + (let 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 ); - 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/bureautomation/led-fader.nix b/makefu/2configs/bureautomation/led-fader.nix new file mode 100644 index 000000000..d7f728534 --- /dev/null +++ b/makefu/2configs/bureautomation/led-fader.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, buildPythonPackage, ... }: + +let + mq = "192.168.8.11"; + pkg = pkgs.ampel; +in { + systemd.services.led-fader = { + description = "Send led change to message queue"; + environment = { + NIX_PATH = "/var/src"; + }; + after = [ "network-online.target" ] ++ (lib.optional config.services.mosquitto.enable "mosquitto.service"); + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + # User = "nobody"; # need a user with permissions to run nix-shell + ExecStartPre = pkgs.writeDash "sleep.sh" "sleep 2"; + 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 ); + 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/deployment/led-fader.nix b/makefu/2configs/deployment/led-fader.nix deleted file mode 100644 index d34b66125..000000000 --- a/makefu/2configs/deployment/led-fader.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, lib, pkgs, buildPythonPackage, ... }: - -let - mq = "192.168.8.11"; - pkg = pkgs.ampel; -in { - systemd.services.led-fader = { - description = "Send led change to message queue"; - environment = { - NIX_PATH = "/var/src"; - }; - after = [ "network-online.target" ] ++ (lib.optional config.services.mosquitto.enable "mosquitto.service"); - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - # User = "nobody"; # need a user with permissions to run nix-shell - ExecStartPre = pkgs.writeDash "sleep.sh" "sleep 2"; - ExecStart = "${pkg}/bin/ampel 4"; - Restart = "always"; - RestartSec = 10; - PrivateTmp = true; - }; - }; -} -- cgit v1.2.3 From 7e9a2417ba27a19d6db0a87b075b9d55a237931a Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 6 Mar 2019 16:42:52 +0100 Subject: ma homeautomation: update google-muell --- makefu/2configs/homeautomation/default.nix | 65 ++++++++++++++++++++----- makefu/2configs/homeautomation/google-muell.nix | 3 +- 2 files changed, 55 insertions(+), 13 deletions(-) (limited to 'makefu') diff --git a/makefu/2configs/homeautomation/default.nix b/makefu/2configs/homeautomation/default.nix index 2af311c3b..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 = ; + } ]; 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,7 +296,7 @@ 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 5870f298d..c81eae201 100644 --- a/makefu/2configs/homeautomation/google-muell.nix +++ b/makefu/2configs/homeautomation/google-muell.nix @@ -9,7 +9,8 @@ let # TODO: generate this credential file locally ampelcred = "${home}/google-muell-creds.json"; sleepval = "1800"; - default-color = "244,220,66"; + # default-color = "18,63,40"; + default-color = "255,127,0"; config_json = toFile "config.json" (toJSON { mq_hostname = "localhost"; mq_port = 1883; -- cgit v1.2.3 From 5a26810af163a89bcda3747611bf059c307ce1f3 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 6 Mar 2019 16:43:06 +0100 Subject: ma pkgs.ampel: bump rev --- makefu/5pkgs/ampel/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'makefu') diff --git a/makefu/5pkgs/ampel/default.nix b/makefu/5pkgs/ampel/default.nix index 70fdfda78..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.4"; + 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 = "04e1c8c38ffe53175ae719121ad88534a8a662db"; - sha256 = "00jgr3jg2yi91hd7388v8rncfbq8fx8dvr03sg749dzpsg58hfxn"; + rev = "ce239876820699f02054e71b4fd0950509833379"; + sha256 = "1ja32lr04lwq4shi49kppa1zzjw0zlqaqy71pr5sbajgp4zj7kh8"; }; meta = { homepage = http://cgit.euer.krebsco.de/ampel; -- cgit v1.2.3 From 593a519f6eb210913be25c441cd54c25c12744c6 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 6 Mar 2019 16:43:52 +0100 Subject: ma crapi.r: split into software and hardware config --- makefu/1systems/crapi/config.nix | 33 +------------------------- makefu/1systems/crapi/hardware-config.nix | 39 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 32 deletions(-) create mode 100644 makefu/1systems/crapi/hardware-config.nix (limited to 'makefu') 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 - # builtins.readDir (pkgs.fetchFromGitHub { owner = "nixos"; repo = "nixpkgs-channels"; rev = "6c064e6b"; sha256 = "1rqzh475xn43phagrr30lb0fd292c1s8as53irihsnd5wcksnbyd"; }) imports = [ + ./hardware-config.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/e