diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/1systems/wolf.nix | 20 | ||||
-rw-r--r-- | shared/2configs/default.nix | 2 | ||||
-rw-r--r-- | shared/2configs/save-diskspace.nix | 11 | ||||
-rw-r--r-- | shared/2configs/shack/drivedroid.nix (renamed from shared/2configs/shack-drivedroid.nix) | 0 | ||||
-rw-r--r-- | shared/2configs/shack/mqtt_sub.nix | 34 | ||||
-rw-r--r-- | shared/2configs/shack/muell_caller.nix | 41 | ||||
-rw-r--r-- | shared/2configs/shack/nix-cacher.nix (renamed from shared/2configs/shack-nix-cacher.nix) | 0 | ||||
-rw-r--r-- | shared/2configs/shack/share.nix (renamed from shared/2configs/share-shack.nix) | 0 |
8 files changed, 102 insertions, 6 deletions
diff --git a/shared/1systems/wolf.nix b/shared/1systems/wolf.nix index 75307be..9acc589 100644 --- a/shared/1systems/wolf.nix +++ b/shared/1systems/wolf.nix @@ -6,19 +6,27 @@ in imports = [ ../. <nixpkgs/nixos/modules/profiles/qemu-guest.nix> - ../2configs/cgit-mirror.nix ../2configs/collectd-base.nix + ../2configs/shack/share.nix + ../2configs/central-stats-client.nix + ../2configs/save-diskspace.nix + + ../2configs/cgit-mirror.nix ../2configs/graphite.nix ../2configs/repo-sync.nix - ../2configs/shack-drivedroid.nix - ../2configs/shack-nix-cacher.nix ../2configs/shared-buildbot.nix - ../2configs/share-shack.nix - ../2configs/central-stats-client.nix + ../2configs/shack/drivedroid.nix + ../2configs/shack/nix-cacher.nix + + ../2configs/shack/mqtt_sub.nix + ../2configs/shack/muell_caller.nix + ]; # use your own binary cache, fallback use cache.nixos.org (which is used by # apt-cacher-ng in first place) + services.influxdb.enable = true; + # local discovery in shackspace nixpkgs.config.packageOverrides = pkgs: { tinc = pkgs.tinc_pre; }; krebs.tinc.retiolum.extraConfig = "TCPOnly = yes"; @@ -46,6 +54,7 @@ in networking = { firewall.enable = false; + firewall.allowedTCPPorts = [ 8088 8086 8083 ]; interfaces.enp0s3.ip4 = [{ address = shack-ip; prefixLength = 20; @@ -83,4 +92,5 @@ in ]; time.timeZone = "Europe/Berlin"; + sound.enable = false; } diff --git a/shared/2configs/default.nix b/shared/2configs/default.nix index e7f600c..894f8a9 100644 --- a/shared/2configs/default.nix +++ b/shared/2configs/default.nix @@ -11,7 +11,7 @@ with import <stockholm/lib>; nixos-config.symlink = "stockholm/${user.name}/1systems/${host.name}.nix"; nixpkgs.git = { url = https://github.com/NixOS/nixpkgs; - ref = "22da5d02466ffe465735986d705675982f3646a0"; # nixos-17.03 @ 2017-05-13 + ref = "58e227052d40021d82d015f3f8da011ae54ea430"; # nixos-17.03 @ 2017-05-24 }; secrets.file = if getEnv "dummy_secrets" == "true" diff --git a/shared/2configs/save-diskspace.nix b/shared/2configs/save-diskspace.nix new file mode 100644 index 0000000..ab074c7 --- /dev/null +++ b/shared/2configs/save-diskspace.nix @@ -0,0 +1,11 @@ +{lib, ... }: +# TODO: do not check out nixpkgs master but fetch revision from github +{ + environment.noXlibs = true; + nix.gc.automatic = true; + nix.gc.dates = lib.mkDefault "03:10"; + programs.info.enable = false; + programs.man.enable = false; + services.journald.extraConfig = "SystemMaxUse=50M"; + services.nixosManual.enable = false; +} diff --git a/shared/2configs/shack-drivedroid.nix b/shared/2configs/shack/drivedroid.nix index 12e4a39..12e4a39 100644 --- a/shared/2configs/shack-drivedroid.nix +++ b/shared/2configs/shack/drivedroid.nix diff --git a/shared/2configs/shack/mqtt_sub.nix b/shared/2configs/shack/mqtt_sub.nix new file mode 100644 index 0000000..dafa06b --- /dev/null +++ b/shared/2configs/shack/mqtt_sub.nix @@ -0,0 +1,34 @@ +{ config, lib, pkgs, ... }: + +with import <stockholm/lib>; +let + pkg = pkgs.stdenv.mkDerivation { + name = "mqtt2graphite-2017-05-29"; + src = pkgs.fetchgit { + url = "https://github.com/shackspace/mqtt2graphite/"; + rev = "8c060e6"; + sha256 = "06x7a1j6sfyvvdxg0366fcslhn478anqh4m5hljyf0z29knvz7pg"; + }; + buildInputs = [ + (pkgs.python35.withPackages (pythonPackages: with pythonPackages; [ + docopt + paho-mqtt + ])) + ]; + installPhase = '' + install -m755 -D sub.py $out/bin/sub + install -m755 -D sub2.py $out/bin/sub-new + ''; + }; +in { + systemd.services.mqtt_sub = { + description = "subscribe to mqtt, send to graphite"; + # after = [ (lib.optional config.services.mosqitto.enable "mosquitto.service") ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "nobody"; + ExecStart = "${pkg}/bin/sub-new"; + PrivateTmp = true; + }; + }; +} diff --git a/shared/2configs/shack/muell_caller.nix b/shared/2configs/shack/muell_caller.nix new file mode 100644 index 0000000..613ed2e --- /dev/null +++ b/shared/2configs/shack/muell_caller.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: + +with import <stockholm/lib>; +let + pkg = pkgs.stdenv.mkDerivation { + name = "muell_caller-2017-06-01"; + src = pkgs.fetchgit { + url = "https://github.com/shackspace/muell_caller/"; + rev = "bbd4009"; + sha256 = "06xaa1j6sfyvvdxg0366fcslhn478anqh4m5hljyf0z29knvz7pg"; + }; + buildInputs = [ + (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [ + docopt + requests + paramiko + python + ])) + ]; + installPhase = '' + install -m755 -D call.py $out/bin/call-muell + ''; + }; + cfg = "${toString <secrets>}/tell.json"; +in { + systemd.services.mqtt_sub = { + description = "call muell"; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "nobody"; # TODO separate user + ExecStartPre = writeDash "call-muell-pre" '' + cp ${cfg} /tmp/tell.json + chown nobody /tmp/tell.json + ''; + ExecStart = "${pkg}/bin/call-muell --cfg /tmp/tell.json --mode mpd loop 60"; + Restart = "always"; + PrivateTmp = true; + PermissionsStartOnly = true; + }; + }; +} diff --git a/shared/2configs/shack-nix-cacher.nix b/shared/2configs/shack/nix-cacher.nix index 4fcbf3a..4fcbf3a 100644 --- a/shared/2configs/shack-nix-cacher.nix +++ b/shared/2configs/shack/nix-cacher.nix diff --git a/shared/2configs/share-shack.nix b/shared/2configs/shack/share.nix index 247b9ee..247b9ee 100644 --- a/shared/2configs/share-shack.nix +++ b/shared/2configs/shack/share.nix |