From 1f6ba2a01d8ef041323fcb847a0c445365307182 Mon Sep 17 00:00:00 2001 From: jeschli Date: Tue, 29 Jan 2019 19:59:59 +0100 Subject: [PATCH 01/68] xmonad-stockholm: arguments in one line --- krebs/5pkgs/haskell/xmonad-stockholm.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/krebs/5pkgs/haskell/xmonad-stockholm.nix b/krebs/5pkgs/haskell/xmonad-stockholm.nix index 228d365a3..1b197b914 100644 --- a/krebs/5pkgs/haskell/xmonad-stockholm.nix +++ b/krebs/5pkgs/haskell/xmonad-stockholm.nix @@ -1,5 +1,4 @@ -{ mkDerivation, base, containers, fetchgit, filepath, stdenv, unix, X11, X11-xft -, X11-xshape, xmonad, xmonad-contrib +{ mkDerivation, base, containers, fetchgit, filepath, stdenv, unix, X11, X11-xft , X11-xshape, xmonad, xmonad-contrib }: mkDerivation rec { pname = "xmonad-stockholm"; From b4ad768b786401734064eb747d17dbe68b785faa Mon Sep 17 00:00:00 2001 From: jeschli Date: Tue, 29 Jan 2019 20:00:28 +0100 Subject: [PATCH 02/68] j krops: fix directory --- jeschli/krops.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/jeschli/krops.nix b/jeschli/krops.nix index 989abcdd0..dbf94bd0d 100644 --- a/jeschli/krops.nix +++ b/jeschli/krops.nix @@ -12,10 +12,7 @@ secrets = if test then { file = toString ./2configs/tests/dummy-secrets; } else { - pass = { - dir = "${lib.getEnv "HOME"}/.password-store"; - name = "hosts/${name}"; - }; + file = "${lib.getEnv "HOME"}/secrets/${name}"; }; } ]; From 6f466e7ab6aaf4786a84682002c929672201a120 Mon Sep 17 00:00:00 2001 From: jeschli Date: Tue, 5 Feb 2019 19:19:09 +0100 Subject: [PATCH 03/68] j brauerei: remove commented dead code --- jeschli/1systems/brauerei/config.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index d342acb64..f7f545294 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -7,6 +7,9 @@ in ./hardware-configuration.nix +# +# +# ]; @@ -147,8 +150,17 @@ in ''; } ]; - }; +# xmonad = { +# enable = true; +# enableContribAndExtras = true; +# extraPackages = haskellPackages: [ +# haskellPackages.xmonad-contrib +# haskellPackages.xmonad-extras +# haskellPackages.xmonad +# ]; +# } + }; }; users.extraUsers.jeschli = { # TODO: define as krebs.users From b1b20cb683a103bd89710f5eabce8209c5041542 Mon Sep 17 00:00:00 2001 From: jeschli Date: Tue, 5 Feb 2019 19:19:29 +0100 Subject: [PATCH 04/68] j brauerei: remove not working tokei override --- jeschli/1systems/brauerei/config.nix | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index f7f545294..7ac4cc2c0 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -109,14 +109,7 @@ in # xorg xorg.xbacklight # tokei - tokei = overrideDerivation super.tokei (old: { - patches = old.patches or [] ++ [ - (self.fetchurl { - url = https://github.com/4z3/tokei/commit/c27529c.patch; - sha256 = "1rdw8bk379cav603ryrb57yfkvk2z8wavfw9prfh01agk3ml693x"; - }) - ]; - }); + tokei ]; # Some programs need SUID wrappers, can be configured further or are From 17712c90772d68f174f579e570fa23a8fa674245 Mon Sep 17 00:00:00 2001 From: jeschli Date: Tue, 5 Feb 2019 19:20:17 +0100 Subject: [PATCH 05/68] j xserver: add dbus magic for xserver (xserver/default.nix not working currently) --- jeschli/2configs/xserver/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jeschli/2configs/xserver/default.nix b/jeschli/2configs/xserver/default.nix index ec3977c7e..44c35ca37 100644 --- a/jeschli/2configs/xserver/default.nix +++ b/jeschli/2configs/xserver/default.nix @@ -51,6 +51,12 @@ in { ${pkgs.xorg.xmodmap}/bin/xmodmap ${import ./Xmodmap.nix args} & ${pkgs.xorg.xrdb}/bin/xrdb ${import ./Xresources.nix args} & ${pkgs.xorg.xsetroot}/bin/xsetroot -solid '#1c1c1c' & + ${config.services.xserver.displayManager.sessionCommands} + if test -z "$DBUS_SESSION_BUS_ADDRESS"; then + exec ${pkgs.dbus.dbus-launch} --exit-with-session "$0" "" + fi + export DBUS_SESSION_BUS_ADDRESS + ${config.systemd.package}/bin/systemctl --user import-environment DISPLAY DBUS_SESSION_BUS_ADDRESS wait ''; From cb03267e0c3fd3bfa4beaa454f8986856a93963f Mon Sep 17 00:00:00 2001 From: jeschli Date: Tue, 9 Apr 2019 20:08:44 +0200 Subject: [PATCH 06/68] j brauerei: +clion --- jeschli/1systems/brauerei/config.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index b9bb021b8..367091e2c 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -92,9 +92,11 @@ in }) # dev tools gnumake + jetbrains.clion jetbrains.goland jetbrains.pycharm-professional jetbrains.webstorm + vscode # document viewer evince zathura @@ -105,7 +107,6 @@ in cargo rustracer rustup - vscode # orga tools taskwarrior # xorg From 32cfe97d08540178c0119ec66d4a39f673000adb Mon Sep 17 00:00:00 2001 From: jeschli Date: Thu, 25 Apr 2019 11:47:04 +0200 Subject: [PATCH 07/68] j brauerei: -steam (broken?) --- jeschli/1systems/brauerei/config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index 367091e2c..8ad53f761 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -10,7 +10,7 @@ in # # # - +# ]; From 78ed3c69552cc05e2992d556914ca079892668dc Mon Sep 17 00:00:00 2001 From: jeschli Date: Thu, 25 Apr 2019 11:47:24 +0200 Subject: [PATCH 08/68] j brauerei: +gnupg --- jeschli/1systems/brauerei/config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index 8ad53f761..a41e2b8d8 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -55,6 +55,7 @@ in curl dmenu git + gnupg i3lock keepass networkmanagerapplet From 18faf72684087fc91a689131ce56448393dae129 Mon Sep 17 00:00:00 2001 From: jeschli Date: Thu, 25 Apr 2019 11:50:00 +0200 Subject: [PATCH 09/68] j brauerei: configs/vim.nix (broken) -> standard vim --- jeschli/2configs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jeschli/2configs/default.nix b/jeschli/2configs/default.nix index 5aaabe24b..8b61fa29c 100644 --- a/jeschli/2configs/default.nix +++ b/jeschli/2configs/default.nix @@ -2,7 +2,7 @@ with import ; { imports = [ - ./vim.nix +# ./vim.nix ./retiolum.nix ./zsh.nix @@ -56,7 +56,7 @@ with import ; usbutils # logify goify - + vim #unpack stuff p7zip unzip From 271d8e8a204484de383a8151325033b8187eca8b Mon Sep 17 00:00:00 2001 From: jeschli Date: Sat, 27 Apr 2019 17:05:31 +0200 Subject: [PATCH 10/68] j brauerei: +user blafoo --- jeschli/1systems/brauerei/config.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index a41e2b8d8..b8b2b66bc 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -157,6 +157,11 @@ in extraGroups = ["docker" "vboxusers" "audio"]; uid = 1000; }; + users.extraUsers.blafoo = { + isNormalUser = true; + extraGroups = ["audio"]; + uid = 1002; + }; users.extraUsers.jamie = { isNormalUser = true; uid = 1001; # TODO genid From 97d4f9a771a9bbb1b45085569028db2d7dfbd610 Mon Sep 17 00:00:00 2001 From: jeschli Date: Sun, 28 Apr 2019 15:02:20 +0200 Subject: [PATCH 11/68] j enklave: allowed port 8001 --- jeschli/1systems/enklave/config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jeschli/1systems/enklave/config.nix b/jeschli/1systems/enklave/config.nix index cadec3cab..86d21f7d3 100644 --- a/jeschli/1systems/enklave/config.nix +++ b/jeschli/1systems/enklave/config.nix @@ -49,7 +49,7 @@ listenPort = 53589; organisations.lass.users = [ "jeschli" ]; }; - networking.firewall.allowedTCPPorts = [ 53589 ]; + networking.firewall.allowedTCPPorts = [ 53589 8001 ]; } ]; From 5c6a0a6e0077e51af57811be225f1553243997dc Mon Sep 17 00:00:00 2001 From: jeschli Date: Wed, 1 May 2019 21:35:46 +0200 Subject: [PATCH 12/68] j config: add qubasa's i3 config --- jeschli/2configs/window-manager.nix | 1078 +++++++++++++++++++++++++++ 1 file changed, 1078 insertions(+) create mode 100644 jeschli/2configs/window-manager.nix diff --git a/jeschli/2configs/window-manager.nix b/jeschli/2configs/window-manager.nix new file mode 100644 index 000000000..23c958df4 --- /dev/null +++ b/jeschli/2configs/window-manager.nix @@ -0,0 +1,1078 @@ +{pkgs, environment, config, lib, ... }: + +with pkgs; + +let + + bar_update_interval = "1"; # Option + + i3_status_script = pkgs.writeScript "i3script.sh" '' + #!/bin/sh + + # First time without wifi, because it blocks a long time + BAR="$(${temp_status})" + BAR+=" | $(${avail_disk})" + BAR+=" | $(${volume_status})" + BAR+=" | $(${brightness_status})" + BAR+=" | $(${vpn_status})" + BAR+=" | $(${eth_status})" + BAR+=" | Wifi " + BAR+=" | $(${date_status})" + BAR+=" | $(${battery_status})" + + echo "$BAR" + + while true; do + BAR="$(${temp_status})" + BAR+=" | $(${avail_disk})" + BAR+=" | $(${volume_status})" + BAR+=" | $(${brightness_status})" + BAR+=" | $(${vpn_status})" + BAR+=" | $(${eth_status})" + BAR+=" | $(${wifi_status})" + BAR+=" | $(${date_status})" + BAR+=" | $(${battery_status})" + + echo "$BAR" + sleep ${bar_update_interval} + done + + ''; + + # TODO: Change name if you have a different vpn interface name + vpn_status = pkgs.writeScript "vpn_status.sh" '' + #!/bin/sh + + export PATH="$PATH:${gawk}/bin:${acpi}/bin:${coreutils}/bin:${gnugrep}/bin:${calc}/bin" + + VPN="" + if [ -e "/proc/sys/net/ipv4/conf/labs-vpn" ]; then + VPN="Labs-VPN" + elif [ -e "/proc/sys/net/ipv4/conf/office-vpn" ]; then + VPN="Office-VPN" + elif [ -e "/proc/sys/net/ipv4/conf/tun0" ]; then + VPN="UKN-VPN" + elif [ -e "/proc/sys/net/ipv4/conf/wireguard-home" ]; then + VPN="Home-VPN" + fi + + if [ "$VPN" = "" ]; then + echo "VPN " + else + echo "$VPN " + fi + ''; + + avail_disk = pkgs.writeScript "avail_disk.sh" '' + #!/bin/sh + export PATH="$PATH:${gawk}/bin:${coreutils}/bin:${gnugrep}/bin" + + avail=$(df / -h | tail -n1| awk '{print $(NF-2) }') + echo "$avail " + ''; + + wifi_status = pkgs.writeScript "wifi_status.sh" '' + #!/bin/sh + + export PATH="$PATH:${gawk}/bin:${coreutils}/bin:${gnugrep}/bin:${wirelesstools}/bin" + + ssid=$(iwgetid -r) + quality=$(cat /proc/net/wireless | tail -n1 | awk '{ print $3}' | sed 's/\.//g')dB + + if [ "$ssid" = "" ]; then + echo "Wifi " + else + echo "$quality at $ssid " + fi + ''; + + + eth_status = pkgs.writeScript "eth_status.sh" '' + #!/bin/sh + + export PATH="$PATH:${gawk}/bin:${coreutils}/bin:${gnugrep}/bin:${iproute}/bin" + + first_eth=$(for i in /proc/sys/net/ipv4/conf/enp*; do basename "$i"; break; done) + status=$(ip link show dev "$first_eth" | head -n1 | awk '{ print $9 }') + + if [ "$status" = "DOWN" ]; then + echo "" + else + ip_addr=$(ip address show "$first_eth" | grep inet | head -n1 | awk '{ print $2 }' | sed 's/\/24//g') + echo "$ip_addr " + fi + + ''; + + volume_status = pkgs.writeScript "volume_status.sh" '' + #!/bin/sh + + export PATH="$PATH:${gawk}/bin:${coreutils}/bin:${gnugrep}/bin:${alsaUtils}/bin" + + status=$(amixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $4 }') + volume=$(amixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $2 }') + + if [ "$status" = "off" ]; then + echo "Muted " + else + echo "$volume " + fi + ''; + + date_status = pkgs.writeScript "date_status.sh" '' + #!/bin/sh + + export PATH="$PATH:${gawk}/bin:${coreutils}/bin:${gnugrep}/bin" + + echo "$(date +'%d.%m.%Y  %H:%M')" + ''; + + temp_status = pkgs.writeScript "temp_status.sh" '' + #!/bin/sh + + export PATH="$PATH:${gawk}/bin:${acpi}/bin:${coreutils}/bin:${gnugrep}/bin:${calc}/bin" + + temp=$(acpi -t | awk '{print $4}' | calc -p) + echo "$temp " + ''; + + brightness_status = pkgs.writeScript "brightness_status.sh" '' + #!/bin/sh + + brightness=$(${pkgs.acpilight}/bin/xbacklight -get) + echo "$brightness% " + ''; + + battery_status = with pkgs; pkgs.writeScript "battery_status.bash" '' + #!${pkgs.bash}/bin/bash + export PATH="$PATH:${gawk}/bin:${acpi}/bin:${coreutils}/bin:${gnugrep}/bin:${calc}/bin" + + get_battery_charging_status() { + if [ "$(acpi -b | grep Discharging)" != "" ]; then + echo "Discharging"; + else + echo "Charging"; + fi + } + declare -a capacity_arr + capacity_arr=( +  +  +  +  +  + ) + + # get charge of all batteries, combine them + total_charge=$(acpi -b | awk '{print $4}' | grep -Eo "[0-9]+" | paste -sd+ | calc -p); + + # get amount of batteries in the device + battery_number=$(acpi -b | wc -l); + percent=$((total_charge / battery_number)); + index=$((percent / ( 100 / ''${#capacity_arr[@]}) )) + + if [ "$(get_battery_charging_status)" == "Charging" ]; then + echo "$percent% " + else + echo "$percent% ''${capacity_arr[$index]}" + fi + ''; + + random-wallpaper = pkgs.writeScript "random-wallpaper.sh" '' + #!/bin/sh + file=$(find ${config.wallpapers} -type f -print0 | shuf -z -n 1) + ${pkgs.feh}/bin/feh --bg-scale "$file" + ''; + + reload_layout = pkgs.writeScript "reload_layout.sh" '' + #!/bin/sh + pkill gnome-terminal + + i3-msg append_layout ${shell_layout} + + for i in {1..16} + do + gnome-terminal & + done + ''; + + single_shell_spawn = pkgs.writeScript "single_shell_spawn.sh" '' + #!/bin/sh + + i3-msg focus parent + i3-msg append_layout ${single_shell} + for i in {1..2} + do + gnome-terminal + done + sleep 0.3 + i3-msg focus parent + ''; + + single_shell = pkgs.writeText "single-shell.json" '' +{ + "border": "pixel", + "floating": "auto_off", + "layout": "tabbed", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + }, + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + } + ] + } + ] + } + ] +} + ''; + + shell_layout = pkgs.writeText "shell-layout.json" '' + { + "border": "pixel", + "floating": "auto_off", + "layout": "tabbed", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + }, + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + } + ] + }, + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + }, + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + } + ] + } + ] + } + ] + }, + + { + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + }, + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + } + ] + }, + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + }, + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + } + ] + } + ] + } + ] + }, + + { + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + }, + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + } + ] + }, + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + }, + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + } + ] + } + ] + } + ] + }, + + + { + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + }, + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + } + ] + }, + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.5, + "type": "con", + "nodes": [ + { + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 1, + "type": "con", + "nodes": [ + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + }, + { + "border": "pixel", + + "floating": "auto_off", + "geometry": { + "height": 434, + "width": 722, + "x": 0, + "y": 0 + }, + "percent": 0.5, + "swallows": [ + { + "class": "^Gnome\\-terminal$", + "instance": "^gnome\\-terminal\\-server$" + } + ], + "type": "con" + } + ] + } + ] + } + ] + } + ] + } + ''; + + + i3_conf_file = pkgs.writeText "config" '' + # This file has been auto-generated by i3-config-wizard(1). + # It will not be overwritten, so edit it as you like. + # + # Should you change your keyboard layout some time, delete + # this file and re-run i3-config-wizard(1). + # + + # i3 config file (v4) + # + # Please see https://i3wm.org/docs/userguide.html for a complete reference! + + set $mod Mod4 + + ####################### + # # + # LOOKS # + # # + ####################### + # Font for window titles. Will also be used by the bar unless a different font + # is used in the bar {} block below. + font pango:Monospace 20, Icons 10 + hide_edge_borders smart + new_window pixel 1 + new_float normal + + # Lockscreen shortcut + bindsym $mod+l exec xscreensaver-command -l + + # start a terminal + bindsym $mod+Return exec gnome-terminal + + + # class border backgr. text indicator child_border + client.focused #4fceea #285577 #ffffff #2e9ef4 #285577 + client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a + client.unfocused #333333 #222222 #888888 #292d2e #222222 + + # Size of border + default_border pixel 2 + + ####################### + # # + # DEFAULT CONFIG # + # # + ####################### + floating_modifier $mod + workspace_layout stacked + default_orientation vertical + + # Kill focused window + bindsym $mod+Shift+q kill + + # start dmenu (a program launcher) + bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -modi drun#run -combi-modi drun#run -show combi -show-icons -display-combi run -theme /etc/nixos/resources/gruvbox-dark-soft.rasi + + # Switch windows + bindsym $mod+x exec ${pkgs.rofi}/bin/rofi -modi window -show window -auto-select -theme /etc/nixos/resources/gruvbox-dark-soft.rasi + + # Arrow keys for focus navigation + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move focused window + bindsym $mod+Shift+j move left + bindsym $mod+Shift+k move down + bindsym $mod+Shift+l move up + bindsym $mod+Shift+odiaeresis move right + + # Arrow keys for focused window movement + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right + + # Split in horizontal orientation + bindsym $mod+h split h + + # Split in vertical orientation + bindsym $mod+v split v + + # Enter fullscreen mode for the focused container + bindsym $mod+f fullscreen toggle + + # Change container layout (stacked, tabbed, toggle split) + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Toggle tiling / floating + bindsym $mod+Shift+space floating toggle + + # Change focus between tiling / floating windows + bindsym $mod+space focus mode_toggle + + # Focus the parent container + bindsym $mod+a focus parent + + # Reload the configuration file + bindsym $mod+Shift+c reload + + # Restart i3 inplace (preserves your layout/session, can be used to upgrade i3) + bindsym $mod+Shift+r restart + + # Exit i3 (logs you out of your X session) + bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + + # Resize window. You can also use the mouse for that + mode "resize" { + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym a resize shrink width 10 px or 10 ppt + bindsym s resize grow height 10 px or 10 ppt + bindsym w resize shrink height 10 px or 10 ppt + bindsym d resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" + } + + # Enable floating + for_window [class="usbguard-applet-qt"] floating enable + for_window [class="Nm-connection-editor"] floating enable + for_window [class="Gnome-disks"] floating enable + for_window [class="QtPass" title="QtPass"] move scratchpad + + # Make the currently focused window a scratchpad + bindsym $mod+Shift+minus move scratchpad + + # Show the first scratchpad window + bindsym $mod+minus scratchpad show + + # Show the sup-mail scratchpad window, if any. + bindsym $mod+Shift+s [class="QtPass" title="QtPass"] scratchpad show + + ####################### + # # + # WORKSPACES # + # # + ####################### + # Variables + set $workspace1 "1: " + set $workspace2 "2: " + set $workspace3 "3: " + set $workspace4 "4: " + set $workspace5 "5: " + set $workspace6 "6: " + set $workspace7 "7" + set $workspace8 "8" + set $workspace9 "9" + set $workspace10 "10" + + assign [class="quassel"] $workspace3 + assign [class="Firefox"] $workspace2 + assign [class="Daily"] $workspace5 + + assign [class="VirtualBox Manager"] $workspace4 + assign [class="Virt-manager" title="Virtual Machine Manager"] $workspace4 + + assign [class="libreoffice"] $workspace6 + assign [class="Eclipse"] $workspace6 + + # Workspace lateral movement + bindsym $mod+Next workspace next + bindsym $mod+Prior workspace prev + + # Switch to workspace + bindsym $mod+1 workspace $workspace1 + bindsym $mod+2 workspace $workspace2 + bindsym $mod+3 workspace $workspace3 + bindsym $mod+4 workspace $workspace4 + bindsym $mod+5 workspace $workspace5 + bindsym $mod+6 workspace $workspace6 + bindsym $mod+7 workspace $workspace7 + bindsym $mod+8 workspace $workspace8 + bindsym $mod+9 workspace $workspace9 + bindsym $mod+0 workspace $workspace10 + + # Move workspace to other monitor + bindsym $mod+Shift+Next move workspace to output right + bindsym $mod+Shift+Prior move workspace to output left + + # move focused container to workspace + bindsym $mod+Shift+1 move container to workspace $workspace1 + bindsym $mod+Shift+2 move container to workspace $workspace2 + bindsym $mod+Shift+3 move container to workspace $workspace3 + bindsym $mod+Shift+4 move container to workspace $workspace4 + bindsym $mod+Shift+5 move container to workspace $workspace5 + bindsym $mod+Shift+6 move container to workspace $workspace6 + bindsym $mod+Shift+7 move container to workspace $workspace7 + bindsym $mod+Shift+8 move container to workspace $workspace8 + bindsym $mod+Shift+9 move container to workspace $workspace9 + bindsym $mod+Shift+0 move container to workspace $workspace10 + + + ####################### + # # + # FUNCTION KEYS # + # # + ####################### + # Backlight controls + bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight +10 + bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -10 + + # Pulse Audio controls + bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume + bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume + bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound + bindsym XF86AudioMicMute exec --no-startup-id amixer set Capture toggle + + ####################### + # # + # CONVENIENCE KEYS # + # # + ####################### + bindsym Shift+Alt+3 exec screenshot + + ####################### + # # + # WINDOW LAYOUT # + # # + ####################### + bindsym XF86LaunchA exec --no-startup-id ${reload_layout} + bindsym XF86Explorer exec --no-startup-id ${single_shell_spawn} + bindsym Shift+F11 exec --no-startup-id ${reload_layout} + bindsym Shift+F12 exec --no-startup-id ${single_shell_spawn} + + + bar { + status_command ${i3_status_script} + mode dock + position top + tray_output none + + font pango:monospace 14 + + # Scrolling on bar changes volume + bindsym button4 exec --no-startup-id pactl set-sink-volume 0 +5% + bindsym button5 exec --no-startup-id pactl set-sink-volume 0 +-5% + + # Right mouse click mutes the volume + bindsym button3 exec --no-startup-id pactl set-sink-mute 0 toggle + + + colors { + background #ffffff00 + statusline #ffe066 + + inactive_workspace #ffffff00 #ffffff00 #ffe066 + active_workspace #ffffff00 #ffffff00 #3f3f3f + urgent_workspace #ffffff00 #ffffff00 #ff8533 + } + } + + ####################### + # # + # AUTORUNS # + # # + ####################### + ## Start 16 gnome shells + exec i3-msg 'workspace $workspace1;' && ${reload_layout} + + # Start firefox + exec --no-startup-id ${pkgs.firefox}/bin/firefox --ProfileManager --new-instance --setDefaultBrowser + + # Quassel client + exec --no-startup-id ${pkgs.quasselClient}/bin/quasselclient + + # Random wallpaper + exec_always--no-startup-id ${random-wallpaper} + + # Start Qt-Pass + exec ${pkgs.qtpass}/bin/qtpass + ''; + +in { + services.xserver.enable = true; + services.xserver.layout = "de"; + + # Enable i3 Window Manager + services.xserver.windowManager.i3 = { + enable = true; + package = pkgs.i3; + configFile = i3_conf_file; + extraSessionCommands = '' + ${pkgs.openssh}/bin/ssh-add ${config.mainUserHome}/.ssh/id_rsa + ''; + }; + + # ${pkgs.xorg.xhost}/bin/xhost +SI:localuser:${cfg.user.name} + # ${pkgs.xorg.xhost}/bin/xhost -LOCAL: + services.xserver.windowManager.default = "i3"; + services.xserver.desktopManager.xterm.enable = false; + + # Enable the X11 windowing system. + services.xserver.displayManager.lightdm = { + enable = true; + autoLogin.enable = true; + autoLogin.user = config.mainUser; + autoLogin.timeout = 2; + greeter.enable = true; + }; + + fonts = { + fonts = with pkgs; [ + font-awesome_5 + ]; + }; + + # Allow users in video group to change brightness + hardware.brightnessctl.enable = true; + + environment.systemPackages = with pkgs; [ + rofi # Dmenu replacement + acpilight # Replacement for xbacklight + arandr # Xrandr gui + feh + wirelesstools # To get wireless statistics + acpi + xorg.xhost + xorg.xauth + ]; + +} From ad57bfe55eaadad1a09344742403725328c036db Mon Sep 17 00:00:00 2001 From: jeschli Date: Sat, 4 May 2019 07:35:13 +0200 Subject: [PATCH 13/68] j brauerei: remove dead code --- jeschli/1systems/brauerei/config.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index b8b2b66bc..de940fedf 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -1,16 +1,14 @@ { config, pkgs, lib, ... }: let xmonad-jeschli = pkgs.callPackage { inherit config; }; + mainUser = config.krebs.build.user.name; in { imports = [ ./hardware-configuration.nix -# -# -# -# + ]; From 7fd7a1336cbf6e4da69caa231368a82db7f3516c Mon Sep 17 00:00:00 2001 From: jeschli Date: Sat, 4 May 2019 07:35:46 +0200 Subject: [PATCH 14/68] j brauerei: add rofi --- jeschli/1systems/brauerei/config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index de940fedf..55b28c3e8 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -52,6 +52,7 @@ in copyq curl dmenu + rofi git gnupg i3lock From a553c80f764d3b02d832a5839abadd6215047c70 Mon Sep 17 00:00:00 2001 From: jeschli Date: Sat, 4 May 2019 07:37:05 +0200 Subject: [PATCH 15/68] j configs: remove window-manager.nix --- jeschli/2configs/window-manager.nix | 1078 --------------------------- 1 file changed, 1078 deletions(-) delete mode 100644 jeschli/2configs/window-manager.nix diff --git a/jeschli/2configs/window-manager.nix b/jeschli/2configs/window-manager.nix deleted file mode 100644 index 23c958df4..000000000 --- a/jeschli/2configs/window-manager.nix +++ /dev/null @@ -1,1078 +0,0 @@ -{pkgs, environment, config, lib, ... }: - -with pkgs; - -let - - bar_update_interval = "1"; # Option - - i3_status_script = pkgs.writeScript "i3script.sh" '' - #!/bin/sh - - # First time without wifi, because it blocks a long time - BAR="$(${temp_status})" - BAR+=" | $(${avail_disk})" - BAR+=" | $(${volume_status})" - BAR+=" | $(${brightness_status})" - BAR+=" | $(${vpn_status})" - BAR+=" | $(${eth_status})" - BAR+=" | Wifi " - BAR+=" | $(${date_status})" - BAR+=" | $(${battery_status})" - - echo "$BAR" - - while true; do - BAR="$(${temp_status})" - BAR+=" | $(${avail_disk})" - BAR+=" | $(${volume_status})" - BAR+=" | $(${brightness_status})" - BAR+=" | $(${vpn_status})" - BAR+=" | $(${eth_status})" - BAR+=" | $(${wifi_status})" - BAR+=" | $(${date_status})" - BAR+=" | $(${battery_status})" - - echo "$BAR" - sleep ${bar_update_interval} - done - - ''; - - # TODO: Change name if you have a different vpn interface name - vpn_status = pkgs.writeScript "vpn_status.sh" '' - #!/bin/sh - - export PATH="$PATH:${gawk}/bin:${acpi}/bin:${coreutils}/bin:${gnugrep}/bin:${calc}/bin" - - VPN="" - if [ -e "/proc/sys/net/ipv4/conf/labs-vpn" ]; then - VPN="Labs-VPN" - elif [ -e "/proc/sys/net/ipv4/conf/office-vpn" ]; then - VPN="Office-VPN" - elif [ -e "/proc/sys/net/ipv4/conf/tun0" ]; then - VPN="UKN-VPN" - elif [ -e "/proc/sys/net/ipv4/conf/wireguard-home" ]; then - VPN="Home-VPN" - fi - - if [ "$VPN" = "" ]; then - echo "VPN " - else - echo "$VPN " - fi - ''; - - avail_disk = pkgs.writeScript "avail_disk.sh" '' - #!/bin/sh - export PATH="$PATH:${gawk}/bin:${coreutils}/bin:${gnugrep}/bin" - - avail=$(df / -h | tail -n1| awk '{print $(NF-2) }') - echo "$avail " - ''; - - wifi_status = pkgs.writeScript "wifi_status.sh" '' - #!/bin/sh - - export PATH="$PATH:${gawk}/bin:${coreutils}/bin:${gnugrep}/bin:${wirelesstools}/bin" - - ssid=$(iwgetid -r) - quality=$(cat /proc/net/wireless | tail -n1 | awk '{ print $3}' | sed 's/\.//g')dB - - if [ "$ssid" = "" ]; then - echo "Wifi " - else - echo "$quality at $ssid " - fi - ''; - - - eth_status = pkgs.writeScript "eth_status.sh" '' - #!/bin/sh - - export PATH="$PATH:${gawk}/bin:${coreutils}/bin:${gnugrep}/bin:${iproute}/bin" - - first_eth=$(for i in /proc/sys/net/ipv4/conf/enp*; do basename "$i"; break; done) - status=$(ip link show dev "$first_eth" | head -n1 | awk '{ print $9 }') - - if [ "$status" = "DOWN" ]; then - echo "" - else - ip_addr=$(ip address show "$first_eth" | grep inet | head -n1 | awk '{ print $2 }' | sed 's/\/24//g') - echo "$ip_addr " - fi - - ''; - - volume_status = pkgs.writeScript "volume_status.sh" '' - #!/bin/sh - - export PATH="$PATH:${gawk}/bin:${coreutils}/bin:${gnugrep}/bin:${alsaUtils}/bin" - - status=$(amixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $4 }') - volume=$(amixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $2 }') - - if [ "$status" = "off" ]; then - echo "Muted " - else - echo "$volume " - fi - ''; - - date_status = pkgs.writeScript "date_status.sh" '' - #!/bin/sh - - export PATH="$PATH:${gawk}/bin:${coreutils}/bin:${gnugrep}/bin" - - echo "$(date +'%d.%m.%Y  %H:%M')" - ''; - - temp_status = pkgs.writeScript "temp_status.sh" '' - #!/bin/sh - - export PATH="$PATH:${gawk}/bin:${acpi}/bin:${coreutils}/bin:${gnugrep}/bin:${calc}/bin" - - temp=$(acpi -t | awk '{print $4}' | calc -p) - echo "$temp " - ''; - - brightness_status = pkgs.writeScript "brightness_status.sh" '' - #!/bin/sh - - brightness=$(${pkgs.acpilight}/bin/xbacklight -get) - echo "$brightness% " - ''; - - battery_status = with pkgs; pkgs.writeScript "battery_status.bash" '' - #!${pkgs.bash}/bin/bash - export PATH="$PATH:${gawk}/bin:${acpi}/bin:${coreutils}/bin:${gnugrep}/bin:${calc}/bin" - - get_battery_charging_status() { - if [ "$(acpi -b | grep Discharging)" != "" ]; then - echo "Discharging"; - else - echo "Charging"; - fi - } - declare -a capacity_arr - capacity_arr=( -  -  -  -  -  - ) - - # get charge of all batteries, combine them - total_charge=$(acpi -b | awk '{print $4}' | grep -Eo "[0-9]+" | paste -sd+ | calc -p); - - # get amount of batteries in the device - battery_number=$(acpi -b | wc -l); - percent=$((total_charge / battery_number)); - index=$((percent / ( 100 / ''${#capacity_arr[@]}) )) - - if [ "$(get_battery_charging_status)" == "Charging" ]; then - echo "$percent% " - else - echo "$percent% ''${capacity_arr[$index]}" - fi - ''; - - random-wallpaper = pkgs.writeScript "random-wallpaper.sh" '' - #!/bin/sh - file=$(find ${config.wallpapers} -type f -print0 | shuf -z -n 1) - ${pkgs.feh}/bin/feh --bg-scale "$file" - ''; - - reload_layout = pkgs.writeScript "reload_layout.sh" '' - #!/bin/sh - pkill gnome-terminal - - i3-msg append_layout ${shell_layout} - - for i in {1..16} - do - gnome-terminal & - done - ''; - - single_shell_spawn = pkgs.writeScript "single_shell_spawn.sh" '' - #!/bin/sh - - i3-msg focus parent - i3-msg append_layout ${single_shell} - for i in {1..2} - do - gnome-terminal - done - sleep 0.3 - i3-msg focus parent - ''; - - single_shell = pkgs.writeText "single-shell.json" '' -{ - "border": "pixel", - "floating": "auto_off", - "layout": "tabbed", - "percent": 1, - "type": "con", - "nodes": [ - { - "border": "pixel", - "floating": "auto_off", - "layout": "splith", - "percent": 1, - "type": "con", - "nodes": [ - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 0.5, - "type": "con", - "nodes": [ - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - }, - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - } - ] - } - ] - } - ] -} - ''; - - shell_layout = pkgs.writeText "shell-layout.json" '' - { - "border": "pixel", - "floating": "auto_off", - "layout": "tabbed", - "percent": 1, - "type": "con", - "nodes": [ - { - "border": "pixel", - "floating": "auto_off", - "layout": "splith", - "percent": 1, - "type": "con", - "nodes": [ - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 0.5, - "type": "con", - "nodes": [ - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - }, - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - } - ] - }, - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 0.5, - "type": "con", - "nodes": [ - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 1, - "type": "con", - "nodes": [ - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - }, - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - } - ] - } - ] - } - ] - }, - - { - "border": "pixel", - "floating": "auto_off", - "layout": "splith", - "percent": 1, - "type": "con", - "nodes": [ - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 0.5, - "type": "con", - "nodes": [ - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - }, - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - } - ] - }, - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 0.5, - "type": "con", - "nodes": [ - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 1, - "type": "con", - "nodes": [ - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - }, - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - } - ] - } - ] - } - ] - }, - - { - "border": "pixel", - "floating": "auto_off", - "layout": "splith", - "percent": 1, - "type": "con", - "nodes": [ - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 0.5, - "type": "con", - "nodes": [ - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - }, - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - } - ] - }, - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 0.5, - "type": "con", - "nodes": [ - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 1, - "type": "con", - "nodes": [ - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - }, - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - } - ] - } - ] - } - ] - }, - - - { - "border": "pixel", - "floating": "auto_off", - "layout": "splith", - "percent": 1, - "type": "con", - "nodes": [ - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 0.5, - "type": "con", - "nodes": [ - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - }, - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - } - ] - }, - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 0.5, - "type": "con", - "nodes": [ - { - "border": "pixel", - "floating": "auto_off", - "layout": "splitv", - "percent": 1, - "type": "con", - "nodes": [ - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - }, - { - "border": "pixel", - - "floating": "auto_off", - "geometry": { - "height": 434, - "width": 722, - "x": 0, - "y": 0 - }, - "percent": 0.5, - "swallows": [ - { - "class": "^Gnome\\-terminal$", - "instance": "^gnome\\-terminal\\-server$" - } - ], - "type": "con" - } - ] - } - ] - } - ] - } - ] - } - ''; - - - i3_conf_file = pkgs.writeText "config" '' - # This file has been auto-generated by i3-config-wizard(1). - # It will not be overwritten, so edit it as you like. - # - # Should you change your keyboard layout some time, delete - # this file and re-run i3-config-wizard(1). - # - - # i3 config file (v4) - # - # Please see https://i3wm.org/docs/userguide.html for a complete reference! - - set $mod Mod4 - - ####################### - # # - # LOOKS # - # # - ####################### - # Font for window titles. Will also be used by the bar unless a different font - # is used in the bar {} block below. - font pango:Monospace 20, Icons 10 - hide_edge_borders smart - new_window pixel 1 - new_float normal - - # Lockscreen shortcut - bindsym $mod+l exec xscreensaver-command -l - - # start a terminal - bindsym $mod+Return exec gnome-terminal - - - # class border backgr. text indicator child_border - client.focused #4fceea #285577 #ffffff #2e9ef4 #285577 - client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a - client.unfocused #333333 #222222 #888888 #292d2e #222222 - - # Size of border - default_border pixel 2 - - ####################### - # # - # DEFAULT CONFIG # - # # - ####################### - floating_modifier $mod - workspace_layout stacked - default_orientation vertical - - # Kill focused window - bindsym $mod+Shift+q kill - - # start dmenu (a program launcher) - bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -modi drun#run -combi-modi drun#run -show combi -show-icons -display-combi run -theme /etc/nixos/resources/gruvbox-dark-soft.rasi - - # Switch windows - bindsym $mod+x exec ${pkgs.rofi}/bin/rofi -modi window -show window -auto-select -theme /etc/nixos/resources/gruvbox-dark-soft.rasi - - # Arrow keys for focus navigation - bindsym $mod+Left focus left - bindsym $mod+Down focus down - bindsym $mod+Up focus up - bindsym $mod+Right focus right - - # Move focused window - bindsym $mod+Shift+j move left - bindsym $mod+Shift+k move down - bindsym $mod+Shift+l move up - bindsym $mod+Shift+odiaeresis move right - - # Arrow keys for focused window movement - bindsym $mod+Shift+Left move left - bindsym $mod+Shift+Down move down - bindsym $mod+Shift+Up move up - bindsym $mod+Shift+Right move right - - # Split in horizontal orientation - bindsym $mod+h split h - - # Split in vertical orientation - bindsym $mod+v split v - - # Enter fullscreen mode for the focused container - bindsym $mod+f fullscreen toggle - - # Change container layout (stacked, tabbed, toggle split) - bindsym $mod+s layout stacking - bindsym $mod+w layout tabbed - bindsym $mod+e layout toggle split - - # Toggle tiling / floating - bindsym $mod+Shift+space floating toggle - - # Change focus between tiling / floating windows - bindsym $mod+space focus mode_toggle - - # Focus the parent container - bindsym $mod+a focus parent - - # Reload the configuration file - bindsym $mod+Shift+c reload - - # Restart i3 inplace (preserves your layout/session, can be used to upgrade i3) - bindsym $mod+Shift+r restart - - # Exit i3 (logs you out of your X session) - bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" - - # Resize window. You can also use the mouse for that - mode "resize" { - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - bindsym a resize shrink width 10 px or 10 ppt - bindsym s resize grow height 10 px or 10 ppt - bindsym w resize shrink height 10 px or 10 ppt - bindsym d resize grow width 10 px or 10 ppt - - # same bindings, but for the arrow keys - bindsym Left resize shrink width 10 px or 10 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt - - # back to normal: Enter or Escape - bindsym Return mode "default" - bindsym Escape mode "default" - } - - # Enable floating - for_window [class="usbguard-applet-qt"] floating enable - for_window [class="Nm-connection-editor"] floating enable - for_window [class="Gnome-disks"] floating enable - for_window [class="QtPass" title="QtPass"] move scratchpad - - # Make the currently focused window a scratchpad - bindsym $mod+Shift+minus move scratchpad - - # Show the first scratchpad window - bindsym $mod+minus scratchpad show - - # Show the sup-mail scratchpad window, if any. - bindsym $mod+Shift+s [class="QtPass" title="QtPass"] scratchpad show - - ####################### - # # - # WORKSPACES # - # # - ####################### - # Variables - set $workspace1 "1: " - set $workspace2 "2: " - set $workspace3 "3: " - set $workspace4 "4: " - set $workspace5 "5: " - set $workspace6 "6: " - set $workspace7 "7" - set $workspace8 "8" - set $workspace9 "9" - set $workspace10 "10" - - assign [class="quassel"] $workspace3 - assign [class="Firefox"] $workspace2 - assign [class="Daily"] $workspace5 - - assign [class="VirtualBox Manager"] $workspace4 - assign [class="Virt-manager" title="Virtual Machine Manager"] $workspace4 - - assign [class="libreoffice"] $workspace6 - assign [class="Eclipse"] $workspace6 - - # Workspace lateral movement - bindsym $mod+Next workspace next - bindsym $mod+Prior workspace prev - - # Switch to workspace - bindsym $mod+1 workspace $workspace1 - bindsym $mod+2 workspace $workspace2 - bindsym $mod+3 workspace $workspace3 - bindsym $mod+4 workspace $workspace4 - bindsym $mod+5 workspace $workspace5 - bindsym $mod+6 workspace $workspace6 - bindsym $mod+7 workspace $workspace7 - bindsym $mod+8 workspace $workspace8 - bindsym $mod+9 workspace $workspace9 - bindsym $mod+0 workspace $workspace10 - - # Move workspace to other monitor - bindsym $mod+Shift+Next move workspace to output right - bindsym $mod+Shift+Prior move workspace to output left - - # move focused container to workspace - bindsym $mod+Shift+1 move container to workspace $workspace1 - bindsym $mod+Shift+2 move container to workspace $workspace2 - bindsym $mod+Shift+3 move container to workspace $workspace3 - bindsym $mod+Shift+4 move container to workspace $workspace4 - bindsym $mod+Shift+5 move container to workspace $workspace5 - bindsym $mod+Shift+6 move container to workspace $workspace6 - bindsym $mod+Shift+7 move container to workspace $workspace7 - bindsym $mod+Shift+8 move container to workspace $workspace8 - bindsym $mod+Shift+9 move container to workspace $workspace9 - bindsym $mod+Shift+0 move container to workspace $workspace10 - - - ####################### - # # - # FUNCTION KEYS # - # # - ####################### - # Backlight controls - bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight +10 - bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -10 - - # Pulse Audio controls - bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume - bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume - bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound - bindsym XF86AudioMicMute exec --no-startup-id amixer set Capture toggle - - ####################### - # # - # CONVENIENCE KEYS # - # # - ####################### - bindsym Shift+Alt+3 exec screenshot - - ####################### - # # - # WINDOW LAYOUT # - # # - ####################### - bindsym XF86LaunchA exec --no-startup-id ${reload_layout} - bindsym XF86Explorer exec --no-startup-id ${single_shell_spawn} - bindsym Shift+F11 exec --no-startup-id ${reload_layout} - bindsym Shift+F12 exec --no-startup-id ${single_shell_spawn} - - - bar { - status_command ${i3_status_script} - mode dock - position top - tray_output none - - font pango:monospace 14 - - # Scrolling on bar changes volume - bindsym button4 exec --no-startup-id pactl set-sink-volume 0 +5% - bindsym button5 exec --no-startup-id pactl set-sink-volume 0 +-5% - - # Right mouse click mutes the volume - bindsym button3 exec --no-startup-id pactl set-sink-mute 0 toggle - - - colors { - background #ffffff00 - statusline #ffe066 - - inactive_workspace #ffffff00 #ffffff00 #ffe066 - active_workspace #ffffff00 #ffffff00 #3f3f3f - urgent_workspace #ffffff00 #ffffff00 #ff8533 - } - } - - ####################### - # # - # AUTORUNS # - # # - ####################### - ## Start 16 gnome shells - exec i3-msg 'workspace $workspace1;' && ${reload_layout} - - # Start firefox - exec --no-startup-id ${pkgs.firefox}/bin/firefox --ProfileManager --new-instance --setDefaultBrowser - - # Quassel client - exec --no-startup-id ${pkgs.quasselClient}/bin/quasselclient - - # Random wallpaper - exec_always--no-startup-id ${random-wallpaper} - - # Start Qt-Pass - exec ${pkgs.qtpass}/bin/qtpass - ''; - -in { - services.xserver.enable = true; - services.xserver.layout = "de"; - - # Enable i3 Window Manager - services.xserver.windowManager.i3 = { - enable = true; - package = pkgs.i3; - configFile = i3_conf_file; - extraSessionCommands = '' - ${pkgs.openssh}/bin/ssh-add ${config.mainUserHome}/.ssh/id_rsa - ''; - }; - - # ${pkgs.xorg.xhost}/bin/xhost +SI:localuser:${cfg.user.name} - # ${pkgs.xorg.xhost}/bin/xhost -LOCAL: - services.xserver.windowManager.default = "i3"; - services.xserver.desktopManager.xterm.enable = false; - - # Enable the X11 windowing system. - services.xserver.displayManager.lightdm = { - enable = true; - autoLogin.enable = true; - autoLogin.user = config.mainUser; - autoLogin.timeout = 2; - greeter.enable = true; - }; - - fonts = { - fonts = with pkgs; [ - font-awesome_5 - ]; - }; - - # Allow users in video group to change brightness - hardware.brightnessctl.enable = true; - - environment.systemPackages = with pkgs; [ - rofi # Dmenu replacement - acpilight # Replacement for xbacklight - arandr # Xrandr gui - feh - wirelesstools # To get wireless statistics - acpi - xorg.xhost - xorg.xauth - ]; - -} From 3899d0195c6077174e2d416c490dfae8783acee5 Mon Sep 17 00:00:00 2001 From: jeschli Date: Wed, 8 May 2019 08:29:14 +0200 Subject: [PATCH 16/68] j brauerei: add xdotool for select last window hack in i3 --- jeschli/1systems/brauerei/config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index 55b28c3e8..0deaded66 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -53,6 +53,7 @@ in curl dmenu rofi + xdotool git gnupg i3lock From 4630d10b3151f689247c0e8e7488917ee6313c7f Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 17 May 2019 12:50:48 +0200 Subject: [PATCH 17/68] github-hosts-sync: import 1.0.0 from painload --- .../simple/github-hosts-sync/default.nix | 4 +- .../simple/github-hosts-sync/src/hosts-sync | 66 +++++++++++++++++++ 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100755 krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync diff --git a/krebs/5pkgs/simple/github-hosts-sync/default.nix b/krebs/5pkgs/simple/github-hosts-sync/default.nix index cdfed468c..8caa5e1ef 100644 --- a/krebs/5pkgs/simple/github-hosts-sync/default.nix +++ b/krebs/5pkgs/simple/github-hosts-sync/default.nix @@ -3,7 +3,7 @@ stdenv.mkDerivation { name = "github-hosts-sync"; - src = pkgs.painload; + src = ./src; phases = [ "unpackPhase" @@ -29,7 +29,7 @@ stdenv.mkDerivation { sed \ 's,^main() {$,&\n export PATH=${path} GIT_SSL_CAINFO=${ca-bundle},' \ - < ./retiolum/scripts/github_hosts_sync/hosts-sync \ + < hosts-sync \ > $out/bin/github-hosts-sync chmod +x $out/bin/github-hosts-sync diff --git a/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync new file mode 100755 index 000000000..f36c700d8 --- /dev/null +++ b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync @@ -0,0 +1,66 @@ +#! /bin/sh +# TODO do_work should retry until success +set -euf + +port=${port-1028} +local_painload=$HOME/painload +remote_painload="https://github.com/krebscode/painload" +local_hosts=$HOME/hosts +remote_hosts="git@github.com:krebscode/hosts.git" + +main() { + ensure_local_painload + ensure_local_hosts + is_worker && do_work || become_server +} + +ensure_local_painload() { + test -d "$local_painload" || git clone "$remote_painload" "$local_painload" +} + +ensure_local_hosts() { + test -d "$local_hosts" || git clone "$remote_hosts" "$local_hosts" +} + +become_server() { + exec socat "TCP-LISTEN:$port,reuseaddr,fork" "EXEC:$0" +} + +is_worker() { + test "${SOCAT_SOCKPORT-}" = "$port" +} + +do_work() { + # read request + req_line="$(read line && echo "$line")" + req_hdrs="$(sed -n '/^\r$/q;p')" + + set -x + + cd "$local_hosts" + git pull >&2 + + cd "$local_hosts" + find . -name .git -prune -o -type f -exec git rm \{\} \; >/dev/null + + cd "$local_painload" + git pull >&2 + + find "$local_painload/retiolum/hosts" -type f -exec cp \{\} "$local_hosts" \; + + cd "$local_hosts" + find . -name .git -prune -o -type f -exec git add \{\} \; >&2 + if git status --porcelain | grep -q .; then + git config user.email "$LOGNAME@$(hostname)" + git config user.name "$LOGNAME" + git commit -m bump >&2 + git push >&2 + fi + + echo "HTTP/1.1 200 OK" + echo + echo "https://github.com/krebscode/hosts/archive/master.tar.gz" + echo "https://github.com/krebscode/hosts/archive/master.zip" +} + +main "$@" From acb3f95fa6586a9c9b1b1ffa76368c1b39edb8aa Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 17 May 2019 13:06:36 +0200 Subject: [PATCH 18/68] github-hosts-sync: 1.0.0 -> 2.0.0 --- krebs/3modules/github-hosts-sync.nix | 25 ++++-- .../simple/github-hosts-sync/default.nix | 36 ++++----- .../simple/github-hosts-sync/src/hosts-sync | 81 ++++++------------- 3 files changed, 56 insertions(+), 86 deletions(-) diff --git a/krebs/3modules/github-hosts-sync.nix b/krebs/3modules/github-hosts-sync.nix index 3b626dc46..233cea68d 100644 --- a/krebs/3modules/github-hosts-sync.nix +++ b/krebs/3modules/github-hosts-sync.nix @@ -11,17 +11,25 @@ let api = { enable = mkEnableOption "krebs.github-hosts-sync"; - port = mkOption { - type = types.int; # TODO port type - default = 1028; - }; dataDir = mkOption { type = types.str; # TODO path (but not just into store) default = "/var/lib/github-hosts-sync"; }; + srcDir = mkOption { + type = types.str; + default = "${config.krebs.tinc.retiolum.confDir}/hosts"; + }; ssh-identity-file = mkOption { type = types.suffixed-str [".ssh.id_ed25519" ".ssh.id_rsa"]; - default = toString ; + default = toString ; + }; + url = mkOption { + type = types.str; + default = "git@github.com:krebscode/hosts.git"; + }; + workTree = mkOption { + type = types.absolute-pathname; + default = "${cfg.dataDir}/cache"; }; }; @@ -30,13 +38,16 @@ let after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; environment = { - port = toString cfg.port; + GITHUB_HOST_SYNC_SRCDIR = cfg.srcDir; + GITHUB_HOST_SYNC_WORKTREE = cfg.workTree; + GITHUB_HOST_SYNC_URL = cfg.url; }; serviceConfig = { PermissionsStartOnly = "true"; SyslogIdentifier = "github-hosts-sync"; User = user.name; - Restart = "always"; + Type = "oneshot"; + RemainAfterExit = true; ExecStartPre = pkgs.writeDash "github-hosts-sync-init" '' set -euf install -m 0711 -o ${user.name} -d ${cfg.dataDir} diff --git a/krebs/5pkgs/simple/github-hosts-sync/default.nix b/krebs/5pkgs/simple/github-hosts-sync/default.nix index 8caa5e1ef..5caf225cb 100644 --- a/krebs/5pkgs/simple/github-hosts-sync/default.nix +++ b/krebs/5pkgs/simple/github-hosts-sync/default.nix @@ -1,7 +1,8 @@ { pkgs, stdenv, ... }: -stdenv.mkDerivation { - name = "github-hosts-sync"; +stdenv.mkDerivation rec { + name = "github-hosts-sync-${version}"; + version = "2.0.0"; src = ./src; @@ -10,28 +11,21 @@ stdenv.mkDerivation { "installPhase" ]; - installPhase = - let - ca-bundle = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; - path = stdenv.lib.makeBinPath (with pkgs; [ - coreutils - findutils - git - gnugrep - gnused - nettools - openssh - socat - ]); - in + installPhase = let + ca-bundle = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; + path = stdenv.lib.makeBinPath [ + pkgs.git + pkgs.openssh + pkgs.rsync + ]; + in '' mkdir -p $out/bin - sed \ - 's,^main() {$,&\n export PATH=${path} GIT_SSL_CAINFO=${ca-bundle},' \ - < hosts-sync \ - > $out/bin/github-hosts-sync + cp hosts-sync $out/bin/github-hosts-sync - chmod +x $out/bin/github-hosts-sync + sed -i \ + '1s,$,\nPATH=${path}''${PATH+:$PATH} GIT_SSL_CAINFO=${ca-bundle},' \ + $out/bin/github-hosts-sync ''; } diff --git a/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync index f36c700d8..4bae44bef 100755 --- a/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync +++ b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync @@ -1,66 +1,31 @@ #! /bin/sh -# TODO do_work should retry until success -set -euf +set -efu +exec >&2 -port=${port-1028} -local_painload=$HOME/painload -remote_painload="https://github.com/krebscode/painload" -local_hosts=$HOME/hosts -remote_hosts="git@github.com:krebscode/hosts.git" +hosts_srcdir=$GITHUB_HOST_SYNC_SRCDIR +hosts_worktree=${GITHUB_HOST_SYNC_WORKTREE-/tmp/hosts} +hosts_url=${GITHUB_HOST_SYNC_URL-git@github.com:krebscode/hosts.git} -main() { - ensure_local_painload - ensure_local_hosts - is_worker && do_work || become_server -} +test -d "$hosts_worktree" || git clone "$hosts_url" "$hosts_worktree" -ensure_local_painload() { - test -d "$local_painload" || git clone "$remote_painload" "$local_painload" -} +cd "$hosts_worktree" -ensure_local_hosts() { - test -d "$local_hosts" || git clone "$remote_hosts" "$local_hosts" -} +git pull -become_server() { - exec socat "TCP-LISTEN:$port,reuseaddr,fork" "EXEC:$0" -} +rsync \ + --chmod D755,F644 \ + --delete-excluded \ + --filter 'protect .git' \ + --recursive \ + --verbose \ + "$hosts_srcdir/" \ + . -is_worker() { - test "${SOCAT_SOCKPORT-}" = "$port" -} +git add . -do_work() { - # read request - req_line="$(read line && echo "$line")" - req_hdrs="$(sed -n '/^\r$/q;p')" - - set -x - - cd "$local_hosts" - git pull >&2 - - cd "$local_hosts" - find . -name .git -prune -o -type f -exec git rm \{\} \; >/dev/null - - cd "$local_painload" - git pull >&2 - - find "$local_painload/retiolum/hosts" -type f -exec cp \{\} "$local_hosts" \; - - cd "$local_hosts" - find . -name .git -prune -o -type f -exec git add \{\} \; >&2 - if git status --porcelain | grep -q .; then - git config user.email "$LOGNAME@$(hostname)" - git config user.name "$LOGNAME" - git commit -m bump >&2 - git push >&2 - fi - - echo "HTTP/1.1 200 OK" - echo - echo "https://github.com/krebscode/hosts/archive/master.tar.gz" - echo "https://github.com/krebscode/hosts/archive/master.zip" -} - -main "$@" +if test -n "$(git status --porcelain)"; then + git config user.email "$LOGNAME@$(hostname)" + git config user.name "$LOGNAME" + git commit -m bump + git push +fi From 866e94b4fa70181b9ae753b51d59c27ce42c9497 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 17 May 2019 13:36:13 +0200 Subject: [PATCH 19/68] hotdog.r: enable github-hosts-sync --- krebs/1systems/hotdog/config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/krebs/1systems/hotdog/config.nix b/krebs/1systems/hotdog/config.nix index f68c8ce50..32e416831 100644 --- a/krebs/1systems/hotdog/config.nix +++ b/krebs/1systems/hotdog/config.nix @@ -18,6 +18,7 @@ ]; krebs.build.host = config.krebs.hosts.hotdog; + krebs.github-hosts-sync.enable = true; boot.isContainer = true; networking.useDHCP = false; From c7cfc7d6a3988615fd40369d0e02bd570a52bc7f Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 17 May 2019 13:43:13 +0200 Subject: [PATCH 20/68] github-hosts-sync: update default URL --- krebs/3modules/github-hosts-sync.nix | 2 +- krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/krebs/3modules/github-hosts-sync.nix b/krebs/3modules/github-hosts-sync.nix index 233cea68d..6ffaf5503 100644 --- a/krebs/3modules/github-hosts-sync.nix +++ b/krebs/3modules/github-hosts-sync.nix @@ -25,7 +25,7 @@ let }; url = mkOption { type = types.str; - default = "git@github.com:krebscode/hosts.git"; + default = "git@github.com:krebs/hosts.git"; }; workTree = mkOption { type = types.absolute-pathname; diff --git a/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync index 4bae44bef..d2017ef63 100755 --- a/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync +++ b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync @@ -4,7 +4,7 @@ exec >&2 hosts_srcdir=$GITHUB_HOST_SYNC_SRCDIR hosts_worktree=${GITHUB_HOST_SYNC_WORKTREE-/tmp/hosts} -hosts_url=${GITHUB_HOST_SYNC_URL-git@github.com:krebscode/hosts.git} +hosts_url=${GITHUB_HOST_SYNC_URL-git@github.com:krebs/hosts.git} test -d "$hosts_worktree" || git clone "$hosts_url" "$hosts_worktree" From e91f56a4092b47aea6dd62e015176c0a45b6e0e6 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 17 May 2019 13:48:48 +0200 Subject: [PATCH 21/68] krebs: add dummy github-hosts-sync.ssh.id_ed25519 --- krebs/0tests/data/secrets/github-hosts-sync.ssh.id_ed25519 | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 krebs/0tests/data/secrets/github-hosts-sync.ssh.id_ed25519 diff --git a/krebs/0tests/data/secrets/github-hosts-sync.ssh.id_ed25519 b/krebs/0tests/data/secrets/github-hosts-sync.ssh.id_ed25519 new file mode 100644 index 000000000..e69de29bb From 2950b893b03253ef8000e939915bb9c8c1f1f524 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 17 May 2019 13:53:55 +0200 Subject: [PATCH 22/68] github-hosts-sync: add nettools --- krebs/5pkgs/simple/github-hosts-sync/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/krebs/5pkgs/simple/github-hosts-sync/default.nix b/krebs/5pkgs/simple/github-hosts-sync/default.nix index 5caf225cb..fbc48fa3f 100644 --- a/krebs/5pkgs/simple/github-hosts-sync/default.nix +++ b/krebs/5pkgs/simple/github-hosts-sync/default.nix @@ -15,6 +15,7 @@ stdenv.mkDerivation rec { ca-bundle = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; path = stdenv.lib.makeBinPath [ pkgs.git + pkgs.nettools pkgs.openssh pkgs.rsync ]; From a666abeaabbed73749cd5e2f1745b4a4527c4bc6 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 17 May 2019 14:02:22 +0200 Subject: [PATCH 23/68] github-hosts-sync: make user name/mail overridable --- krebs/3modules/github-hosts-sync.nix | 3 +++ krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/krebs/3modules/github-hosts-sync.nix b/krebs/3modules/github-hosts-sync.nix index 6ffaf5503..0b7d56098 100644 --- a/krebs/3modules/github-hosts-sync.nix +++ b/krebs/3modules/github-hosts-sync.nix @@ -38,6 +38,8 @@ let after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; environment = { + GITHUB_HOST_SYNC_USER_MAIL = user.mail; + GITHUB_HOST_SYNC_USER_NAME = user.name; GITHUB_HOST_SYNC_SRCDIR = cfg.srcDir; GITHUB_HOST_SYNC_WORKTREE = cfg.workTree; GITHUB_HOST_SYNC_URL = cfg.url; @@ -67,6 +69,7 @@ let }; user = rec { + mail = "${name}@${config.krebs.build.host.name}"; name = "github-hosts-sync"; uid = genid_uint31 name; }; diff --git a/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync index d2017ef63..a8973e72b 100755 --- a/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync +++ b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync @@ -5,6 +5,8 @@ exec >&2 hosts_srcdir=$GITHUB_HOST_SYNC_SRCDIR hosts_worktree=${GITHUB_HOST_SYNC_WORKTREE-/tmp/hosts} hosts_url=${GITHUB_HOST_SYNC_URL-git@github.com:krebs/hosts.git} +user_mail=${GITHUB_HOST_SYNC_USER_MAIL-$LOGNAME@$(hostname)} +user_name=${GITHUB_HOST_SYNC_USER_NAME-$LOGNAME} test -d "$hosts_worktree" || git clone "$hosts_url" "$hosts_worktree" @@ -24,8 +26,8 @@ rsync \ git add . if test -n "$(git status --porcelain)"; then - git config user.email "$LOGNAME@$(hostname)" - git config user.name "$LOGNAME" + git config user.email "$user_mail" + git config user.name "$user_name" git commit -m bump git push fi From 10ff96638dbfabab63bdf4c795777df395c36bec Mon Sep 17 00:00:00 2001 From: jeschli Date: Sat, 18 May 2019 18:22:50 +0200 Subject: [PATCH 24/68] j brauerei: add home-manager --- jeschli/1systems/brauerei/config.nix | 22 ++++++++++++++++++++-- jeschli/krops.nix | 6 ++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index 0deaded66..059ec6d71 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -7,11 +7,11 @@ in imports = [ ./hardware-configuration.nix + - ]; - + ]; krebs.build.host = config.krebs.hosts.brauerei; # Use the GRUB 2 boot loader. boot.loader.grub.enable = true; @@ -122,6 +122,24 @@ in # programs.mtr.enable = true; programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; + home-manager.useUserPackages = true; + home-manager.users.jeschli = { + home.stateVersion = "19.03"; + }; +# home-manager.enable = true; + + home-manager.users.jeschli.home.file = { + ".emacs.d" = { + source = pkgs.fetchFromGitHub { + owner = "jeschli"; + repo = "emacs.d"; + rev = "8ed6c40"; + sha256 = "1q2y478srwp9f58l8cixnd2wj51909gp1z68k8pjlbjy2mrvibs0"; + }; + recursive = true; + }; + }; + # List services that you want to enable: # Enable the OpenSSH daemon. diff --git a/jeschli/krops.nix b/jeschli/krops.nix index dbf94bd0d..f3964a553 100644 --- a/jeschli/krops.nix +++ b/jeschli/krops.nix @@ -15,6 +15,12 @@ file = "${lib.getEnv "HOME"}/secrets/${name}"; }; } + { + home-manager.git = { + url = https://github.com/rycee/home-manager; + ref = "2ccbf43"; + }; + } ]; in { From 3b1e24235e8ce7f11bd885d4beba4edeb0645b7d Mon Sep 17 00:00:00 2001 From: jeschli Date: Sat, 18 May 2019 16:24:22 +0000 Subject: [PATCH 25/68] j bolide: update to i3 --- jeschli/1systems/bolide/config.nix | 49 ++++++++++--------- .../bolide/hardware-configuration.nix | 1 + 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/jeschli/1systems/bolide/config.nix b/jeschli/1systems/bolide/config.nix index 699a85b58..748a9d7c5 100644 --- a/jeschli/1systems/bolide/config.nix +++ b/jeschli/1systems/bolide/config.nix @@ -2,13 +2,14 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, pkgs, ... }: - +{ config, pkgs, lib, ... }: { imports = [ ./hardware-configuration.nix + # + # ]; @@ -29,7 +30,8 @@ allowDiscards = true; } ]; # networking.hostName = "bolide"; # Define your hostname. - networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. +# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Select internationalisation properties. # i18n = { @@ -103,36 +105,37 @@ # Enable the OpenSSH daemon. services.openssh.enable = true; - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - # Enable CUPS to print documents. - # services.printing.enable = true; + services.xserver = { - # Enable the X11 windowing system. - services.xserver.enable = true; - # services.xserver.layout = "us"; - # services.xserver.xkbOptions = "eurosign:e"; + enable = true; - services.xserver.displayManager.sddm.enable = true; - services.xserver.windowManager.xmonad.enable = true; - services.xserver.windowManager.xmonad.enableContribAndExtras = true; - # Enable touchpad support. - # services.xserver.libinput.enable = true; + desktopManager = { + xfce.enable = true; + gnome3.enable = true; + }; +# # Don't install feh into systemPackages +# # refs +# desktopManager.session = lib.mkForce []; +# +# enable = true; +# display = 11; +# tty = 11; +# +# dpi = 96; - # Enable the KDE Desktop Environment. - # services.xserver.displayManager.sddm.enable = true; - # services.xserver.desktopManager.plasma5.enable = true; + videoDrivers = [ "nvidia" ]; + }; + + services.xserver.windowManager.i3.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. users.extraUsers.jeschli = { isNormalUser = true; + extraGroups = ["docker" "vboxusers" "audio"]; uid = 1000; }; + hardware.pulseaudio.enable = true; # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database # servers. You should change this only after NixOS release notes say you diff --git a/jeschli/1systems/bolide/hardware-configuration.nix b/jeschli/1systems/bolide/hardware-configuration.nix index 183b29e42..042b746ef 100644 --- a/jeschli/1systems/bolide/hardware-configuration.nix +++ b/jeschli/1systems/bolide/hardware-configuration.nix @@ -29,4 +29,5 @@ nix.maxJobs = lib.mkDefault 8; powerManagement.cpuFreqGovernor = "powersave"; + hardware.pulseaudio.enable = true; } From 252c5bd49b08bef4fe0c9a5413ebd53594224d49 Mon Sep 17 00:00:00 2001 From: jeschli Date: Sat, 18 May 2019 18:31:51 +0200 Subject: [PATCH 26/68] j enklave: add jeschli-bolide to write --- jeschli/2configs/git.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jeschli/2configs/git.nix b/jeschli/2configs/git.nix index a26022789..faa8ccf5b 100644 --- a/jeschli/2configs/git.nix +++ b/jeschli/2configs/git.nix @@ -60,7 +60,7 @@ let with git // config.krebs.users; repo: singleton { - user = [ jeschli jeschli-brauerei]; + user = [ jeschli jeschli-brauerei jeschli-bolide]; repo = [ repo ]; perm = push "refs/*" [ non-fast-forward create delete merge ]; } ++ From c8795f6cf870e1e0c0bccc4012290943d114c213 Mon Sep 17 00:00:00 2001 From: jeschli Date: Sat, 18 May 2019 18:34:26 +0200 Subject: [PATCH 27/68] j: add home-manager config --- jeschli/2configs/home-manager/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 jeschli/2configs/home-manager/default.nix diff --git a/jeschli/2configs/home-manager/default.nix b/jeschli/2configs/home-manager/default.nix new file mode 100644 index 000000000..ad8663d58 --- /dev/null +++ b/jeschli/2configs/home-manager/default.nix @@ -0,0 +1,9 @@ +{ + imports = [ + + ]; + home-manager.useUserPackages = true; + home-manager.users.jeschli = { + home.stateVersion = "19.03"; + }; +} From dd8cb1bffbd9f3d33dcca643fbe1eb69f334e4a9 Mon Sep 17 00:00:00 2001 From: jeschli Date: Sat, 18 May 2019 18:48:43 +0000 Subject: [PATCH 28/68] j bolide: home-manager binary --- jeschli/1systems/bolide/config.nix | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/jeschli/1systems/bolide/config.nix b/jeschli/1systems/bolide/config.nix index 748a9d7c5..a9f564f75 100644 --- a/jeschli/1systems/bolide/config.nix +++ b/jeschli/1systems/bolide/config.nix @@ -8,10 +8,9 @@ [ ./hardware-configuration.nix - # - # + - + # ]; krebs.build.host = config.krebs.hosts.bolide; @@ -54,6 +53,8 @@ }; nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ + home-manager + wget vim # system helper ag @@ -94,6 +95,22 @@ zathura ]; + home-manager.useUserPackages = true; + home-manager.users.jeschli = { + home.stateVersion = "19.03"; + }; + + home-manager.users.jeschli.home.file = { + ".emacs.d" = { + source = pkgs.fetchFromGitHub { + owner = "jeschli"; + repo = "emacs.d"; + rev = "8ed6c40"; + sha256 = "1q2y478srwp9f58l8cixnd2wj51909gp1z68k8pjlbjy2mrvibs0"; + }; + recursive = true; + }; + }; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.bash.enableCompletion = true; From 78bade2c387a76b55066027396966f4c5bf4307a Mon Sep 17 00:00:00 2001 From: jeschli Date: Sat, 18 May 2019 18:49:57 +0000 Subject: [PATCH 29/68] j bolide: add home.nix --- jeschli/1systems/bolide/home.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 jeschli/1systems/bolide/home.nix diff --git a/jeschli/1systems/bolide/home.nix b/jeschli/1systems/bolide/home.nix new file mode 100644 index 000000000..cd84ab3fb --- /dev/null +++ b/jeschli/1systems/bolide/home.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: + +{ + home.file = { + ".emacs.d" = { + source = pkgs.fetchFromGitHub { + owner = "jeschli"; + repo = "emacs.d"; + rev = "8ed6c40"; + sha256 = "1q2y478srwp9f58l8cixnd2wj51909gp1z68k8pjlbjy2mrvibs0"; + }; + recursive = true; + }; + ".config/i3/config".text = '' + ''; + }; + +} From 8a44f7f8c8ffa4c47c723b7de647653e980cd6c8 Mon Sep 17 00:00:00 2001 From: jeschli Date: Sat, 18 May 2019 20:55:09 +0200 Subject: [PATCH 30/68] j bolide: add i3 to home.nix --- jeschli/1systems/bolide/home.nix | 153 +++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/jeschli/1systems/bolide/home.nix b/jeschli/1systems/bolide/home.nix index cd84ab3fb..60fee8b67 100644 --- a/jeschli/1systems/bolide/home.nix +++ b/jeschli/1systems/bolide/home.nix @@ -12,6 +12,159 @@ recursive = true; }; ".config/i3/config".text = '' + +set $mod Mod4 + +font pango:monospace 8 + +floating_modifier $mod + +bindsym $mod+Return exec i3-sensible-terminal + +bindsym $mod+Shift+q kill + +bindsym $mod+d exec rofi -modi drun#run -combi-modi drun#run -show combi -show-icons -display-combi run + +bindsym $mod+x exec rofi -modi window -show window -auto-select + +# switch to last used window +bindsym $mod+Tab exec rofi -show window& sleep 0.15 && xdotool key Down + +# change focus +bindsym $mod+j focus left +bindsym $mod+k focus down +bindsym $mod+l focus up +bindsym $mod+semicolon focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# Resizing windows by 10 in i3 using keyboard only +bindsym $mod+Ctrl+Shift+Right resize shrink width 10 px or 10 ppt +bindsym $mod+Ctrl+Shift+Up resize grow height 10 px or 10 ppt +bindsym $mod+Ctrl+Shift+Down resize shrink height 10 px or 10 ppt +bindsym $mod+Ctrl+Shift+Left resize grow width 10 px or 10 ppt + +# move focused window +bindsym $mod+Shift+j move left +bindsym $mod+Shift+k move down +bindsym $mod+Shift+l move up +bindsym $mod+Shift+semicolon move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+h split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+1 workspace $ws1 +bindsym $mod+2 workspace $ws2 +bindsym $mod+3 workspace $ws3 +bindsym $mod+4 workspace $ws4 +bindsym $mod+5 workspace $ws5 +bindsym $mod+6 workspace $ws6 +bindsym $mod+7 workspace $ws7 +bindsym $mod+8 workspace $ws8 +bindsym $mod+9 workspace $ws9 +bindsym $mod+0 workspace $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace $ws1 +bindsym $mod+Shift+2 move container to workspace $ws2 +bindsym $mod+Shift+3 move container to workspace $ws3 +bindsym $mod+Shift+4 move container to workspace $ws4 +bindsym $mod+Shift+5 move container to workspace $ws5 +bindsym $mod+Shift+6 move container to workspace $ws6 +bindsym $mod+Shift+7 move container to workspace $ws7 +bindsym $mod+Shift+8 move container to workspace $ws8 +bindsym $mod+Shift+9 move container to workspace $ws9 +bindsym $mod+Shift+0 move container to workspace $ws10 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + +bindsym $mod+p exec i3-sensible-pager + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym j resize shrink width 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym l resize shrink height 10 px or 10 ppt + bindsym semicolon resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + position top + status_command i3status +} ''; }; From 87e1da05aa253a629e5e188fac4c1a572e9e61de Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 20 May 2019 14:18:40 +0200 Subject: [PATCH 31/68] tv x220: define all the lidSwitch* T_T --- tv/2configs/hw/x220.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tv/2configs/hw/x220.nix b/tv/2configs/hw/x220.nix index 35e7d8941..699b4a87e 100644 --- a/tv/2configs/hw/x220.nix +++ b/tv/2configs/hw/x220.nix @@ -57,6 +57,11 @@ HandleSuspendKey=ignore ''; + # because extraConfig is not extra enough: + services.logind.lidSwitch = "ignore"; + services.logind.lidSwitchDocked = "ignore"; + services.logind.lidSwitchExternalPower = "ignore"; + services.xserver = { videoDriver = "intel"; }; From eb9c9b80cafbb69d858a9914eda1d5aa65745ae5 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 May 2019 10:39:18 +0200 Subject: [PATCH 32/68] github-known-hosts: add new hosts --- krebs/3modules/github-known-hosts.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/krebs/3modules/github-known-hosts.nix b/krebs/3modules/github-known-hosts.nix index def06f17a..bae8b96bf 100644 --- a/krebs/3modules/github-known-hosts.nix +++ b/krebs/3modules/github-known-hosts.nix @@ -28,12 +28,22 @@ "140.82.125.*" "140.82.126.*" "140.82.127.*" + "13.114.40.48" "13.229.188.59" + "13.234.176.102" + "13.234.210.38" + "13.236.229.21" + "13.237.44.5" "13.250.177.223" + "15.164.81.167" "18.194.104.89" "18.195.85.27" "35.159.8.160" + "52.192.72.89" + "52.64.108.95" + "52.69.186.44" "52.74.223.119" + "52.78.231.108" ]; publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; }; From 8837981c5972d745af6ce0a6a5a7d956b579575e Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 May 2019 21:47:43 +0200 Subject: [PATCH 33/68] tv pkgs: add vim overlay --- tv/5pkgs/vim/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tv/5pkgs/vim/default.nix diff --git a/tv/5pkgs/vim/default.nix b/tv/5pkgs/vim/default.nix new file mode 100644 index 000000000..5582be3fd --- /dev/null +++ b/tv/5pkgs/vim/default.nix @@ -0,0 +1,7 @@ +with import ; + +self: super: { + tv = super.tv // { + vimPlugins = mapNixDir (path: self.callPackage path {}) ./.; + }; +} From 36ecf283d253a24f2ff3c434a5cda4f69119beff Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 May 2019 21:48:36 +0200 Subject: [PATCH 34/68] tv vim: move fzf to overlay --- tv/2configs/vim.nix | 10 +--------- tv/5pkgs/vim/fzf.nix | 11 +++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 tv/5pkgs/vim/fzf.nix diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index a45e040e6..948058216 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -14,15 +14,7 @@ let { }; extra-runtimepath = concatMapStringsSep "," (pkg: "${pkg.rtp}") [ - # cannot use pkgs.vimPlugins.fzf-vim as it's missing :Rg - (pkgs.vimUtils.buildVimPlugin { - name = "fzf-2018-11-14"; - src = pkgs.fetchgit { - url = https://github.com/junegunn/fzf.vim; - rev = "ad1833ecbc9153b6e34a4292dc089a58c4bcb8dc"; - sha256 = "1z2q71q6l9hq9fqfqpj1svhyk4yk1bzw1ljhksx4bnpz8gkfbx2m"; - }; - }) + pkgs.tv.vimPlugins.fzf pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree (pkgs.vimUtils.buildVimPlugin { diff --git a/tv/5pkgs/vim/fzf.nix b/tv/5pkgs/vim/fzf.nix new file mode 100644 index 000000000..14b6900b5 --- /dev/null +++ b/tv/5pkgs/vim/fzf.nix @@ -0,0 +1,11 @@ +{ pkgs }: + +# cannot use pkgs.vimPlugins.fzf-vim as it's missing :Rg +pkgs.vimUtils.buildVimPlugin { + name = "fzf-2018-11-14"; + src = pkgs.fetchgit { + url = https://github.com/junegunn/fzf.vim; + rev = "ad1833ecbc9153b6e34a4292dc089a58c4bcb8dc"; + sha256 = "1z2q71q6l9hq9fqfqpj1svhyk4yk1bzw1ljhksx4bnpz8gkfbx2m"; + }; +} From d808a760e15a2ede3699c05f160eddaf81f1efbf Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 May 2019 21:51:13 +0200 Subject: [PATCH 35/68] tv vim: move elixir to overlay --- tv/2configs/vim.nix | 9 +-------- tv/5pkgs/vim/elixir.nix | 9 +++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 tv/5pkgs/vim/elixir.nix diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 948058216..934704295 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -14,17 +14,10 @@ let { }; extra-runtimepath = concatMapStringsSep "," (pkg: "${pkg.rtp}") [ + pkgs.tv.vimPlugins.elixir pkgs.tv.vimPlugins.fzf pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree - (pkgs.vimUtils.buildVimPlugin { - name = "vim-elixir-2018-08-17"; - src = pkgs.fetchgit { - url = https://github.com/elixir-editors/vim-elixir; - rev = "0a847f0faed5ba2d94bb3d51f355c50f37ba025b"; - sha256 = "1jl85wpgywhcvhgw02y8zpvqf0glr4i8522kxpvhsiacb1v1xh04"; - }; - }) (pkgs.vimUtils.buildVimPlugin { name = "vim-syntax-jq"; src = pkgs.fetchgit { diff --git a/tv/5pkgs/vim/elixir.nix b/tv/5pkgs/vim/elixir.nix new file mode 100644 index 000000000..2ffbbc82f --- /dev/null +++ b/tv/5pkgs/vim/elixir.nix @@ -0,0 +1,9 @@ +{ pkgs }: +pkgs.vimUtils.buildVimPlugin { + name = "vim-elixir-2018-08-17"; + src = pkgs.fetchgit { + url = https://github.com/elixir-editors/vim-elixir; + rev = "0a847f0faed5ba2d94bb3d51f355c50f37ba025b"; + sha256 = "1jl85wpgywhcvhgw02y8zpvqf0glr4i8522kxpvhsiacb1v1xh04"; + }; +} From b46cb34eed46dab1cb77f00c3d42efce3e075431 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 May 2019 21:52:20 +0200 Subject: [PATCH 36/68] tv vim: move jq to overlay --- tv/2configs/vim.nix | 9 +-------- tv/5pkgs/vim/jq.nix | 10 ++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 tv/5pkgs/vim/jq.nix diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 934704295..234602aa4 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -16,16 +16,9 @@ let { extra-runtimepath = concatMapStringsSep "," (pkg: "${pkg.rtp}") [ pkgs.tv.vimPlugins.elixir pkgs.tv.vimPlugins.fzf + pkgs.tv.vimPlugins.jq pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree - (pkgs.vimUtils.buildVimPlugin { - name = "vim-syntax-jq"; - src = pkgs.fetchgit { - url = https://github.com/vito-c/jq.vim; - rev = "99d55a300047946a82ecdd7617323a751199ad2d"; - sha256 = "09c94nah47wx0cr556w61h6pfznxld18pfblc3nv51ivbw7cjqyx"; - }; - }) (pkgs.vimUtils.buildVimPlugin { name = "file-line-1.0"; src = pkgs.fetchgit { diff --git a/tv/5pkgs/vim/jq.nix b/tv/5pkgs/vim/jq.nix new file mode 100644 index 000000000..523f49f02 --- /dev/null +++ b/tv/5pkgs/vim/jq.nix @@ -0,0 +1,10 @@ +{ pkgs }: + +pkgs.vimUtils.buildVimPlugin { + name = "vim-syntax-jq"; + src = pkgs.fetchgit { + url = https://github.com/vito-c/jq.vim; + rev = "99d55a300047946a82ecdd7617323a751199ad2d"; + sha256 = "09c94nah47wx0cr556w61h6pfznxld18pfblc3nv51ivbw7cjqyx"; + }; +} From be42a7069de8a328a6363282151ea21050745910 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 May 2019 21:53:17 +0200 Subject: [PATCH 37/68] tv vim: move file-line to overlay --- tv/2configs/vim.nix | 9 +-------- tv/5pkgs/vim/file-line.nix | 10 ++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 tv/5pkgs/vim/file-line.nix diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 234602aa4..657d7a6a6 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -15,18 +15,11 @@ let { extra-runtimepath = concatMapStringsSep "," (pkg: "${pkg.rtp}") [ pkgs.tv.vimPlugins.elixir + pkgs.tv.vimPlugins.file-line pkgs.tv.vimPlugins.fzf pkgs.tv.vimPlugins.jq pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree - (pkgs.vimUtils.buildVimPlugin { - name = "file-line-1.0"; - src = pkgs.fetchgit { - url = git://github.com/bogado/file-line; - rev = "refs/tags/1.0"; - sha256 = "0z47zq9rqh06ny0q8lpcdsraf3lyzn9xvb59nywnarf3nxrk6hx0"; - }; - }) ((rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let name = "hack"; in { diff --git a/tv/5pkgs/vim/file-line.nix b/tv/5pkgs/vim/file-line.nix new file mode 100644 index 000000000..22597265a --- /dev/null +++ b/tv/5pkgs/vim/file-line.nix @@ -0,0 +1,10 @@ +{ pkgs }: + +pkgs.vimUtils.buildVimPlugin { + name = "file-line-1.0"; + src = pkgs.fetchgit { + url = git://github.com/bogado/file-line; + rev = "refs/tags/1.0"; + sha256 = "0z47zq9rqh06ny0q8lpcdsraf3lyzn9xvb59nywnarf3nxrk6hx0"; + }; +} From ec45998cb5665ae005d366e87b2e04fb935906d4 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 May 2019 21:55:28 +0200 Subject: [PATCH 38/68] tv vim: move hack to overlay --- tv/2configs/vim.nix | 44 +---------------------------------------- tv/5pkgs/vim/hack.nix | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 43 deletions(-) create mode 100644 tv/5pkgs/vim/hack.nix diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 657d7a6a6..7419eb674 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -17,52 +17,10 @@ let { pkgs.tv.vimPlugins.elixir pkgs.tv.vimPlugins.file-line pkgs.tv.vimPlugins.fzf + pkgs.tv.vimPlugins.hack pkgs.tv.vimPlugins.jq pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree - ((rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let - name = "hack"; - in { - name = "vim-color-${name}-1.0.2"; - destination = "/colors/${name}.vim"; - text = /* vim */ '' - set background=dark - hi clear - if exists("syntax_on") - syntax clear - endif - - let colors_name = ${toJSON name} - - hi Normal ctermbg=235 - hi Comment ctermfg=242 - hi Constant ctermfg=255 - hi Identifier ctermfg=253 - hi Function ctermfg=253 - hi Statement ctermfg=253 - hi PreProc ctermfg=251 - hi Type ctermfg=251 - hi Delimiter ctermfg=251 - hi Special ctermfg=255 - - hi Garbage ctermbg=088 - hi TabStop ctermbg=016 - hi Todo ctermfg=174 ctermbg=NONE - - hi NixCode ctermfg=040 - hi NixData ctermfg=046 - hi NixQuote ctermfg=071 - - hi diffNewFile ctermfg=207 - hi diffFile ctermfg=207 - hi diffLine ctermfg=207 - hi diffSubname ctermfg=207 - hi diffAdded ctermfg=010 - hi diffRemoved ctermfg=009 - - hi Search cterm=NONE ctermbg=216 - ''; - }))) ((rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let name = "vim"; in { diff --git a/tv/5pkgs/vim/hack.nix b/tv/5pkgs/vim/hack.nix new file mode 100644 index 000000000..2145cc166 --- /dev/null +++ b/tv/5pkgs/vim/hack.nix @@ -0,0 +1,46 @@ +with import ; +{ pkgs }: + +(rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let + name = "hack"; +in { + name = "vim-color-${name}-1.0.2"; + destination = "/colors/${name}.vim"; + text = /* vim */ '' + set background=dark + hi clear + if exists("syntax_on") + syntax clear + endif + + let colors_name = ${toJSON name} + + hi Normal ctermbg=235 + hi Comment ctermfg=242 + hi Constant ctermfg=255 + hi Identifier ctermfg=253 + hi Function ctermfg=253 + hi Statement ctermfg=253 + hi PreProc ctermfg=251 + hi Type ctermfg=251 + hi Delimiter ctermfg=251 + hi Special ctermfg=255 + + hi Garbage ctermbg=088 + hi TabStop ctermbg=016 + hi Todo ctermfg=174 ctermbg=NONE + + hi NixCode ctermfg=040 + hi NixData ctermfg=046 + hi NixQuote ctermfg=071 + + hi diffNewFile ctermfg=207 + hi diffFile ctermfg=207 + hi diffLine ctermfg=207 + hi diffSubname ctermfg=207 + hi diffAdded ctermfg=010 + hi diffRemoved ctermfg=009 + + hi Search cterm=NONE ctermbg=216 + ''; +})) From 9b573a35f24b4d259f909fc191c8123a1aeec7b3 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 May 2019 21:56:25 +0200 Subject: [PATCH 39/68] tv vim: move vim to overlay --- tv/2configs/vim.nix | 14 +------------- tv/5pkgs/vim/vim.nix | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 tv/5pkgs/vim/vim.nix diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 7419eb674..18b69313f 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -19,21 +19,9 @@ let { pkgs.tv.vimPlugins.fzf pkgs.tv.vimPlugins.hack pkgs.tv.vimPlugins.jq + pkgs.tv.vimPlugins.vim pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree - ((rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let - name = "vim"; - in { - name = "vim-syntax-${name}-1.0.0"; - destination = "/syntax/${name}.vim"; - text = /* vim */ '' - ${concatMapStringsSep "\n" (s: /* vim */ '' - syn keyword vimColor${s} ${s} - \ containedin=ALLBUT,vimComment,vimLineComment - hi vimColor${s} ctermfg=${s} - '') (map (i: lpad 3 "0" (toString i)) (range 0 255))} - ''; - }))) ((rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let name = "showsyntax"; in { diff --git a/tv/5pkgs/vim/vim.nix b/tv/5pkgs/vim/vim.nix new file mode 100644 index 000000000..216ab6abb --- /dev/null +++ b/tv/5pkgs/vim/vim.nix @@ -0,0 +1,16 @@ +with import ; +{ pkgs }: + +(rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let + name = "vim"; +in { + name = "vim-syntax-${name}-1.0.0"; + destination = "/syntax/${name}.vim"; + text = /* vim */ '' + ${concatMapStringsSep "\n" (s: /* vim */ '' + syn keyword vimColor${s} ${s} + \ containedin=ALLBUT,vimComment,vimLineComment + hi vimColor${s} ctermfg=${s} + '') (map (i: lpad 3 "0" (toString i)) (range 0 255))} + ''; +})) From 35dcd45cd5245b7976ce68d63cbf0510f432808e Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 May 2019 21:57:24 +0200 Subject: [PATCH 40/68] tv vim: move showsyntax to overlay --- tv/2configs/vim.nix | 25 +------------------------ tv/5pkgs/vim/showsyntax.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 24 deletions(-) create mode 100644 tv/5pkgs/vim/showsyntax.nix diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 18b69313f..819578661 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -19,33 +19,10 @@ let { pkgs.tv.vimPlugins.fzf pkgs.tv.vimPlugins.hack pkgs.tv.vimPlugins.jq + pkgs.tv.vimPlugins.showsyntax pkgs.tv.vimPlugins.vim pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree - ((rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let - name = "showsyntax"; - in { - name = "vim-plugin-${name}-1.0.0"; - destination = "/plugin/${name}.vim"; - text = /* vim */ '' - if exists('g:loaded_showsyntax') - finish - endif - let g:loaded_showsyntax = 0 - - fu! ShowSyntax() - let id = synID(line("."), col("."), 1) - let name = synIDattr(id, "name") - let transName = synIDattr(synIDtrans(id),"name") - if name != transName - let name .= " (" . transName . ")" - endif - echo "Syntax: " . name - endfu - - command! -n=0 -bar ShowSyntax :call ShowSyntax() - ''; - }))) ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-tv" { # # Haskell diff --git a/tv/5pkgs/vim/showsyntax.nix b/tv/5pkgs/vim/showsyntax.nix new file mode 100644 index 000000000..a5547e46a --- /dev/null +++ b/tv/5pkgs/vim/showsyntax.nix @@ -0,0 +1,26 @@ +{ pkgs }: + +(rtp: rtp // { inherit rtp; }) (pkgs.writeTextFile (let + name = "showsyntax"; +in { + name = "vim-plugin-${name}-1.0.0"; + destination = "/plugin/${name}.vim"; + text = /* vim */ '' + if exists('g:loaded_showsyntax') + finish + endif + let g:loaded_showsyntax = 0 + + fu! ShowSyntax() + let id = synID(line("."), col("."), 1) + let name = synIDattr(id, "name") + let transName = synIDattr(synIDtrans(id),"name") + if name != transName + let name .= " (" . transName . ")" + endif + echo "Syntax: " . name + endfu + + command! -n=0 -bar ShowSyntax :call ShowSyntax() + ''; +})) From 86972b5b600e261f6474f61eaf0c7eb8feb91f55 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 May 2019 21:58:16 +0200 Subject: [PATCH 41/68] tv vim: move tv to overlay --- tv/2configs/vim.nix | 52 +------------------------------------------- tv/5pkgs/vim/tv.nix | 53 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 51 deletions(-) create mode 100644 tv/5pkgs/vim/tv.nix diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 819578661..b9509bca3 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -20,60 +20,10 @@ let { pkgs.tv.vimPlugins.hack pkgs.tv.vimPlugins.jq pkgs.tv.vimPlugins.showsyntax + pkgs.tv.vimPlugins.tv pkgs.tv.vimPlugins.vim pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree - ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-tv" { - # - # Haskell - # - "/ftplugin/haskell.vim".text = '' - if exists("g:vim_tv_ftplugin_haskell_loaded") - finish - endif - let g:vim_tv_ftplugin_haskell_loaded = 1 - - setlocal iskeyword+=' - ''; - # - # TODO - # - "/ftdetect/todo.vim".text = '' - au BufRead,BufNewFile TODO set ft=todo - ''; - "/ftplugin/todo.vim".text = '' - setlocal foldmethod=syntax - ''; - "/syntax/todo.vim".text = '' - syn match todoComment /#.*/ - - syn match todoDate /^[1-9]\S*/ - \ nextgroup=todoSummary - - syn region todoSummary - \ contained - \ contains=todoTag - \ start="." end="$\n" - \ nextgroup=todoBlock - - syn match todoTag /\[[A-Za-z]\+\]/hs=s+1,he=e-1 - \ contained - - syn region todoBlock - \ contained - \ contains=Comment - \ fold - \ start="^[^1-9]" end="^[1-9 ]"re=s-1,he=s-1,me=s-1 - - syn sync minlines=1000 - - hi link todoComment Comment - hi todoDate ctermfg=255 - hi todoSummary ctermfg=229 - hi todoBlock ctermfg=248 - hi todoTag ctermfg=217 - ''; - })) ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-syntax-nix-nested" { "/syntax/haskell.vim".text = '' syn region String start=+\[[[:alnum:]]*|+ end=+|]+ diff --git a/tv/5pkgs/vim/tv.nix b/tv/5pkgs/vim/tv.nix new file mode 100644 index 000000000..ae6245b87 --- /dev/null +++ b/tv/5pkgs/vim/tv.nix @@ -0,0 +1,53 @@ +{ pkgs }: + +(rtp: rtp // { inherit rtp; }) (pkgs.write "vim-tv" { + # + # Haskell + # + "/ftplugin/haskell.vim".text = '' + if exists("g:vim_tv_ftplugin_haskell_loaded") + finish + endif + let g:vim_tv_ftplugin_haskell_loaded = 1 + + setlocal iskeyword+=' + ''; + # + # TODO + # + "/ftdetect/todo.vim".text = '' + au BufRead,BufNewFile TODO set ft=todo + ''; + "/ftplugin/todo.vim".text = '' + setlocal foldmethod=syntax + ''; + "/syntax/todo.vim".text = '' + syn match todoComment /#.*/ + + syn match todoDate /^[1-9]\S*/ + \ nextgroup=todoSummary + + syn region todoSummary + \ contained + \ contains=todoTag + \ start="." end="$\n" + \ nextgroup=todoBlock + + syn match todoTag /\[[A-Za-z]\+\]/hs=s+1,he=e-1 + \ contained + + syn region todoBlock + \ contained + \ contains=Comment + \ fold + \ start="^[^1-9]" end="^[1-9 ]"re=s-1,he=s-1,me=s-1 + + syn sync minlines=1000 + + hi link todoComment Comment + hi todoDate ctermfg=255 + hi todoSummary ctermfg=229 + hi todoBlock ctermfg=248 + hi todoTag ctermfg=217 + ''; +}) From 06f8c8986b01bd805191fa452c09369cdafb0777 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 21 May 2019 21:59:18 +0200 Subject: [PATCH 42/68] tv vim: move nix to overlay --- tv/2configs/vim.nix | 218 +----------------------------------------- tv/5pkgs/vim/nix.nix | 222 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 223 insertions(+), 217 deletions(-) create mode 100644 tv/5pkgs/vim/nix.nix diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index b9509bca3..f8d599f7e 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -19,228 +19,12 @@ let { pkgs.tv.vimPlugins.fzf pkgs.tv.vimPlugins.hack pkgs.tv.vimPlugins.jq + pkgs.tv.vimPlugins.nix pkgs.tv.vimPlugins.showsyntax pkgs.tv.vimPlugins.tv pkgs.tv.vimPlugins.vim pkgs.vimPlugins.fzfWrapper pkgs.vimPlugins.undotree - ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-syntax-nix-nested" { - "/syntax/haskell.vim".text = '' - syn region String start=+\[[[:alnum:]]*|+ end=+|]+ - - hi link ConId Identifier - hi link VarId Identifier - hi link hsDelimiter Delimiter - ''; - "/syntax/nix.vim".text = '' - "" Quit when a (custom) syntax file was already loaded - "if exists("b:current_syntax") - " finish - "endif - - "setf nix - - " Ref - syn match NixID /[a-zA-Z\_][a-zA-Z0-9\_\'\-]*/ - syn match NixINT /\<[0-9]\+\>/ - syn match NixPATH /[a-zA-Z0-9\.\_\-\+]*\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ - syn match NixHPATH /\~\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ - syn match NixSPATH /<[a-zA-Z0-9\.\_\-\+]\+\(\/[a-zA-Z0-9\.\_\-\+]\+\)*>/ - syn match NixURI /[a-zA-Z][a-zA-Z0-9\+\-\.]*:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']\+/ - syn region NixSTRING - \ matchgroup=NixSTRING - \ start='"' - \ skip='\\"' - \ end='"' - syn region NixIND_STRING - \ matchgroup=NixIND_STRING - \ start="'''" - \ skip="'''\('\|[$]\|\\[nrt]\)" - \ end="'''" - - syn match NixOther /[-!+&<>|():/;=.,?\[\]*@]/ - - syn match NixCommentMatch /\(^\|\s\)#.*/ - syn region NixCommentRegion start="/\*" end="\*/" - - hi link NixCode Statement - hi link NixData Constant - hi link NixComment Comment - - hi link NixCommentMatch NixComment - hi link NixCommentRegion NixComment - hi link NixID NixCode - hi link NixINT NixData - hi link NixPATH NixData - hi link NixHPATH NixData - hi link NixSPATH NixData - hi link NixURI NixData - hi link NixSTRING NixData - hi link NixIND_STRING NixData - - hi link NixEnter NixCode - hi link NixOther NixCode - hi link NixQuote NixData - - syn cluster nix_has_dollar_curly contains=@nix_ind_strings,@nix_strings - syn cluster nix_ind_strings contains=NixIND_STRING - syn cluster nix_strings contains=NixSTRING - - ${concatStringsSep "\n" (mapAttrsToList (name: { - extraStart ? null, - lang ? name - }: - let - startAlts = filter isString [ - ''/\* ${name} \*/'' - extraStart - ]; - sigil = ''\(${concatStringsSep ''\|'' startAlts}\)[ \t\r\n]*''; - in /* vim */ '' - syn include @nix_${lang}_syntax syntax/${lang}.vim - if exists("b:current_syntax") - unlet b:current_syntax - endif - - syn match nix_${lang}_sigil - \ X${replaceStrings ["X"] ["\\X"] sigil}\ze\('''\|"\)X - \ nextgroup=nix_${lang}_region_IND_STRING,nix_${lang}_region_STRING - \ transparent - - syn region nix_${lang}_region_STRING - \ matchgroup=NixSTRING - \ start='"' - \ skip='\\"' - \ end='"' - \ contained - \ contains=@nix_${lang}_syntax - \ transparent - - syn region nix_${lang}_region_IND_STRING - \ matchgroup=NixIND_STRING - \ start="'''" - \ skip="'''\('\|[$]\|\\[nrt]\)" - \ end="'''" - \ contained - \ contains=@nix_${lang}_syntax - \ transparent - - syn cluster nix_ind_strings - \ add=nix_${lang}_region_IND_STRING - - syn cluster nix_strings - \ add=nix_${lang}_region_STRING - - " This is required because containedin isn't transitive. - syn cluster nix_has_dollar_curly - \ add=@nix_${lang}_syntax - '') (let - - capitalize = s: let - xs = stringToCharacters s; - in - toUpper (head xs) + concatStrings (tail xs); - - alts = xs: ''\(${concatStringsSep ''\|'' xs}\)''; - def = k: ''${k}[ \t\r\n]*=''; - writer = k: ''write${k}[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)''; - - writerExt = k: writerName ''[^"]*\.${k}''; - writerName = k: ''write[^ \t\r\n]*[ \t\r\n]*"${k}"''; - - in { - c = {}; - cabal = {}; - diff = {}; - haskell = {}; - jq.extraStart = alts [ - (writer "Jq") - (writerExt "jq") - ]; - javascript.extraStart = ''/\* js \*/''; - lua = {}; - python.extraStart = ''/\* py \*/''; - sed.extraStart = writer "Sed"; - sh.extraStart = let - phases = [ - "unpack" - "patch" - "configure" - "build" - "check" - "install" - "fixup" - "installCheck" - "dist" - ]; - shells = [ - "ash" - "bash" - "dash" - ]; - in alts [ - (def "shellHook") - (def "${alts phases}Phase") - (def "${alts ["pre" "post"]}${alts (map capitalize phases)}") - (writer (alts (map capitalize shells))) - ]; - yaml = {}; - vim.extraStart = alts [ - (def ''"[^"]*\.vim"\.text'') - (writerExt "vim") - (writerName ''\([^"]*\.\)\?vimrc'') - ]; - xdefaults = {}; - xmodmap = {}; - }))} - - " Clear syntax that interferes with nixINSIDE_DOLLAR_CURLY. - syn clear shVarAssign - - syn region nixINSIDE_DOLLAR_CURLY - \ matchgroup=NixEnter - \ start="[$]{" - \ end="}" - \ contains=TOP - \ containedin=@nix_has_dollar_curly - \ transparent - - syn region nix_inside_curly - \ matchgroup=NixEnter - \ start="{" - \ end="}" - \ contains=TOP - \ containedin=nixINSIDE_DOLLAR_CURLY,nix_inside_curly - \ transparent - - syn match NixQuote /'''\(''$\|\\.\)/he=s+2 - \ containedin=@nix_ind_strings - \ contained - - syn match NixQuote /'''\('\|\\.\)/he=s+1 - \ containedin=@nix_ind_strings - \ contained - - syn match NixQuote /\\./he=s+1 - \ containedin=@nix_strings - \ contained - - syn sync fromstart - - let b:current_syntax = "nix" - - set isk=@,48-57,_,192-255,-,' - ''; - "/syntax/sed.vim".text = '' - syn region sedBranch - \ matchgroup=sedFunction start="T" - \ matchgroup=sedSemicolon end=";\|$" - \ contains=sedWhitespace - ''; - "/syntax/xmodmap.vim".text = '' - syn match xmodmapComment /^\s*!.*/ - ''; - })) ]; dirs = { diff --git a/tv/5pkgs/vim/nix.nix b/tv/5pkgs/vim/nix.nix new file mode 100644 index 000000000..a58a45b2d --- /dev/null +++ b/tv/5pkgs/vim/nix.nix @@ -0,0 +1,222 @@ +with import ; +{ pkgs }: + +(rtp: rtp // { inherit rtp; }) (pkgs.write "vim-syntax-nix-nested" { + "/syntax/haskell.vim".text = '' + syn region String start=+\[[[:alnum:]]*|+ end=+|]+ + + hi link ConId Identifier + hi link VarId Identifier + hi link hsDelimiter Delimiter + ''; + "/syntax/nix.vim".text = '' + "" Quit when a (custom) syntax file was already loaded + "if exists("b:current_syntax") + " finish + "endif + + "setf nix + + " Ref + syn match NixID /[a-zA-Z\_][a-zA-Z0-9\_\'\-]*/ + syn match NixINT /\<[0-9]\+\>/ + syn match NixPATH /[a-zA-Z0-9\.\_\-\+]*\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ + syn match NixHPATH /\~\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ + syn match NixSPATH /<[a-zA-Z0-9\.\_\-\+]\+\(\/[a-zA-Z0-9\.\_\-\+]\+\)*>/ + syn match NixURI /[a-zA-Z][a-zA-Z0-9\+\-\.]*:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']\+/ + syn region NixSTRING + \ matchgroup=NixSTRING + \ start='"' + \ skip='\\"' + \ end='"' + syn region NixIND_STRING + \ matchgroup=NixIND_STRING + \ start="'''" + \ skip="'''\('\|[$]\|\\[nrt]\)" + \ end="'''" + + syn match NixOther /[-!+&<>|():/;=.,?\[\]*@]/ + + syn match NixCommentMatch /\(^\|\s\)#.*/ + syn region NixCommentRegion start="/\*" end="\*/" + + hi link NixCode Statement + hi link NixData Constant + hi link NixComment Comment + + hi link NixCommentMatch NixComment + hi link NixCommentRegion NixComment + hi link NixID NixCode + hi link NixINT NixData + hi link NixPATH NixData + hi link NixHPATH NixData + hi link NixSPATH NixData + hi link NixURI NixData + hi link NixSTRING NixData + hi link NixIND_STRING NixData + + hi link NixEnter NixCode + hi link NixOther NixCode + hi link NixQuote NixData + + syn cluster nix_has_dollar_curly contains=@nix_ind_strings,@nix_strings + syn cluster nix_ind_strings contains=NixIND_STRING + syn cluster nix_strings contains=NixSTRING + + ${concatStringsSep "\n" (mapAttrsToList (name: { + extraStart ? null, + lang ? name + }: + let + startAlts = filter isString [ + ''/\* ${name} \*/'' + extraStart + ]; + sigil = ''\(${concatStringsSep ''\|'' startAlts}\)[ \t\r\n]*''; + in /* vim */ '' + syn include @nix_${lang}_syntax syntax/${lang}.vim + if exists("b:current_syntax") + unlet b:current_syntax + endif + + syn match nix_${lang}_sigil + \ X${replaceStrings ["X"] ["\\X"] sigil}\ze\('''\|"\)X + \ nextgroup=nix_${lang}_region_IND_STRING,nix_${lang}_region_STRING + \ transparent + + syn region nix_${lang}_region_STRING + \ matchgroup=NixSTRING + \ start='"' + \ skip='\\"' + \ end='"' + \ contained + \ contains=@nix_${lang}_syntax + \ transparent + + syn region nix_${lang}_region_IND_STRING + \ matchgroup=NixIND_STRING + \ start="'''" + \ skip="'''\('\|[$]\|\\[nrt]\)" + \ end="'''" + \ contained + \ contains=@nix_${lang}_syntax + \ transparent + + syn cluster nix_ind_strings + \ add=nix_${lang}_region_IND_STRING + + syn cluster nix_strings + \ add=nix_${lang}_region_STRING + + " This is required because containedin isn't transitive. + syn cluster nix_has_dollar_curly + \ add=@nix_${lang}_syntax + '') (let + + # TODO move this higher + capitalize = s: let + xs = stringToCharacters s; + in + toUpper (head xs) + concatStrings (tail xs); + + alts = xs: ''\(${concatStringsSep ''\|'' xs}\)''; + def = k: ''${k}[ \t\r\n]*=''; + writer = k: ''write${k}[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)''; + + writerExt = k: writerName ''[^"]*\.${k}''; + writerName = k: ''write[^ \t\r\n]*[ \t\r\n]*"${k}"''; + + in { + c = {}; + cabal = {}; + diff = {}; + haskell = {}; + jq.extraStart = alts [ + (writer "Jq") + (writerExt "jq") + ]; + javascript.extraStart = ''/\* js \*/''; + lua = {}; + #nginx = {}; + python.extraStart = ''/\* py \*/''; + sed.extraStart = writer "Sed"; + sh.extraStart = let + phases = [ + "unpack" + "patch" + "configure" + "build" + "check" + "install" + "fixup" + "installCheck" + "dist" + ]; + shells = [ + "ash" + "bash" + "dash" + ]; + in alts [ + (def "shellHook") + (def "${alts phases}Phase") + (def "${alts ["pre" "post"]}${alts (map capitalize phases)}") + (writer (alts (map capitalize shells))) + ]; + yaml = {}; + vim.extraStart = alts [ + (def ''"[^"]*\.vim"\.text'') + (writerExt "vim") + (writerName ''\([^"]*\.\)\?vimrc'') + ]; + xdefaults = {}; + xmodmap = {}; + }))} + + " Clear syntax that interferes with nixINSIDE_DOLLAR_CURLY. + syn clear shVarAssign + + syn region nixINSIDE_DOLLAR_CURLY + \ matchgroup=NixEnter + \ start="[$]{" + \ end="}" + \ contains=TOP + \ containedin=@nix_has_dollar_curly + \ transparent + + syn region nix_inside_curly + \ matchgroup=NixEnter + \ start="{" + \ end="}" + \ contains=TOP + \ containedin=nixINSIDE_DOLLAR_CURLY,nix_inside_curly + \ transparent + + syn match NixQuote /'''\(''$\|\\.\)/he=s+2 + \ containedin=@nix_ind_strings + \ contained + + syn match NixQuote /'''\('\|\\.\)/he=s+1 + \ containedin=@nix_ind_strings + \ contained + + syn match NixQuote /\\./he=s+1 + \ containedin=@nix_strings + \ contained + + syn sync fromstart + + let b:current_syntax = "nix" + + set isk=@,48-57,_,192-255,-,' + ''; + "/syntax/sed.vim".text = '' + syn region sedBranch + \ matchgroup=sedFunction start="T" + \ matchgroup=sedSemicolon end=";\|$" + \ contains=sedWhitespace + ''; + "/syntax/xmodmap.vim".text = '' + syn match xmodmapComment /^\s*!.*/ + ''; +}) From f846ad7bea7bfb201d3e8c7adbc7e4a4c21c604e Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:01:10 +0200 Subject: [PATCH 43/68] kruck.r: add video.kruck.r alias --- krebs/3modules/external/palo.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/krebs/3modules/external/palo.nix b/krebs/3modules/external/palo.nix index cefac0959..8510cb9ae 100644 --- a/krebs/3modules/external/palo.nix +++ b/krebs/3modules/external/palo.nix @@ -34,7 +34,10 @@ in { retiolum = { ip4.addr = "10.243.23.3"; tinc.port = 720; - aliases = [ "kruck.r" ]; + aliases = [ + "kruck.r" + "video.kruck.r" + ]; tinc.pubkey = tinc-for "palo"; }; }; From c8784043f10e6c5456816e2704f9e01cf1c366ee Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:01:49 +0200 Subject: [PATCH 44/68] schasch.r: add syncthing.id --- krebs/3modules/external/palo.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/krebs/3modules/external/palo.nix b/krebs/3modules/external/palo.nix index 8510cb9ae..05808714c 100644 --- a/krebs/3modules/external/palo.nix +++ b/krebs/3modules/external/palo.nix @@ -52,6 +52,7 @@ in { tinc.pubkey = tinc-for "palo"; }; }; + syncthing.id = "FLY7DHI-TJLEQBJ-JZNC4YV-NBX53Z2-ZBRWADL-BKSFXYZ-L4FMDVH-MOSEVAQ"; }; workhorse = { owner = config.krebs.users.palo; From 64539ffaa463db7a8d9f01953fba3fd9a2bba0ec Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:02:30 +0200 Subject: [PATCH 45/68] l prism.r: add codi.lassul.us --- krebs/3modules/lass/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/krebs/3modules/lass/default.nix b/krebs/3modules/lass/default.nix index 41f3852b9..f4c8f5c6a 100644 --- a/krebs/3modules/lass/default.nix +++ b/krebs/3modules/lass/default.nix @@ -35,6 +35,7 @@ in { default._domainkey 60 IN TXT "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDUv3DMndFellqu208feABEzT/PskOfTSdJCOF/HELBR0PHnbBeRoeHEm9XAcOe/Mz2t/ysgZ6JFXeFxCtoM5fG20brUMRzsVRxb9Ur5cEvOYuuRrbChYcKa+fopu8pYrlrqXD3miHISoy6ErukIYCRpXWUJHi1TlNQhLWFYqAaywIDAQAB" cache 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr} cgit 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr} + codi 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr} go 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr} io 60 IN NS ions.lassul.us. ions 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr} From 441ae45dc78e188493ad1bb5e9e075a5e4fbe86a Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:04:11 +0200 Subject: [PATCH 46/68] l daedalus.r: add altcoins pkgs --- lass/1systems/daedalus/config.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lass/1systems/daedalus/config.nix b/lass/1systems/daedalus/config.nix index 6e3df12f0..df8868034 100644 --- a/lass/1systems/daedalus/config.nix +++ b/lass/1systems/daedalus/config.nix @@ -57,6 +57,8 @@ with import ; { krebs.per-user.bitcoin.packages = [ pkgs.electrum + pkgs.electron-cash + pkgs.altcoins.litecoin ]; users.extraUsers = { bitcoin = { From 34791532ac850fd575f5b23cc25296409a19eed2 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:05:02 +0200 Subject: [PATCH 47/68] l mors.r: add free_music sync --- lass/1systems/mors/config.nix | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/lass/1systems/mors/config.nix b/lass/1systems/mors/config.nix index f911b79d6..5076beeef 100644 --- a/lass/1systems/mors/config.nix +++ b/lass/1systems/mors/config.nix @@ -49,14 +49,31 @@ with import ; ]; } { - krebs.syncthing.folders."the_playlist" = { - path = "/home/lass/tmp/the_playlist"; - peers = [ "mors" "phone" "prism" ]; + krebs.syncthing = { + peers.schasch.addresses = [ "schasch.r:22000" ]; + folders = { + the_playlist = { + path = "/home/lass/tmp/the_playlist"; + peers = [ "mors" "phone" "prism" ]; + }; + free_music = { + id = "mu9mn-zgvsw"; + path = "/home/lass/tmp/free_music"; + peers = [ "mors" "schasch" ]; + }; + }; }; - krebs.permown."/home/lass/tmp/the_playlist" = { - owner = "lass"; - group = "syncthing"; - umask = "0007"; + krebs.permown = { + "/home/lass/tmp/free_music" = { + owner = "lass"; + group = "syncthing"; + umask = "0007"; + }; + "/home/lass/tmp/the_playlist" = { + owner = "lass"; + group = "syncthing"; + umask = "0007"; + }; }; } { From ac0749765211031c9ac677b2f9c6907457ae60a3 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:18:24 +0200 Subject: [PATCH 48/68] syncthing: add more options, remove uneeded id --- krebs/3modules/syncthing.nix | 39 ++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/krebs/3modules/syncthing.nix b/krebs/3modules/syncthing.nix index 897ba1e7f..9c6acfb0c 100644 --- a/krebs/3modules/syncthing.nix +++ b/krebs/3modules/syncthing.nix @@ -22,7 +22,7 @@ let getApiKey = pkgs.writeDash "getAPIKey" '' ${pkgs.libxml2}/bin/xmllint \ --xpath 'string(configuration/gui/apikey)'\ - ${config.services.syncthing.dataDir}/config.xml + ${config.services.syncthing.configDir}/config.xml ''; updateConfig = pkgs.writeDash "merge-syncthing-config" '' @@ -31,9 +31,9 @@ let ${pkgs.untilport}/bin/untilport localhost 8384 API_KEY=$(${getApiKey}) CFG=$(${pkgs.curl}/bin/curl -Ss -H "X-API-Key: $API_KEY" localhost:8384/rest/system/config) - echo "$CFG" | ${pkgs.jq}/bin/jq -s '.[] * { - "devices": ${builtins.toJSON devices}, - "folders": ${builtins.toJSON folders} + echo "$CFG" | ${pkgs.jq}/bin/jq -s '.[] as $in | $in * { + "devices": (${builtins.toJSON devices}${optionalString (! cfg.overridePeers) " + $in.devices"}), + "folders": (${builtins.toJSON folders}${optionalString (! cfg.overrideFolders) " + $in.folders"}) }' | ${pkgs.curl}/bin/curl -Ss -H "X-API-Key: $API_KEY" localhost:8384/rest/system/config -d @- ${pkgs.curl}/bin/curl -Ss -H "X-API-Key: $API_KEY" localhost:8384/rest/system/restart -X POST ''; @@ -45,11 +45,6 @@ in enable = mkEnableOption "syncthing-init"; - id = mkOption { - type = types.str; - default = config.krebs.build.host.name; - }; - cert = mkOption { type = types.nullOr types.absolute-pathname; default = null; @@ -60,6 +55,13 @@ in default = null; }; + overridePeers = mkOption { + type = types.bool; + default = true; + description = '' + Whether to delete the peers which are not configured via the peers option + ''; + }; peers = mkOption { default = {}; type = types.attrsOf (types.submodule ({ @@ -80,6 +82,13 @@ in })); }; + overrideFolders = mkOption { + type = types.bool; + default = true; + description = '' + Whether to delete the folders which are not configured via the peers option + ''; + }; folders = mkOption { default = {}; type = types.attrsOf (types.submodule ({ config, ... }: { @@ -135,14 +144,14 @@ in systemd.services.syncthing = mkIf (cfg.cert != null || cfg.key != null) { preStart = '' ${optionalString (cfg.cert != null) '' - cp ${toString cfg.cert} ${config.services.syncthing.dataDir}/cert.pem - chown ${config.services.syncthing.user}:${config.services.syncthing.group} ${config.services.syncthing.dataDir}/cert.pem - chmod 400 ${config.services.syncthing.dataDir}/cert.pem + cp ${toString cfg.cert} ${config.services.syncthing.configDir}/cert.pem + chown ${config.services.syncthing.user}:${config.services.syncthing.group} ${config.services.syncthing.configDir}/cert.pem + chmod 400 ${config.services.syncthing.configDir}/cert.pem ''} ${optionalString (cfg.key != null) '' - cp ${toString cfg.key} ${config.services.syncthing.dataDir}/key.pem - chown ${config.services.syncthing.user}:${config.services.syncthing.group} ${config.services.syncthing.dataDir}/key.pem - chmod 400 ${config.services.syncthing.dataDir}/key.pem + cp ${toString cfg.key} ${config.services.syncthing.configDir}/key.pem + chown ${config.services.syncthing.user}:${config.services.syncthing.group} ${config.services.syncthing.configDir}/key.pem + chmod 400 ${config.services.syncthing.configDir}/key.pem ''} ''; }; From e0af72f1f3531576caee2608cf407b8bb4c05ea2 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:19:37 +0200 Subject: [PATCH 49/68] l mors.r: switch wifi card --- lass/1systems/mors/physical.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lass/1systems/mors/physical.nix b/lass/1systems/mors/physical.nix index 25425f146..6828d70de 100644 --- a/lass/1systems/mors/physical.nix +++ b/lass/1systems/mors/physical.nix @@ -22,7 +22,7 @@ }; services.udev.extraRules = '' - SUBSYSTEM=="net", ATTR{address}=="10:0b:a9:72:f4:88", NAME="wl0" + SUBSYSTEM=="net", DEVPATH=="/devices/pci*/*1c.1/*/net/*", NAME="wl0" SUBSYSTEM=="net", ATTR{address}=="f0:de:f1:c4:7a:f1", NAME="et0" ''; From 86e5815ba3b05acbd49aa910dbabdfbb21de0e23 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:20:45 +0200 Subject: [PATCH 50/68] l prism.r: enable codimd --- lass/1systems/prism/config.nix | 1 + lass/2configs/codimd.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 lass/2configs/codimd.nix diff --git a/lass/1systems/prism/config.nix b/lass/1systems/prism/config.nix index d7b0b701a..57a12be22 100644 --- a/lass/1systems/prism/config.nix +++ b/lass/1systems/prism/config.nix @@ -195,6 +195,7 @@ with import ; }; } + { services.taskserver = { enable = true; diff --git a/lass/2configs/codimd.nix b/lass/2configs/codimd.nix new file mode 100644 index 000000000..5f802148b --- /dev/null +++ b/lass/2configs/codimd.nix @@ -0,0 +1,28 @@ +{ config, pkgs, ... }: +with import ; + +{ + services.nginx.virtualHosts.codimd = { + enableACME = true; + addSSL = true; + serverName = "codi.lassul.us"; + locations."/".extraConfig = '' + client_max_body_size 4G; + proxy_set_header Host $host; + proxy_pass http://localhost:3091; + ''; + }; + + services.codimd = { + enable = true; + configuration = { + db = { + dialect = "sqlite"; + storage = "/var/lib/codimd/db.codimd.sqlite"; + useCDN = false; + }; + port = 3091; + }; + }; +} + From 418e9f566511af814a4b3bf4c653cca036796a73 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:24:31 +0200 Subject: [PATCH 51/68] l prism.r: export download/finished directly --- lass/1systems/prism/config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lass/1systems/prism/config.nix b/lass/1systems/prism/config.nix index 57a12be22..e33d1ca9f 100644 --- a/lass/1systems/prism/config.nix +++ b/lass/1systems/prism/config.nix @@ -383,7 +383,7 @@ with import ; ''; fileSystems."/export/download" = { - device = "/var/lib/containers/yellow/var/download"; + device = "/var/lib/containers/yellow/var/download/finished"; options = [ "bind" ]; }; services.nfs.server = { From 65907391192875d0051f92950516a70919272c26 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:25:20 +0200 Subject: [PATCH 52/68] l prism.r: allow nfs mount from retiolum --- lass/1systems/prism/config.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lass/1systems/prism/config.nix b/lass/1systems/prism/config.nix index e33d1ca9f..dbbcbc5d1 100644 --- a/lass/1systems/prism/config.nix +++ b/lass/1systems/prism/config.nix @@ -396,6 +396,12 @@ with import ; statdPort = 4000; }; krebs.iptables.tables.filter.INPUT.rules = [ + { predicate = "-i retiolum -p tcp --dport 111"; target = "ACCEPT"; } + { predicate = "-i retiolum -p udp --dport 111"; target = "ACCEPT"; } + { predicate = "-i retiolum -p tcp --dport 2049"; target = "ACCEPT"; } + { predicate = "-i retiolum -p udp --dport 2049"; target = "ACCEPT"; } + { predicate = "-i retiolum -p tcp --dport 4000:4002"; target = "ACCEPT"; } + { predicate = "-i retiolum -p udp --dport 4000:4002"; target = "ACCEPT"; } { predicate = "-i wiregrill -p tcp --dport 111"; target = "ACCEPT"; } { predicate = "-i wiregrill -p udp --dport 111"; target = "ACCEPT"; } { predicate = "-i wiregrill -p tcp --dport 2049"; target = "ACCEPT"; } From 4d48a1e10942f2885f9728d736f7c87b58780982 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:32:59 +0200 Subject: [PATCH 53/68] l prism.r: add rsa hostKey --- lass/1systems/prism/config.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lass/1systems/prism/config.nix b/lass/1systems/prism/config.nix index dbbcbc5d1..eec8e34b8 100644 --- a/lass/1systems/prism/config.nix +++ b/lass/1systems/prism/config.nix @@ -463,4 +463,10 @@ with import ; enable = true; freeMemThreshold = 5; }; + + # prism rsa hack + services.openssh.hostKeys = [{ + path = toString + "ssh.id_rsa"; + type = "rsa"; + }]; } From 14b4c59c5bcc9c6414ecd147436f234f5aa3f133 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:34:59 +0200 Subject: [PATCH 54/68] l browsers: remove broken krebsgold :( --- lass/2configs/browsers.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/lass/2configs/browsers.nix b/lass/2configs/browsers.nix index d214e224d..c0085995d 100644 --- a/lass/2configs/browsers.nix +++ b/lass/2configs/browsers.nix @@ -66,7 +66,6 @@ in { extensions = [ "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin "dbepggeogbaibhgnhhndojpepiihcmeb" # vimium - "liloimnbhkghhdhlamdjipkmadhpcjmn" # krebsgold ]; }; From 74d0821e3a1207952cf639ac24009e7533aeff17 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:35:43 +0200 Subject: [PATCH 55/68] l: add more mail addresses --- lass/2configs/exim-smarthost.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lass/2configs/exim-smarthost.nix b/lass/2configs/exim-smarthost.nix index 4216bd67a..d1e6b195b 100644 --- a/lass/2configs/exim-smarthost.nix +++ b/lass/2configs/exim-smarthost.nix @@ -103,6 +103,9 @@ with import ; { from = "lobsters@lassul.us"; to = lass.mail; } { from = "fysitech@lassul.us"; to = lass.mail; } { from = "threema@lassul.us"; to = lass.mail; } + { from = "ubisoft@lassul.us"; to = lass.mail; } + { from = "kottezeller@lassul.us"; to = lass.mail; } + { from = "pie@lassul.us"; to = lass.mail; } ]; system-aliases = [ { from = "mailer-daemon"; to = "postmaster"; } From a5160c8d4f17fd9baf66aabcc8c5535e4f471a3e Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:37:05 +0200 Subject: [PATCH 56/68] l radio: add correct hostname headers --- lass/2configs/radio.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 88899c554..7960db564 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -97,7 +97,7 @@ in { services.icecast = { enable = true; - hostname = "config.krebs.build.host.name"; + hostname = "radio.lassul.us"; admin.password = admin-password; extraConf = '' @@ -218,6 +218,11 @@ in { forceSSL = true; enableACME = true; locations."/".extraConfig = '' + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Real-IP $remote_addr; proxy_pass http://localhost:8000; ''; locations."/recent".extraConfig = '' From ab0d80fde8a990c3522ac13e4ddd91c23e349391 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:37:33 +0200 Subject: [PATCH 57/68] l network-manager: randomize mac addresses --- lass/2configs/network-manager.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lass/2configs/network-manager.nix b/lass/2configs/network-manager.nix index 5b890b591..ab27eb841 100644 --- a/lass/2configs/network-manager.nix +++ b/lass/2configs/network-manager.nix @@ -15,6 +15,8 @@ }; }; networking.networkmanager = { + ethernet.macAddress = "random"; + wifi.macAddress = "random"; enable = true; unmanaged = [ "docker*" From 4c7f444c70c48b0230019d4b2e7f17519a4f3d1a Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:38:23 +0200 Subject: [PATCH 58/68] l radio: secure radio mounts with password --- lass/2configs/radio.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 7960db564..49d093a6d 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -100,9 +100,14 @@ in { hostname = "radio.lassul.us"; admin.password = admin-password; extraConf = '' - - ${source-password} - + + /radio.mp3 + ${source-password} + + + /radio.ogg + ${source-password} + ''; }; From 78a3cfb6fff1488437d22834709ffd04b287b819 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:39:56 +0200 Subject: [PATCH 59/68] l radio: fix Reaktor pattern --- lass/2configs/radio.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 49d093a6d..b4efd42fc 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -199,8 +199,8 @@ in { workdir = config.krebs.reaktor2.the_playlist.stateDir; hooks.PRIVMSG = [ { - activate = "match"; - pattern = ''!([^ ]+)(?:\s*(.*))?''; + #activate = "match"; + pattern = "^\\s*([0-9A-Za-z._][0-9A-Za-z._-]*)(?:\\s+(.*\\S))?\\s*$"; command = 1; arguments = [2]; commands = { From a122fec9e559e8050f03e6cd0c348490636bc9dd Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:40:24 +0200 Subject: [PATCH 60/68] l retiolum: remove dishfire as supernode --- lass/2configs/retiolum.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/lass/2configs/retiolum.nix b/lass/2configs/retiolum.nix index fb76c5735..5a87d52af 100644 --- a/lass/2configs/retiolum.nix +++ b/lass/2configs/retiolum.nix @@ -20,7 +20,6 @@ "prism" "gum" "ni" - "dishfire" ]; }; From 65c2a882482a8c9ceeebff68dc38be83ab44ee12 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:40:44 +0200 Subject: [PATCH 61/68] l retiolum: enable localDiscovery --- lass/2configs/retiolum.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lass/2configs/retiolum.nix b/lass/2configs/retiolum.nix index 5a87d52af..9932f8172 100644 --- a/lass/2configs/retiolum.nix +++ b/lass/2configs/retiolum.nix @@ -21,6 +21,9 @@ "gum" "ni" ]; + extraConfig = '' + LocalDiscovery = yes + ''; }; nixpkgs.config.packageOverrides = pkgs: { From b216553984b5b3fadb297bdf2f8f019daa1c957b Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:47:34 +0200 Subject: [PATCH 62/68] l syncthing: don't share sync with phone --- lass/2configs/syncthing.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lass/2configs/syncthing.nix b/lass/2configs/syncthing.nix index 48f2625c1..25712f4f3 100644 --- a/lass/2configs/syncthing.nix +++ b/lass/2configs/syncthing.nix @@ -1,5 +1,7 @@ { config, pkgs, ... }: with import ; let - peers = mapAttrs (n: v: { id = v.syncthing.id; }) (filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts); + all_peers = filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts; + own_peers = filterAttrs (n: v: v.owner.name == "lass") all_peers; + mk_peers = mapAttrs (n: v: { id = v.syncthing.id; }); in { services.syncthing = { enable = true; @@ -14,8 +16,8 @@ in { enable = true; cert = toString ; key = toString ; - peers = peers; - folders."/home/lass/sync".peers = attrNames peers; + peers = mk_peers all_peers; + folders."/home/lass/sync".peers = attrNames (filterAttrs (n: v: n != "phone") own_peers); }; system.activationScripts.syncthing-home = '' From dda92fcf0bc438186d6880b6bd6650f799d249b5 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:47:58 +0200 Subject: [PATCH 63/68] l syncthing: fix permissions of sync --- lass/2configs/syncthing.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lass/2configs/syncthing.nix b/lass/2configs/syncthing.nix index 25712f4f3..d4df17b9a 100644 --- a/lass/2configs/syncthing.nix +++ b/lass/2configs/syncthing.nix @@ -25,8 +25,9 @@ in { ''; krebs.permown."/home/lass/sync" = { + file-mode = "u+rw,g+rw"; owner = "lass"; group = "syncthing"; - umask = "0007"; + umask = "0002"; }; } From 0c9a0c690e6ec575f7e72af3a8a91096c60c21e3 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:48:42 +0200 Subject: [PATCH 64/68] l domsen: add jarugadesign user, mail & page --- lass/2configs/websites/domsen.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix index 2131c7c62..865186481 100644 --- a/lass/2configs/websites/domsen.nix +++ b/lass/2configs/websites/domsen.nix @@ -26,6 +26,7 @@ in { ./default.nix ./sqlBackup.nix (servePage [ "reich-gebaeudereinigung.de" "www.reich-gebaeudereinigung.de" ]) + (servePage [ "jarugadesign.de" "www.jarugadesign.de" ]) (servePage [ "freemonkey.art" "www.freemonkey.art" @@ -141,6 +142,7 @@ in { { from = "akayguen@freemonkey.art"; to ="akayguen"; } { from = "bui@freemonkey.art"; to ="bui"; } { from = "kontakt@alewis.de"; to ="klabusterbeere"; } + { from = "hallo@jarugadesign.de"; to ="kasia"; } { from = "testuser@lassul.us"; to = "testuser"; } { from = "testuser@ubikmedia.eu"; to = "testuser"; } @@ -150,6 +152,7 @@ in { "ubikmedia.eu" "ubikmedia.de" "alewis.de" + "jarugadesign.de" ]; ssl_cert = "/var/lib/acme/lassul.us/fullchain.pem"; ssl_key = "/var/lib/acme/lassul.us/key.pem"; @@ -235,6 +238,12 @@ in { }; krebs.on-failure.plans.restic-backups-domsen = {}; + users.users.kasia = { + uid = genid_uint31 "kasia"; + home = "/home/kasia"; + useDefaultShell = true; + createHome = true; + }; services.restic.backups.domsen = { initialize = true; extraOptions = [ "sftp.command='ssh efOVcMWSZ@wilhelmstr2.duckdns.org -S none -v -p 52222 -i ${toString + "/ssh.id_ed25519"} -s sftp'" ]; From d68e0e2e2d9f2aa07e5daf950971f4f6ff1634b7 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:49:10 +0200 Subject: [PATCH 65/68] l domsen: set nextcloud overwriteProtocol --- lass/2configs/websites/domsen.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix index 865186481..912d56925 100644 --- a/lass/2configs/websites/domsen.nix +++ b/lass/2configs/websites/domsen.nix @@ -94,6 +94,7 @@ in { hostName = "o.xanf.org"; config = { adminpassFile = toString + "/nextcloud_pw"; + overwriteProtocol = "https"; }; https = true; nginx.enable = true; From f8164a8e32b646464376afa951232085c9f1322b Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:49:29 +0200 Subject: [PATCH 66/68] l domsen: increase journalctl lines in backup errors --- lass/2configs/websites/domsen.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix index 912d56925..c99bd7b15 100644 --- a/lass/2configs/websites/domsen.nix +++ b/lass/2configs/websites/domsen.nix @@ -238,13 +238,18 @@ in { createHome = true; }; - krebs.on-failure.plans.restic-backups-domsen = {}; users.users.kasia = { uid = genid_uint31 "kasia"; home = "/home/kasia"; useDefaultShell = true; createHome = true; }; + + krebs.on-failure.plans.restic-backups-domsen = { + journalctl = { + lines = 1000; + }; + }; services.restic.backups.domsen = { initialize = true; extraOptions = [ "sftp.command='ssh efOVcMWSZ@wilhelmstr2.duckdns.org -S none -v -p 52222 -i ${toString + "/ssh.id_ed25519"} -s sftp'" ]; From 70a58ef2e310521029de794caba6c8351ac99e86 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 29 May 2019 15:49:45 +0200 Subject: [PATCH 67/68] l domsen: use permown for permissions --- lass/2configs/websites/domsen.nix | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix index c99bd7b15..9980e0501 100644 --- a/lass/2configs/websites/domsen.nix +++ b/lass/2configs/websites/domsen.nix @@ -262,11 +262,41 @@ in { "/home/ms/Mail" "/home/klabusterbeere/Mail" "/home/jms/Mail" + "/home/kasia/Mail" "/home/bruno/Mail" "/home/akayguen/Mail" "/backups/sql_dumps" ]; }; + boot.kernel.sysctl."fs.inotify.max_user_watches" = "1048576"; + krebs.permown = { + "/srv/http/ubikmedia.de" = { + owner = "domsen"; + group = "nginx"; + umask = "0007"; + }; + "/srv/http/o.ubikmedia.de" = { + owner = "domsen"; + group = "nginx"; + umask = "0007"; + }; + "/srv/http/freemonkey.art" = { + owner = "domsen"; + group = "nginx"; + umask = "0002"; + }; + "/srv/http/jarugadesign.de" = { + owner = "domsen"; + group = "nginx"; + umask = "0002"; + }; + "/srv/http/reich-gebaeudereinigung.de" = { + owner = "domsen"; + group = "nginx"; + umask = "0002"; + }; + }; + } From 4e7af580d81f02f6d07d38917f124f4b99483603 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 13 Jun 2019 23:30:54 +0200 Subject: [PATCH 68/68] krops: get correct secrets --- krebs/krops.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krebs/krops.nix b/krebs/krops.nix index 94418fdc2..8d38ed5b0 100644 --- a/krebs/krops.nix +++ b/krebs/krops.nix @@ -50,7 +50,7 @@ { nixos-config.symlink = "stockholm/krebs/1systems/${name}/config.nix"; secrets = if test then { - file = toString ; + file = toString ./0tests/data/secrets; } else { pass = { dir = "${lib.getEnv "HOME"}/brain";