diff --git a/makefu/1systems/x/config.nix b/makefu/1systems/x/config.nix index ad2ad8779..f72f2a15b 100644 --- a/makefu/1systems/x/config.nix +++ b/makefu/1systems/x/config.nix @@ -11,6 +11,8 @@ with import ; + + @@ -27,6 +29,8 @@ with import ; # # # + # + # # Krebs @@ -40,7 +44,7 @@ with import ; # Virtualization - # + { networking.firewall.allowedTCPPorts = [ 8080 ]; networking.nat = { @@ -78,7 +82,6 @@ with import ; # # # - # { networking.wireguard.interfaces.wg0 = { @@ -123,6 +126,7 @@ with import ; load-module module-filter-heuristics load-module module-filter-apply load-module module-switch-on-connect + load-module module-switch-on-port-available ''; }; diff --git a/makefu/1systems/x/source.nix b/makefu/1systems/x/source.nix index 6278877c3..ab6429dc1 100644 --- a/makefu/1systems/x/source.nix +++ b/makefu/1systems/x/source.nix @@ -3,5 +3,7 @@ import { full = true; python = true; hw = true; + unstable = true; + mic92 = true; # torrent = true; } diff --git a/makefu/2configs/deployment/bureautomation/hass.nix b/makefu/2configs/deployment/bureautomation/hass.nix new file mode 100644 index 000000000..b62f37bdb --- /dev/null +++ b/makefu/2configs/deployment/bureautomation/hass.nix @@ -0,0 +1,75 @@ +{ pkgs, lib, ... }: +let + firetv = "192.168.1.238"; +in { + imports = [ + + ]; + systemd.services.firetv = { + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "nobody"; + ExecStart = "${pkgs.python-firetv}/bin/firetv-server -d ${firetv}:5555"; + }; + }; + nixpkgs.config.packageOverrides = oldpkgs: { + home-assistant = (import {}).home-assistant; + }; + ids.uids.hass = 286; + ids.gids.hass = 286; + services.home-assistant = { + #panel_iframe: + #configurator: + # title: Configurator + # icon: mdi:wrench + # url: http://hassio.local:3218 + # sensor: + # - platform: random + enable = true; + config = { + homeassistant = { + name = "Bureautomation"; + time_zone = "Europe/Berlin"; + }; + panel_iframe = { + euer_blog = { + title = "Euer Blog"; + icon = "mdi:wrench"; + url = "https://euer.krebsco.de"; + }; + }; + media_player = [ + { platform = "kodi"; + host = firetv; + } + { platform = "firetv"; + # assumes python-firetv running + } + ]; + sensor = [ + { + platform = "luftdaten"; + name = "Shack 1"; + sensorid = "50"; + monitored_conditions = [ "P1" "P2" ]; + } + { + platform = "luftdaten"; + name = "Shack 2"; + sensorid = "658"; + monitored_conditions = [ "P1" "P2" ]; + } + { + platform = "luftdaten"; + name = "Ditzingen"; + sensorid = "5341"; + monitored_conditions = [ "P1" "P2" ]; + } + { platform = "random"; } + ]; + frontend = { }; + http = { }; + feedreader.urls = [ "https://nixos.org/blogs.xml" ]; + }; + }; +} diff --git a/makefu/2configs/git/cgit-retiolum.nix b/makefu/2configs/git/cgit-retiolum.nix index 1109e2519..30d90f9e3 100644 --- a/makefu/2configs/git/cgit-retiolum.nix +++ b/makefu/2configs/git/cgit-retiolum.nix @@ -3,10 +3,15 @@ with import ; let - repos = priv-repos // krebs-repos // connector-repos ; + repos = priv-repos // krebs-repos // connector-repos // krebsroot-repos; rules = concatMap krebs-rules (attrValues krebs-repos) ++ concatMap priv-rules (attrValues priv-repos) - ++ concatMap connector-rules (attrValues connector-repos); + ++ concatMap connector-rules (attrValues connector-repos) + ++ concatMap krebsroot-rules (attrValues krebsroot-repos); + + krebsroot-repos = mapAttrs make-krebs-repo { + hydra-stockholm = { }; + }; krebs-repos = mapAttrs make-krebs-repo { stockholm = { @@ -28,7 +33,6 @@ let init-stockholm = { cgit.desc = "Init stuff for stockholm"; }; - hydra-stockholm = { }; }; priv-repos = mapAttrs make-priv-repo { @@ -70,6 +74,9 @@ let krebs-rules = repo: set-owners repo all-makefu ++ set-ro-access repo krebsminister; + krebsroot-rules = repo: + set-owners repo (all-makefu ++ krebsminister); + set-ro-access = with git; repo: user: optional repo.public { inherit user; diff --git a/makefu/2configs/hw/tp-x2x0.nix b/makefu/2configs/hw/tp-x2x0.nix index f33c12a8f..98fe30daf 100644 --- a/makefu/2configs/hw/tp-x2x0.nix +++ b/makefu/2configs/hw/tp-x2x0.nix @@ -38,7 +38,7 @@ with import ; services.tlp.enable = true; services.tlp.extraConfig = '' # BUG: http://linrunner.de/en/tlp/docs/tlp-faq.html#erratic-battery - START_CHARGE_THRESH_BAT0=67 + START_CHARGE_THRESH_BAT0=95 STOP_CHARGE_THRESH_BAT0=100 diff --git a/makefu/2configs/printer.nix b/makefu/2configs/printer.nix index 51e69d8b7..d5fa65ef9 100644 --- a/makefu/2configs/printer.nix +++ b/makefu/2configs/printer.nix @@ -9,6 +9,7 @@ in { pkgs.samsungUnifiedLinuxDriver pkgs.cups-dymo # dymo labelwriter pkgs.foo2zjs # magicolor 1690mf + pkgs.zj-58 ]; }; diff --git a/makefu/2configs/tools/mic92.nix b/makefu/2configs/tools/mic92.nix new file mode 100644 index 000000000..176e461c7 --- /dev/null +++ b/makefu/2configs/tools/mic92.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + nixpkgs.overlays = [ + (import ) + ]; + users.users.makefu.packages = [ + pkgs.nix-review + ]; +} diff --git a/makefu/3modules/awesome-extra.nix b/makefu/3modules/awesome-extra.nix index e4a79aa87..6f19f8f72 100644 --- a/makefu/3modules/awesome-extra.nix +++ b/makefu/3modules/awesome-extra.nix @@ -21,7 +21,9 @@ let This module will use substituteAll to replace strings before writing to /etc/xdg/awesome/rc.lua ''; - default = pkgs.awesomecfg.full; + default = pkgs.awesomecfg.full.override { + locker = "${pkgs.i3lock}/bin/i3lock -i /var/lib/wallpaper/wallpaper"; + }; }; }; imp = { diff --git a/makefu/5pkgs/awesomecfg/default.nix b/makefu/5pkgs/awesomecfg/default.nix index 7e9724ec8..e5f62e910 100644 --- a/makefu/5pkgs/awesomecfg/default.nix +++ b/makefu/5pkgs/awesomecfg/default.nix @@ -1,23 +1,23 @@ { pkgs , lib , alsaUtils -, xlockmore , xbacklight , modkey?"Mod4" +, locker? "${pkgs.xlock}/bin/xlock -mode blank" , ... }: { # replace: @alsaUtils@ @xlockmore@ @xbacklight@ @modkey@ full = lib.makeOverridable pkgs.substituteAll { name = "awesome_full_config"; - inherit alsaUtils xlockmore xbacklight modkey; + inherit alsaUtils locker xbacklight modkey; isExecutable = false; src = ./full.cfg; }; kiosk = lib.makeOverridable pkgs.substituteAll { name = "awesome_kiosk_config"; - inherit alsaUtils xlockmore xbacklight modkey; + inherit alsaUtils locker xbacklight modkey; isExecutable = false; src = ./kiosk.lua; }; diff --git a/makefu/5pkgs/awesomecfg/full.cfg b/makefu/5pkgs/awesomecfg/full.cfg index 3488d0102..e748981c6 100644 --- a/makefu/5pkgs/awesomecfg/full.cfg +++ b/makefu/5pkgs/awesomecfg/full.cfg @@ -243,7 +243,7 @@ awful.screen.connect_for_each_screen(function(s) set_wallpaper(s) -- Each screen has its own tag table. - awful.tag({ "tmp", "news", "www", "im", "work1","work2","net","misc","remote" }, s, awful.layout.layouts[1]) + awful.tag({ "tmp", "news", "www", "im", "work1","work2","net","misc","remote" }, s, awful.layout.layouts[1]) -- Create a promptbox for each screen s.mypromptbox = awful.widget.prompt() @@ -277,10 +277,10 @@ awful.screen.connect_for_each_screen(function(s) { -- Right widgets layout = wibox.layout.fixed.horizontal, mykeyboardlayout, - mailwidget, + mailwidget, wibox.widget.systray(), - cpuwidget, - batwidget, + cpuwidget, + batwidget, mytextclock, s.mylayoutbox, }, @@ -379,19 +379,19 @@ globalkeys = awful.util.table.join( -- Prompt awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, {description = "run prompt", group = "launcher"}), - awful.key({ modkey,"Control" }, "BackSpace", function () awful.util.spawn("@xlockmore@/bin/xlock -mode blank") end), - awful.key({ }, "XF86ScreenSaver", function () awful.util.spawn("@xlockmore@/bin/xlock -mode blank") end), + awful.key({ modkey,"Control" }, "BackSpace", function () awful.util.spawn("@locker@") end), + awful.key({ }, "XF86ScreenSaver", function () awful.util.spawn("@locker@") end), - awful.key({ modkey }, "x", - function () - awful.prompt.run { - prompt = "Run Lua code: ", - textbox = awful.screen.focused().mypromptbox.widget, - exe_callback = awful.util.eval, - history_path = awful.util.get_cache_dir() .. "/history_eval" - } - end, - {description = "lua execute prompt", group = "awesome"}), + awful.key({ modkey }, "x", + function () + awful.prompt.run { + prompt = "Run Lua code: ", + textbox = awful.screen.focused().mypromptbox.widget, + exe_callback = awful.util.eval, + history_path = awful.util.get_cache_dir() .. "/history_eval" + } + end, + {description = "lua execute prompt", group = "awesome"}), -- Menubar awful.key({ modkey }, "p", function() menubar.show() end) diff --git a/makefu/5pkgs/awesomecfg/kiosk.lua b/makefu/5pkgs/awesomecfg/kiosk.lua index ec255a8af..d0261f798 100644 --- a/makefu/5pkgs/awesomecfg/kiosk.lua +++ b/makefu/5pkgs/awesomecfg/kiosk.lua @@ -331,8 +331,8 @@ globalkeys = awful.util.table.join( -- Prompt awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end), -- awful.key({ modkey }, "r", function () awful.util.spawn( "dmenu_run" ) end ), - awful.key({ modkey,"Control" }, "BackSpace", function () awful.util.spawn("xlock -mode blank") end), - awful.key({ }, "XF86ScreenSaver", function () awful.util.spawn("xlock -mode blank") end), + awful.key({ modkey,"Control" }, "BackSpace", function () awful.util.spawn("@locker@") end), + awful.key({ }, "XF86ScreenSaver", function () awful.util.spawn("@locker@") end), awful.key({ modkey }, "x", function () diff --git a/makefu/5pkgs/nodemcu-uploader/default.nix b/makefu/5pkgs/nodemcu-uploader/default.nix index 64476be6e..f3e47be55 100644 --- a/makefu/5pkgs/nodemcu-uploader/default.nix +++ b/makefu/5pkgs/nodemcu-uploader/default.nix @@ -1,19 +1,22 @@ -{ lib, pkgs, pythonPackages, fetchurl, ... }: +{ lib, pkgs, pythonPackages, ... }: with pythonPackages; buildPythonPackage rec { name = "nodemcu-uploader-${version}"; - version = "0.2.2"; - disabled = isPy3k || isPyPy; + version = "0.4.1"; propagatedBuildInputs = [ pyserial + wrapt ]; - src = fetchurl { - url = "https://pypi.python.org/packages/source/n/nodemcu-uploader/nodemcu-uploader-${version}.tar.gz"; - sha256 = "090giz84y9y3idgifp0yh80qqyv2czv6h3y55wyrlgf7qfbwbrvn"; + + src = pkgs.fetchFromGitHub { + owner = "kmpm"; + repo = "nodemcu-uploader"; + rev = "v${version}"; + sha256 = "055pvlg544vb97kaqnnq51fs9f9g75vwgbazc293f3g1sk263gmn"; }; - # ImportError: No module named tests - # not sure what to do here + doCheck = false; + meta = { homepage = https://github.com/kmpm/nodemcu-uploader; description = "tool for uploading files to NodeMCU filesystem"; diff --git a/makefu/5pkgs/python-firetv/default.nix b/makefu/5pkgs/python-firetv/default.nix new file mode 100644 index 000000000..1fb772f1f --- /dev/null +++ b/makefu/5pkgs/python-firetv/default.nix @@ -0,0 +1,40 @@ +{ lib, pkgs, python2Packages, ... }: +# requires libusb1 from unstable +with (import {}).python2Packages; let + + python-adb = buildPythonPackage rec { + pname = "adb"; + version = "1.2.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "0v4my47ikgkbq04gdllpx6kql5cfh7dnpq2fk72x03z74mqri7v8"; + }; + + propagatedBuildInputs = [ libusb1 m2crypto ]; + meta = { + homepage = https://github.com/google/python-adb; + description = "Python ADB + Fastboot implementation"; + license = lib.licenses.asl20; + }; + }; +in + buildPythonPackage rec { + name = "python-firetv-${version}"; + version = "1.0.5"; + + src = pkgs.fetchFromGitHub { + owner = "happyleavesaoc"; + repo = "python-firetv"; + # rev = version; + rev = "55406c6"; + sha256 = "1r2yighilchs0jvcvbngkjxkk7gp588ikcl64x7afqzxc6zxv7wp"; + }; + + propagatedBuildInputs = [ python-adb flask pyyaml ]; + meta = { + homepage = https://github.com/happyleavesaoc/python-firetv; + description = "provides state informations and some control of an amazon firetv"; + license = lib.licenses.mit; + }; +} diff --git a/makefu/5pkgs/zj-58/default.nix b/makefu/5pkgs/zj-58/default.nix new file mode 100644 index 000000000..6eda84959 --- /dev/null +++ b/makefu/5pkgs/zj-58/default.nix @@ -0,0 +1,30 @@ +{stdenv, fetchFromGitHub, cups}: + +stdenv.mkDerivation rec { + name = "cups-zj58-2018-02-22"; + + src = fetchFromGitHub { + owner = "klirichek"; + repo = "zj-58"; + rev = "e4212cd"; + sha256 = "1w2qkspm4qqg5h8n6gmakzhiww7gag64chvy9kf89xsl3wsyp6pi"; + }; + + buildInputs = [cups]; + + installPhase = '' + mkdir -p $out/lib/cups/filter + + cp rastertozj $out/lib/cups/filter + + + mkdir -p $out/share/cups/model/zjiang + cp ZJ-58.ppd $out/share/cups/model/zjiang/ + ''; + + meta = { + description = "CUPS filter for thermal printer Zjiang ZJ-58"; + homepage = https://github.com/klirichek/zj-58; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/makefu/source.nix b/makefu/source.nix index 79a2c535f..6b32a1b40 100644 --- a/makefu/source.nix +++ b/makefu/source.nix @@ -1,12 +1,14 @@ with import ; host@{ name, - override ? {}, - secure ? false, - full ? false, - torrent ? false, - hw ? false, - musnix ? false, - python ? false + override ? {} +, secure ? false +, full ? false +, torrent ? false +, hw ? false +, musnix ? false +, python ? false +, unstable ? false #unstable channel checked out +, mic92 ? false }: let builder = if getEnv "dummy_secrets" == "true" @@ -19,7 +21,7 @@ let ]; }; # TODO: automate updating of this ref + cherry-picks - ref = "51810e0"; # nixos-17.09 @ 2018-02-14 + ref = "6b6e72b"; # nixos-17.09 @ 2018-03-07 # + do_sqlite3 ruby: 55a952be5b5 # + signal: 0f19beef3 @@ -59,21 +61,37 @@ in (mkIf ( hw ) { nixos-hardware.git = { url = https://github.com/nixos/nixos-hardware.git; - ref = "8a05dc9"; + ref = "30fdd53"; }; }) (mkIf ( python ) { python.git = { url = https://github.com/garbas/nixpkgs-python; - ref = "cac319b"; + ref = "cac319b7"; }; }) + (mkIf ( torrent ) { torrent-secrets.file = getAttr builder { buildbot = toString ; makefu = "/home/makefu/secrets/torrent" ; }; }) + + (mkIf ( unstable ) { + nixpkgs-unstable.git = { + url = https://github.com/nixos/nixpkgs-channels; + ref = "nixos-unstable"; + }; + }) + + (mkIf ( mic92 ) { + mic92.git = { + url = https://github.com/Mic92/dotfiles/; + ref = "48a1f49"; + }; + }) + override ]