From 669a7936fc75e377e840472d2b941fef382413b3 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 10 May 2017 16:47:58 +0200 Subject: m 2 vncserver: init --- makefu/2configs/vncserver.nix | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 makefu/2configs/vncserver.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/vncserver.nix b/makefu/2configs/vncserver.nix new file mode 100644 index 000000000..2e8e50feb --- /dev/null +++ b/makefu/2configs/vncserver.nix @@ -0,0 +1,30 @@ +{config,lib,pkgs, ...}: +with lib; +let + pwfile = (toString )+ "/vnc-password"; # create with `vncpasswd` + pwtmp = "/tmp/vnc-password"; + # nixos-unstable tigervnc is currently broken :\ + package = (import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-17.03.tar.gz) {}).pkgs.tigervnc; + User = "makefu"; + port = 5900; +in { + networking.firewall.allowedTCPPorts = [ port ]; + networking.firewall.allowedUDPPorts = [ port ]; + + systemd.services."terminal-server" = { + description = "Terminal Server"; + after = [ "display-manager.service" ]; + wantedBy = [ "graphical.target" ]; + serviceConfig = { + inherit User; + ExecStartPre = pkgs.writeDash "terminal-pre" '' + + set -eufx + install -m0700 -o ${User} ${pwfile} ${pwtmp} + ''; + ExecStart = "${package}/bin/x0vncserver -display :0 -rfbport ${toString port} -passwordfile ${pwtmp}"; + PermissionsStartOnly = true; + PrivateTmp = true; + }; + }; +} -- cgit v1.2.3 From 52329b41431de750131c3180b8ab72acfff5152c Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 11 May 2017 12:07:03 +0200 Subject: m 2 led-fader: init --- makefu/2configs/deployment/led-fader/default.nix | 27 ++++++++ makefu/2configs/deployment/led-fader/fade.py | 78 ++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 makefu/2configs/deployment/led-fader/default.nix create mode 100755 makefu/2configs/deployment/led-fader/fade.py (limited to 'makefu/2configs') diff --git a/makefu/2configs/deployment/led-fader/default.nix b/makefu/2configs/deployment/led-fader/default.nix new file mode 100644 index 000000000..fee741997 --- /dev/null +++ b/makefu/2configs/deployment/led-fader/default.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +with import ; +let + mq = "192.168.8.11"; +in { + systemd.services.led-fader = { + description = "Send led change to message queue"; + environment = { + NIX_PATH = "/var/src"; + }; + wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ + nix # nix-shell + mosquitto #mosquitto_pub + bash # nix-shell + ]; + serviceConfig = { + # User = "nobody"; # need a user with permissions to run nix-shell + ExecStart = pkgs.writeDash "run-fader" '' + ${./fade.py} --add-empty --mode chain 3 loop --skip-unchanged 0.002 0.1 \ + | mosquitto_pub -h ${mq} -p 1883 -l -t '/leds/nodemcu-switcher/set' + ''; + PrivateTmp = true; + }; + }; +} diff --git a/makefu/2configs/deployment/led-fader/fade.py b/makefu/2configs/deployment/led-fader/fade.py new file mode 100755 index 000000000..8178ad6e8 --- /dev/null +++ b/makefu/2configs/deployment/led-fader/fade.py @@ -0,0 +1,78 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i python3 -p python3 python35Packages.docopt +""" usage: run [options] NUMLEDS (loop [--skip-unchanged] [STEP] [DELAY]|single STARTVAL) + + --add-empty essentially add a single empty led in front, does not count into NUMLEDS + + --mode=TYPE mode of fading (Default: chain) + --output=TYPE output type, either json or raw (Default: json) + --skip-unchanged if the value in the loop is unchanged, skip the output + +running with loop this script essentially becomes a generator which outputs the +next value each "DELAY" +single returns a single output with STARTVAL as starting point for the first led + +NUMLEDS is the number of leds to output data for (--add-empty does not count in here) +STEP defaults to 0.01 +DELAY defaults to 1 second + +""" +from docopt import docopt +import time +from colorsys import hsv_to_rgb +import json +import sys + +def calc_chain(numleds,val): + divisor = 1.0 / numleds + ret = [] + for i in range(numleds): + v = float(divisor * i + val) % 1 + r,g,b = hsv_to_rgb(v,0.9,1) + ret.append([int(r*255), + int(g*255), + int(b*255)]) + return ret + +def calc_single(numleds,val): + ret = [] + for i in range(numleds): + r,g,b = hsv_to_rgb(val,1,1) + ret.append([int(r*255), + int(g*255), + int(b*255)]) + return ret + +def main(): + args = docopt(__doc__) + numleds = int(args['NUMLEDS']) + mode = args['--mode'] + step = float(args['STEP'] or 0.01) + delay = float(args['DELAY'] or 1) + val = float(args['STARTVAL'] or 0) + last = [] + while True: + if mode == "chain": + ret = calc_chain(numleds,val) + elif mode == "single": + ret = calc_single(numleds,val) + + if args['--add-empty']: + ret.insert(0,[0,0,0]) + + # early serialization makes comparsion easy + ret = json.dumps(ret) + if not (args['--skip-unchanged'] and last == ret): + last = ret + print(ret) + sys.stdout.flush() + if args['single']: + break + else: + val += step % 1 + time.sleep(delay) + + + +if __name__ == "__main__": + main() -- cgit v1.2.3 From d2f896842e59f2e8bdce44926b1bf49672c9c91f Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 11 May 2017 16:06:41 +0200 Subject: m 2 led-fader: rm ad-hoc script --- makefu/2configs/deployment/led-fader.nix | 27 ++++++++ makefu/2configs/deployment/led-fader/default.nix | 27 -------- makefu/2configs/deployment/led-fader/fade.py | 78 ------------------------ 3 files changed, 27 insertions(+), 105 deletions(-) create mode 100644 makefu/2configs/deployment/led-fader.nix delete mode 100644 makefu/2configs/deployment/led-fader/default.nix delete mode 100755 makefu/2configs/deployment/led-fader/fade.py (limited to 'makefu/2configs') diff --git a/makefu/2configs/deployment/led-fader.nix b/makefu/2configs/deployment/led-fader.nix new file mode 100644 index 000000000..fee741997 --- /dev/null +++ b/makefu/2configs/deployment/led-fader.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +with import ; +let + mq = "192.168.8.11"; +in { + systemd.services.led-fader = { + description = "Send led change to message queue"; + environment = { + NIX_PATH = "/var/src"; + }; + wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ + nix # nix-shell + mosquitto #mosquitto_pub + bash # nix-shell + ]; + serviceConfig = { + # User = "nobody"; # need a user with permissions to run nix-shell + ExecStart = pkgs.writeDash "run-fader" '' + ${./fade.py} --add-empty --mode chain 3 loop --skip-unchanged 0.002 0.1 \ + | mosquitto_pub -h ${mq} -p 1883 -l -t '/leds/nodemcu-switcher/set' + ''; + PrivateTmp = true; + }; + }; +} diff --git a/makefu/2configs/deployment/led-fader/default.nix b/makefu/2configs/deployment/led-fader/default.nix deleted file mode 100644 index fee741997..000000000 --- a/makefu/2configs/deployment/led-fader/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ config, lib, pkgs, ... }: - -with import ; -let - mq = "192.168.8.11"; -in { - systemd.services.led-fader = { - description = "Send led change to message queue"; - environment = { - NIX_PATH = "/var/src"; - }; - wantedBy = [ "multi-user.target" ]; - path = with pkgs; [ - nix # nix-shell - mosquitto #mosquitto_pub - bash # nix-shell - ]; - serviceConfig = { - # User = "nobody"; # need a user with permissions to run nix-shell - ExecStart = pkgs.writeDash "run-fader" '' - ${./fade.py} --add-empty --mode chain 3 loop --skip-unchanged 0.002 0.1 \ - | mosquitto_pub -h ${mq} -p 1883 -l -t '/leds/nodemcu-switcher/set' - ''; - PrivateTmp = true; - }; - }; -} diff --git a/makefu/2configs/deployment/led-fader/fade.py b/makefu/2configs/deployment/led-fader/fade.py deleted file mode 100755 index 8178ad6e8..000000000 --- a/makefu/2configs/deployment/led-fader/fade.py +++ /dev/null @@ -1,78 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell -i python3 -p python3 python35Packages.docopt -""" usage: run [options] NUMLEDS (loop [--skip-unchanged] [STEP] [DELAY]|single STARTVAL) - - --add-empty essentially add a single empty led in front, does not count into NUMLEDS - - --mode=TYPE mode of fading (Default: chain) - --output=TYPE output type, either json or raw (Default: json) - --skip-unchanged if the value in the loop is unchanged, skip the output - -running with loop this script essentially becomes a generator which outputs the -next value each "DELAY" -single returns a single output with STARTVAL as starting point for the first led - -NUMLEDS is the number of leds to output data for (--add-empty does not count in here) -STEP defaults to 0.01 -DELAY defaults to 1 second - -""" -from docopt import docopt -import time -from colorsys import hsv_to_rgb -import json -import sys - -def calc_chain(numleds,val): - divisor = 1.0 / numleds - ret = [] - for i in range(numleds): - v = float(divisor * i + val) % 1 - r,g,b = hsv_to_rgb(v,0.9,1) - ret.append([int(r*255), - int(g*255), - int(b*255)]) - return ret - -def calc_single(numleds,val): - ret = [] - for i in range(numleds): - r,g,b = hsv_to_rgb(val,1,1) - ret.append([int(r*255), - int(g*255), - int(b*255)]) - return ret - -def main(): - args = docopt(__doc__) - numleds = int(args['NUMLEDS']) - mode = args['--mode'] - step = float(args['STEP'] or 0.01) - delay = float(args['DELAY'] or 1) - val = float(args['STARTVAL'] or 0) - last = [] - while True: - if mode == "chain": - ret = calc_chain(numleds,val) - elif mode == "single": - ret = calc_single(numleds,val) - - if args['--add-empty']: - ret.insert(0,[0,0,0]) - - # early serialization makes comparsion easy - ret = json.dumps(ret) - if not (args['--skip-unchanged'] and last == ret): - last = ret - print(ret) - sys.stdout.flush() - if args['single']: - break - else: - val += step % 1 - time.sleep(delay) - - - -if __name__ == "__main__": - main() -- cgit v1.2.3 From d92281cf4dc8244076a9826f1586d287db5be9ef Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 11 May 2017 16:40:51 +0200 Subject: m 2 led-fader: use ampel --- makefu/2configs/deployment/led-fader.nix | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/deployment/led-fader.nix b/makefu/2configs/deployment/led-fader.nix index fee741997..a18416497 100644 --- a/makefu/2configs/deployment/led-fader.nix +++ b/makefu/2configs/deployment/led-fader.nix @@ -3,6 +3,26 @@ with import ; let mq = "192.168.8.11"; + + pkg = pkgs.stdenv.mkDerivation { + name = "ampel-master"; + src = pkgs.fetchgit { + url = "http://cgit.euer.krebsco.de/ampel"; + rev = "07a6791de368e16cc0864d2676fd255eba522cee"; + sha256 = "1jxjapvkfglvgapy7gjbr1nra3ay418nvz70bvypcmv7wc8d4h8q"; + }; + buildInputs = [ + (pkgs.python35.withPackages (pythonPackages: with pythonPackages; [ + docopt + paho-mqtt + ])) + ]; + installPhase = '' + install -m755 -D fade.py $out/bin/fade.py + install -m755 -D ampel.py $out/bin/ampel + install -m755 -D times.json $out/share/times.json + ''; + }; in { systemd.services.led-fader = { description = "Send led change to message queue"; @@ -10,17 +30,9 @@ in { NIX_PATH = "/var/src"; }; wantedBy = [ "multi-user.target" ]; - path = with pkgs; [ - nix # nix-shell - mosquitto #mosquitto_pub - bash # nix-shell - ]; serviceConfig = { # User = "nobody"; # need a user with permissions to run nix-shell - ExecStart = pkgs.writeDash "run-fader" '' - ${./fade.py} --add-empty --mode chain 3 loop --skip-unchanged 0.002 0.1 \ - | mosquitto_pub -h ${mq} -p 1883 -l -t '/leds/nodemcu-switcher/set' - ''; + ExecStart = "${pkg}/bin/ampel 4 ${pkg}/share/times.json"; PrivateTmp = true; }; }; -- cgit v1.2.3 From 1ec9f84c651e048705b0201c3dcc9547f63611d0 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 12 May 2017 11:29:46 +0200 Subject: m 2: mv base-gui gui/base --- makefu/2configs/base-gui.nix | 97 -------------------------------------- makefu/2configs/gui/base.nix | 97 ++++++++++++++++++++++++++++++++++++++ makefu/2configs/gui/studio.nix | 22 +++++++++ makefu/2configs/gui/urxvtd.nix | 21 +++++++++ makefu/2configs/gui/wbob-kiosk.nix | 23 +++++++++ makefu/2configs/main-laptop.nix | 2 +- makefu/2configs/urxvtd.nix | 21 --------- 7 files changed, 164 insertions(+), 119 deletions(-) delete mode 100644 makefu/2configs/base-gui.nix create mode 100644 makefu/2configs/gui/base.nix create mode 100644 makefu/2configs/gui/studio.nix create mode 100644 makefu/2configs/gui/urxvtd.nix create mode 100644 makefu/2configs/gui/wbob-kiosk.nix delete mode 100644 makefu/2configs/urxvtd.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/base-gui.nix b/makefu/2configs/base-gui.nix deleted file mode 100644 index 1a19ab36b..000000000 --- a/makefu/2configs/base-gui.nix +++ /dev/null @@ -1,97 +0,0 @@ -{ config, lib, pkgs, ... }: -## -# of course this name is a lie -# - it prepares a GUI environment close to my -# current configuration,specifically: -# -# * autologin with mainUser into awesome -# * audio -# * terminus font -# -# if this is not enough, check out main-laptop.nix - - -with import ; -let - mainUser = config.krebs.build.user.name; -in -{ - imports = [ - ./urxvtd.nix - ]; - - services.xserver = { - enable = true; - layout = "us"; - xkbVariant = "altgr-intl"; - xkbOptions = "ctrl:nocaps"; - - windowManager = { - awesome.enable = true; - awesome.luaModules = [ pkgs.luaPackages.vicious ]; - default = "awesome"; - }; - - displayManager.auto.enable = true; - displayManager.auto.user = mainUser; - desktopManager.xterm.enable = false; - }; - # lid switch is handled via button presses - services.logind.extraConfig = mkDefault "HandleLidSwitch=ignore"; - makefu.awesome.enable = true; - i18n.consoleFont = "Lat2-Terminus16"; - - fonts = { - enableCoreFonts = true; - enableFontDir = true; - enableGhostscriptFonts = true; - fonts = [ pkgs.terminus_font ]; - }; - - environment.systemPackages = with pkgs;[ - pavucontrol - xlockmore - rxvt_unicode-with-plugins - firefox - ]; - users.extraUsers.${mainUser}.extraGroups = [ "audio" ]; - - hardware.pulseaudio = { - enable = true; - systemWide = true; - }; - services.xserver.displayManager.sessionCommands = let - xdefaultsfile = pkgs.writeText "Xdefaults" '' - cat |derp <; +let + mainUser = config.krebs.build.user.name; +in +{ + imports = [ + ./urxvtd.nix + ]; + + services.xserver = { + enable = true; + layout = "us"; + xkbVariant = "altgr-intl"; + xkbOptions = "ctrl:nocaps"; + + windowManager = { + awesome.enable = true; + awesome.luaModules = [ pkgs.luaPackages.vicious ]; + default = "awesome"; + }; + + displayManager.auto.enable = true; + displayManager.auto.user = mainUser; + desktopManager.xterm.enable = false; + }; + # lid switch is handled via button presses + services.logind.extraConfig = mkDefault "HandleLidSwitch=ignore"; + makefu.awesome.enable = true; + i18n.consoleFont = "Lat2-Terminus16"; + + fonts = { + enableCoreFonts = true; + enableFontDir = true; + enableGhostscriptFonts = true; + fonts = [ pkgs.terminus_font ]; + }; + + environment.systemPackages = with pkgs;[ + pavucontrol + xlockmore + rxvt_unicode-with-plugins + firefox + ]; + users.extraUsers.${mainUser}.extraGroups = [ "audio" ]; + + hardware.pulseaudio = { + enable = true; + systemWide = true; + }; + services.xserver.displayManager.sessionCommands = let + xdefaultsfile = pkgs.writeText "Xdefaults" '' + cat |derp < Date: Fri, 12 May 2017 11:31:46 +0200 Subject: m 2 audio: init --- makefu/2configs/audio/jack-on-pulse.nix | 45 ++++++++++++++++++++++++++++++++ makefu/2configs/audio/realtime-audio.nix | 12 +++++++++ makefu/2configs/sources/default.nix | 7 +++++ makefu/2configs/sources/musnix.nix | 6 +++++ 4 files changed, 70 insertions(+) create mode 100644 makefu/2configs/audio/jack-on-pulse.nix create mode 100644 makefu/2configs/audio/realtime-audio.nix create mode 100644 makefu/2configs/sources/default.nix create mode 100644 makefu/2configs/sources/musnix.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/audio/jack-on-pulse.nix b/makefu/2configs/audio/jack-on-pulse.nix new file mode 100644 index 000000000..09d03ea9f --- /dev/null +++ b/makefu/2configs/audio/jack-on-pulse.nix @@ -0,0 +1,45 @@ +{ config, pkgs, ... }: +let + pulse = pkgs.pulseaudioFull; + user = config.makefu.gui.user; +in +{ + sound.enable = true; + hardware.pulseaudio = { + enable = true; + package = pulse; + }; + + environment.systemPackages = with pkgs; [ jack2Full ]; + # from http://anderspapitto.com/posts/2015-11-26-overtone-on-nixos-with-jack-and-pulseaudio.html + + systemd.services = { + jackdbus = { + description = "Runs jack, and points pulseaudio at it"; + serviceConfig = { + User = user; + Type = "oneshot"; + ExecStart = pkgs.writeScript "start_jack.sh" '' + #! ${pkgs.bash}/bin/bash + . ${config.system.build.setEnvironment} + sleep 5 # wait for the gui to load + + ${pkgs.jack2Full}/bin/jack_control start + sleep 3 # give some time for sources/sinks to be created + + ${pulse}/bin/pacmd set-default-sink jack_out + ${pulse}/bin/pacmd set-default-source jack_in + ''; + ExecStop = pkgs.writeScript "stop_jack.sh" '' + #! ${pkgs.bash}/bin/bash + . ${config.system.build.setEnvironment} + + ${pkgs.jack2Full}/bin/jack_control stop + ''; + RemainAfterExit = true; + }; + after = [ "display-manager.service" "sound.target" ]; + wantedBy = [ "multi-user.target" ]; + }; + }; +} diff --git a/makefu/2configs/audio/realtime-audio.nix b/makefu/2configs/audio/realtime-audio.nix new file mode 100644 index 000000000..d9709e4b7 --- /dev/null +++ b/makefu/2configs/audio/realtime-audio.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: +let + user = config.makefu.gui.user; +in +{ + imports = [ + ../sources/musnix.nix # populate musnix + + ]; + musnix.enable = true; + users.users."${user}".extraGroups = [ "audio" ]; +} diff --git a/makefu/2configs/sources/default.nix b/makefu/2configs/sources/default.nix new file mode 100644 index 000000000..232117aec --- /dev/null +++ b/makefu/2configs/sources/default.nix @@ -0,0 +1,7 @@ +# the builder pc (my laptop) will also require the sources i use to deploy +# other boxes +{ + imports = [ + ./musnix.nix + ]; +} diff --git a/makefu/2configs/sources/musnix.nix b/makefu/2configs/sources/musnix.nix new file mode 100644 index 000000000..d02dd4a48 --- /dev/null +++ b/makefu/2configs/sources/musnix.nix @@ -0,0 +1,6 @@ +{ + krebs.build.source.musnix.git = { + url = https://github.com/musnix/musnix.git; + ref = "37a8378"; + }; +} -- cgit v1.2.3 From 89b254d485c8babbd7c4f329c52681dd9cc1a8e2 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 12 May 2017 11:32:12 +0200 Subject: m 2 backup: provide borgbackup --- makefu/2configs/backup.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/backup.nix b/makefu/2configs/backup.nix index 9ed890326..1cc78bfc1 100644 --- a/makefu/2configs/backup.nix +++ b/makefu/2configs/backup.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: with import ; let # preparation: @@ -32,4 +32,7 @@ in { # wry-to-omo_root = defaultPull config.krebs.hosts.wry "/"; gum-to-omo_root = defaultPull config.krebs.hosts.gum "/"; }; + environment.systemPackages = [ + pkgs.borgbackup + ]; } -- cgit v1.2.3 From 1f9ddd9c6f8cdd9ce1b5a6bb9dc65475e2a90e62 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 12 May 2017 11:34:41 +0200 Subject: m 2 avahi: init --- makefu/2configs/avahi.nix | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 makefu/2configs/avahi.nix (limited to 'makefu/2configs') diff --git a/makefu/2configs/avahi.nix b/makefu/2configs/avahi.nix new file mode 100644 index 000000000..59f59fd80 --- /dev/null +++ b/makefu/2configs/avahi.nix @@ -0,0 +1,8 @@ +{ pkgs, ...}: +{ + services.avahi = { + enable = true; + wideArea = false; + }; + environment.systemPackages = [ pkgs.avahi ]; +} -- cgit v1.2.3 From 4c2408763eec98ec9cecf340dccfffa34a0c3cb0 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 12 May 2017 11:35:35 +0200 Subject: m: init and use 'makefu.gui.user' --- makefu/2configs/vncserver.nix | 70 +++++++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 19 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/vncserver.nix b/makefu/2configs/vncserver.nix index 2e8e50feb..c56b3e294 100644 --- a/makefu/2configs/vncserver.nix +++ b/makefu/2configs/vncserver.nix @@ -5,26 +5,58 @@ let pwtmp = "/tmp/vnc-password"; # nixos-unstable tigervnc is currently broken :\ package = (import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-17.03.tar.gz) {}).pkgs.tigervnc; - User = "makefu"; - port = 5900; + user = config.makefu.gui.user; + vnc_port = 5900; + web_port = 6080; in { - networking.firewall.allowedTCPPorts = [ port ]; - networking.firewall.allowedUDPPorts = [ port ]; + networking.firewall.allowedTCPPorts = [ 80 vnc_port web_port ]; + systemd.services = { + terminal-server = { + description = "VNC Terminal Server"; + after = [ "display-manager.service" "graphical.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = user; + Restart = "always"; + ExecStartPre = pkgs.writeDash "terminal-pre" '' + sleep 5 + install -m0700 -o ${user} ${pwfile} ${pwtmp} + ''; + ExecStart = "${package}/bin/x0vncserver -display :0 -rfbport ${toString vnc_port} -passwordfile ${pwtmp}"; + PermissionsStartOnly = true; + PrivateTmp = true; + }; + }; + terminal-web = { + description = "noVNC Web Server"; + after = [ "terminal-server.service" "graphical.target" "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "nobody"; + ExecStart = "${pkgs.novnc}/bin/launch-novnc.sh --listen ${toString web_port} --vnc localhost:${toString vnc_port}"; + PrivateTmp = true; + }; + }; + }; + services.nginx.enable = true; + services.nginx.virtualHosts._.locations = { + "/" = { + root = "${pkgs.novnc}"; + index = "vnc_auto.html"; + }; + "/websockify" = { + proxyPass = "http://127.0.0.1:6080/"; + extraConfig = '' + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; - systemd.services."terminal-server" = { - description = "Terminal Server"; - after = [ "display-manager.service" ]; - wantedBy = [ "graphical.target" ]; - serviceConfig = { - inherit User; - ExecStartPre = pkgs.writeDash "terminal-pre" '' - - set -eufx - install -m0700 -o ${User} ${pwfile} ${pwtmp} + # VNC connection timeout + proxy_read_timeout 61s; + + # Disable cache + proxy_buffering off; ''; - ExecStart = "${package}/bin/x0vncserver -display :0 -rfbport ${toString port} -passwordfile ${pwtmp}"; - PermissionsStartOnly = true; - PrivateTmp = true; - }; - }; + }; + }; } -- cgit v1.2.3 From d60e92f04b3b04deb2e638ab0f602094578ad71d Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 12 May 2017 11:37:00 +0200 Subject: m 2 git: init ampel --- makefu/2configs/git/cgit-retiolum.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'makefu/2configs') diff --git a/makefu/2configs/git/cgit-retiolum.nix b/makefu/2configs/git/cgit-retiolum.nix index 81a5cde81..96b6c303d 100644 --- a/makefu/2configs/git/cgit-retiolum.nix +++ b/makefu/2configs/git/cgit-retiolum.nix @@ -19,6 +19,7 @@ let cgit.desc = "Build new Stockholm hosts"; }; cac-api = { }; + ampel = { }; init-stockholm = { cgit.desc = "Init stuff for stockholm"; }; -- cgit v1.2.3 From 4519913a656b5aad1a53e012e2622fd9884dd518 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 12 May 2017 11:37:20 +0200 Subject: m 2 default: bump to c5badb1 --- makefu/2configs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/default.nix b/makefu/2configs/default.nix index 6cc891047..07f4a0543 100644 --- a/makefu/2configs/default.nix +++ b/makefu/2configs/default.nix @@ -22,7 +22,7 @@ with import ; user = config.krebs.users.makefu; source = let inherit (config.krebs.build) host user; - ref = "4fac473"; # unstable @ 2017-03-31 + command-not-found + ref = "c5badb1"; # unstable @ 2017-05-09 in { nixpkgs = if config.makefu.full-populate || (getEnv "dummy_secrets" == "true") then { -- cgit v1.2.3 From 39c264108329a412446c091852dd5a655da38b27 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 12 May 2017 15:37:11 +0200 Subject: m 2 default: bump to 0afb6d7 fixes virt-manager broken build --- makefu/2configs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/default.nix b/makefu/2configs/default.nix index 07f4a0543..7d0faae94 100644 --- a/makefu/2configs/default.nix +++ b/makefu/2configs/default.nix @@ -22,7 +22,7 @@ with import ; user = config.krebs.users.makefu; source = let inherit (config.krebs.build) host user; - ref = "c5badb1"; # unstable @ 2017-05-09 + ref = "0afb6d7"; # unstable @ 2017-05-09 in { nixpkgs = if config.makefu.full-populate || (getEnv "dummy_secrets" == "true") then { -- cgit v1.2.3 From 1aa20d39d7361a7f1555191997496011a307ef3f Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 15 May 2017 22:52:48 +0200 Subject: m 2 urlwatch: follow msf --- makefu/2configs/urlwatch.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'makefu/2configs') diff --git a/makefu/2configs/urlwatch.nix b/makefu/2configs/urlwatch.nix index d1dcec657..9493b2b7b 100644 --- a/makefu/2configs/urlwatch.nix +++ b/makefu/2configs/urlwatch.nix @@ -20,6 +20,7 @@ https://api.github.com/repos/dorimanx/exfat-nofuse/commits https://api.github.com/repos/dorimanx/exfat-nofuse/tags https://api.github.com/repos/radare/radare2/tags + https://api.github.com/repos/rapid7/metasploit-framework/tags ]; }; } -- cgit v1.2.3 From 56116a4dfa7369787c4f09ed2bb8a2cfd3ed976f Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 15 May 2017 22:53:13 +0200 Subject: m 2 default: fix nixpkgs requests2 fuckup --- makefu/2configs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/default.nix b/makefu/2configs/default.nix index 7d0faae94..0d61e8dee 100644 --- a/makefu/2configs/default.nix +++ b/makefu/2configs/default.nix @@ -22,7 +22,7 @@ with import ; user = config.krebs.users.makefu; source = let inherit (config.krebs.build) host user; - ref = "0afb6d7"; # unstable @ 2017-05-09 + ref = "a772c3a"; # unstable @ 2017-05-09 + graceful requests2 in { nixpkgs = if config.makefu.full-populate || (getEnv "dummy_secrets" == "true") then { -- cgit v1.2.3 From c82f8db1ce718ae927e6e47173114c255c9883fa Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 16 May 2017 14:30:14 +0200 Subject: m 2 realtime-audio:enable optimization --- makefu/2configs/audio/realtime-audio.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'makefu/2configs') diff --git a/makefu/2configs/audio/realtime-audio.nix b/makefu/2configs/audio/realtime-audio.nix index d9709e4b7..fbeacd025 100644 --- a/makefu/2configs/audio/realtime-audio.nix +++ b/makefu/2configs/audio/realtime-audio.nix @@ -8,5 +8,9 @@ in ]; musnix.enable = true; + musnix.kernel.optimize = true; + musnix.kernel.realtime = true; + # TODO: musnix.kernel.packages = pkgs.linuxPackages_latest_rt; + users.users."${user}".extraGroups = [ "audio" ]; } -- cgit v1.2.3 From 514dda7d1ea2757f0989cb5dcb20d49a5e29a76f Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 16 May 2017 16:49:40 +0200 Subject: m 2 wiki-irc: also notify #nixos --- makefu/2configs/deployment/wiki-irc.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'makefu/2configs') diff --git a/makefu/2configs/deployment/wiki-irc.nix b/makefu/2configs/deployment/wiki-irc.nix index a7527f796..dc7c8afe8 100644 --- a/makefu/2configs/deployment/wiki-irc.nix +++ b/makefu/2configs/deployment/wiki-irc.nix @@ -40,9 +40,9 @@ in { file { path => "/tmp/logs.json" codec => "json_lines" } if [output] { irc { - channels => [ "#krebs" ] + channels => [ "#nixos" , "#krebs" ] host => "irc.freenode.net" - nick => "nixos-wiki" + nick => "nixos-users-wiki" format => "%{output}" } } -- cgit v1.2.3