Merge remote-tracking branch 'gum/master'

This commit is contained in:
tv 2019-04-17 22:04:03 +02:00
commit ffd36f5554
49 changed files with 486 additions and 105 deletions

View file

@ -429,6 +429,17 @@ in {
}; };
}; };
}; };
ada = {
owner = config.krebs.users.filly;
nets = {
wiregrill = {
aliases = [ "ada.w" ];
wireguard = {
pubkey = "+t0j9j7TZqvSFPzgunnON/ArXVGpMS/L3DldpanLoUk=";
};
};
};
};
}; };
users = { users = {
ciko = { ciko = {
@ -464,6 +475,8 @@ in {
}; };
miaoski = { miaoski = {
}; };
filly = {
};
}; };
} }

View file

@ -39,6 +39,7 @@ in {
io 60 IN NS ions.lassul.us. io 60 IN NS ions.lassul.us.
ions 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr} ions 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr}
lol 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr} lol 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr}
matrix 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr}
paste 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr} paste 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr}
radio 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr} radio 60 IN A ${config.krebs.hosts.prism.nets.internet.ip4.addr}
''; '';
@ -240,6 +241,7 @@ in {
secure = true; secure = true;
ssh.privkey.path = <secrets/ssh.id_ed25519>; ssh.privkey.path = <secrets/ssh.id_ed25519>;
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC9vup68R0I+62FK+8LNtwM90V9P4ukBmU7G7d54wf4C"; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC9vup68R0I+62FK+8LNtwM90V9P4ukBmU7G7d54wf4C";
syncthing.id = "AU5RTWC-HXNMDRT-TN4ZHXY-JMQ6EQB-4ZPOZL7-AICZMCZ-LNS2XXQ-DGTI2Q6";
}; };
icarus = { icarus = {
cores = 2; cores = 2;

View file

@ -78,7 +78,7 @@ let
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
ExecStart = pkgs.writeDash "generate-wallpaper" '' ExecStart = pkgs.writeDash "generate-wallpaper" ''
set -xeuf set -euf
# usage: getimg FILENAME URL # usage: getimg FILENAME URL
fetch() { fetch() {

View file

@ -9,19 +9,12 @@ with import <stockholm/lib>;
<stockholm/lass/2configs/blue.nix> <stockholm/lass/2configs/blue.nix>
<stockholm/lass/2configs/syncthing.nix> <stockholm/lass/2configs/syncthing.nix>
<stockholm/lass/2configs/sync/decsync.nix>
<stockholm/lass/2configs/sync/weechat.nix>
]; ];
krebs.build.host = config.krebs.hosts.blue; krebs.build.host = config.krebs.hosts.blue;
krebs.syncthing.folders = [
{ id = "contacts"; path = "/home/lass/contacts"; peers = [ "mors" "blue" "green" "phone" ]; }
{ path = "/home/lass/.weechat"; peers = [ "blue" "green" "mors" ]; }
];
lass.ensure-permissions = [
{ folder = "/home/lass/contacts"; owner = "lass"; group = "syncthing"; }
{ folder = "/home/lass/.weechat"; owner = "lass"; group = "syncthing"; }
];
environment.shellAliases = { environment.shellAliases = {
deploy = pkgs.writeDash "deploy" '' deploy = pkgs.writeDash "deploy" ''
set -eu set -eu

View file

@ -27,6 +27,12 @@ with import <stockholm/lib>;
enable = true; enable = true;
systemWide = true; systemWide = true;
}; };
programs.chromium = {
enable = true;
extensions = [
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin
];
};
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
pavucontrol pavucontrol
#firefox #firefox
@ -40,7 +46,7 @@ with import <stockholm/lib>;
wine wine
geeqie geeqie
vlc vlc
minecraft zsnes
]; ];
nixpkgs.config.firefox.enableAdobeFlash = true; nixpkgs.config.firefox.enableAdobeFlash = true;
services.xserver.enable = true; services.xserver.enable = true;

View file

@ -8,20 +8,13 @@ with import <stockholm/lib>;
<stockholm/lass/2configs/exim-retiolum.nix> <stockholm/lass/2configs/exim-retiolum.nix>
<stockholm/lass/2configs/mail.nix> <stockholm/lass/2configs/mail.nix>
#<stockholm/lass/2configs/blue.nix>
<stockholm/lass/2configs/syncthing.nix> <stockholm/lass/2configs/syncthing.nix>
<stockholm/lass/2configs/sync/decsync.nix>
<stockholm/lass/2configs/sync/weechat.nix>
]; ];
krebs.build.host = config.krebs.hosts.green; krebs.build.host = config.krebs.hosts.green;
krebs.syncthing.folders = [
{ id = "contacts"; path = "/home/lass/contacts"; peers = [ "mors" "blue" "green" "phone" ]; }
];
lass.ensure-permissions = [
{ folder = "/home/lass/contacts"; owner = "lass"; group = "syncthing"; }
];
#networking.nameservers = [ "1.1.1.1" ]; #networking.nameservers = [ "1.1.1.1" ];
#time.timeZone = "Europe/Berlin"; #time.timeZone = "Europe/Berlin";

View file

@ -20,6 +20,7 @@
<stockholm/lass/2configs/syncthing.nix> <stockholm/lass/2configs/syncthing.nix>
<stockholm/lass/2configs/nfs-dl.nix> <stockholm/lass/2configs/nfs-dl.nix>
<stockholm/lass/2configs/prism-share.nix> <stockholm/lass/2configs/prism-share.nix>
<stockholm/lass/2configs/ssh-cryptsetup.nix>
]; ];
krebs.build.host = config.krebs.hosts.icarus; krebs.build.host = config.krebs.hosts.icarus;

View file

@ -6,7 +6,6 @@ with import <stockholm/lib>;
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix> <nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
<stockholm/krebs> <stockholm/krebs>
<stockholm/lass/3modules> <stockholm/lass/3modules>
<stockholm/lass/5pkgs>
<stockholm/lass/2configs/mc.nix> <stockholm/lass/2configs/mc.nix>
<stockholm/lass/2configs/vim.nix> <stockholm/lass/2configs/vim.nix>
{ {
@ -40,9 +39,10 @@ with import <stockholm/lib>;
networking.hostName = "lass-iso"; networking.hostName = "lass-iso";
} }
{ {
nixpkgs.config.packageOverrides = import <stockholm/lass/5pkgs> pkgs;
krebs.enable = true; krebs.enable = true;
krebs.build.user = config.krebs.users.lass; krebs.build.user = config.krebs.users.lass;
krebs.build.host = config.krebs.hosts.iso; krebs.build.host = {};
} }
{ {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
@ -174,11 +174,13 @@ with import <stockholm/lib>;
user = "lass"; user = "lass";
}; };
windowManager.default = "xmonad"; windowManager.default = "xmonad";
windowManager.session = [{ windowManager.session = let
xmonad-lass = pkgs.callPackage <stockholm/lass/5pkgs/custom/xmonad-lass> { inherit config; };
in [{
name = "xmonad"; name = "xmonad";
start = '' start = ''
${pkgs.xorg.xhost}/bin/xhost +LOCAL: ${pkgs.xorg.xhost}/bin/xhost +LOCAL:
${pkgs.xmonad-lass}/bin/xmonad & ${xmonad-lass}/bin/xmonad &
waitPID=$! waitPID=$!
''; '';
}]; }];

View file

@ -8,6 +8,7 @@ with import <stockholm/lib>;
<stockholm/lass/2configs/retiolum.nix> <stockholm/lass/2configs/retiolum.nix>
<stockholm/lass/2configs/blue-host.nix> <stockholm/lass/2configs/blue-host.nix>
<stockholm/lass/2configs/syncthing.nix> <stockholm/lass/2configs/syncthing.nix>
<stockholm/lass/2configs/green-host.nix>
]; ];
networking.networkmanager.enable = true; networking.networkmanager.enable = true;

View file

@ -30,4 +30,12 @@ with import <stockholm/lib>;
]; ];
}; };
}; };
services.xserver.desktopManager.default = "none";
services.xserver.displayManager.lightdm.autoLogin = {
enable = true;
user = "lass";
timeout = 5;
};
} }

View file

@ -26,6 +26,8 @@ with import <stockholm/lib>;
<stockholm/lass/2configs/syncthing.nix> <stockholm/lass/2configs/syncthing.nix>
<stockholm/lass/2configs/otp-ssh.nix> <stockholm/lass/2configs/otp-ssh.nix>
<stockholm/lass/2configs/c-base.nix> <stockholm/lass/2configs/c-base.nix>
<stockholm/lass/2configs/sync/decsync.nix>
<stockholm/lass/2configs/sync/weechat.nix>
<stockholm/lass/2configs/br.nix> <stockholm/lass/2configs/br.nix>
<stockholm/lass/2configs/ableton.nix> <stockholm/lass/2configs/ableton.nix>
<stockholm/lass/2configs/starcraft.nix> <stockholm/lass/2configs/starcraft.nix>
@ -41,8 +43,6 @@ with import <stockholm/lib>;
krebs.iptables.tables.filter.INPUT.rules = [ krebs.iptables.tables.filter.INPUT.rules = [
#risk of rain #risk of rain
{ predicate = "-p tcp --dport 11100"; target = "ACCEPT"; } { predicate = "-p tcp --dport 11100"; target = "ACCEPT"; }
#chromecast
{ predicate = "-p udp -m multiport --sports 32768:61000 -m multiport --dports 32768:61000"; target = "ACCEPT"; }
#quake3 #quake3
{ predicate = "-p tcp --dport 27950:27965"; target = "ACCEPT"; } { predicate = "-p tcp --dport 27950:27965"; target = "ACCEPT"; }
{ predicate = "-p udp --dport 27950:27965"; target = "ACCEPT"; } { predicate = "-p udp --dport 27950:27965"; target = "ACCEPT"; }
@ -50,14 +50,10 @@ with import <stockholm/lib>;
} }
{ {
krebs.syncthing.folders = [ krebs.syncthing.folders = [
{ id = "contacts"; path = "/home/lass/contacts"; peers = [ "mors" "blue" "green" "phone" ]; } { id = "the_playlist"; path = "/home/lass/tmp/the_playlist"; peers = [ "mors" "phone" "prism" ]; }
{ id = "the_playlist"; path = "/home/lass/tmp/the_playlist"; peers = [ "mors" "phone" ]; }
{ path = "/home/lass/.weechat"; peers = [ "blue" "green" "mors" ]; }
]; ];
lass.ensure-permissions = [ lass.ensure-permissions = [
{ folder = "/home/lass/contacts"; owner = "lass"; group = "syncthing"; }
{ folder = "/home/lass/tmp/the_playlist"; owner = "lass"; group = "syncthing"; } { folder = "/home/lass/tmp/the_playlist"; owner = "lass"; group = "syncthing"; }
{ folder = "/home/lass/.weechat"; owner = "lass"; group = "syncthing"; }
]; ];
} }
{ {
@ -94,6 +90,7 @@ with import <stockholm/lib>;
pkgs.ovh-zone pkgs.ovh-zone
pkgs.bank pkgs.bank
pkgs.adb-sync pkgs.adb-sync
pkgs.transgui
]; ];
} }
{ {
@ -137,6 +134,18 @@ with import <stockholm/lib>;
(pkgs.writeDashBin "btc-kraken" '' (pkgs.writeDashBin "btc-kraken" ''
${pkgs.curl}/bin/curl -Ss 'https://api.kraken.com/0/public/Ticker?pair=BTCEUR' | ${pkgs.jq}/bin/jq '.result.XXBTZEUR.a[0]' ${pkgs.curl}/bin/curl -Ss 'https://api.kraken.com/0/public/Ticker?pair=BTCEUR' | ${pkgs.jq}/bin/jq '.result.XXBTZEUR.a[0]'
'') '')
(pkgs.writeDashBin "krebsco.de" ''
TMPDIR=$(${pkgs.coreutils}/bin/mktemp -d)
${pkgs.brain}/bin/brain show krebs-secrets/ovh-secrets.json > "$TMPDIR"/ovh-secrets.json
OVH_ZONE_CONFIG="$TMPDIR"/ovh-secrets.json ${pkgs.krebszones}/bin/krebszones import
${pkgs.coreutils}/bin/rm -rf "$TMPDIR"
'')
(pkgs.writeDashBin "lassul.us" ''
TMPDIR=$(${pkgs.coreutils}/bin/mktemp -d)
${pkgs.pass}/bin/pass show admin/ovh/api.config > "$TMPDIR"/ovh-secrets.json
OVH_ZONE_CONFIG="$TMPDIR"/ovh-secrets.json ${pkgs.ovh-zone}/bin/ovh-zone import /etc/zones/lassul.us lassul.us
${pkgs.coreutils}/bin/rm -rf "$TMPDIR"
'')
]; ];
#TODO: fix this shit #TODO: fix this shit

View file

@ -413,6 +413,42 @@ with import <stockholm/lib>;
]; ];
}; };
} }
{ #macos mounting of yellow
krebs.iptables.tables.filter.INPUT.rules = [
{ predicate = "-i wiregrill -p tcp --dport 139"; target = "ACCEPT"; }
{ predicate = "-i wiregrill -p tcp --dport 445"; target = "ACCEPT"; }
{ predicate = "-i wiregrill -p udp --dport 137"; target = "ACCEPT"; }
{ predicate = "-i wiregrill -p udp --dport 138"; target = "ACCEPT"; }
];
users.users.smbguest = {
name = "smbguest";
uid = config.ids.uids.smbguest;
description = "smb guest user";
home = "/home/share";
createHome = true;
};
services.samba = {
enable = true;
enableNmbd = true;
shares = {
download = {
path = "/var/download/finished";
"read only" = "yes";
browseable = "yes";
"guest ok" = "yes";
};
};
extraConfig = ''
guest account = smbguest
map to guest = bad user
# disable printing
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
'';
};
}
]; ];
krebs.build.host = config.krebs.hosts.prism; krebs.build.host = config.krebs.hosts.prism;

View file

@ -15,6 +15,8 @@ with import <stockholm/lib>;
<stockholm/lass/2configs/bitcoin.nix> <stockholm/lass/2configs/bitcoin.nix>
<stockholm/lass/2configs/backup.nix> <stockholm/lass/2configs/backup.nix>
<stockholm/lass/2configs/blue-host.nix> <stockholm/lass/2configs/blue-host.nix>
<stockholm/lass/2configs/green-host.nix>
<stockholm/lass/2configs/ssh-cryptsetup.nix>
]; ];
krebs.build.host = config.krebs.hosts.shodan; krebs.build.host = config.krebs.hosts.shodan;

View file

@ -8,6 +8,7 @@ with import <stockholm/lib>;
<stockholm/lass/2configs/blue-host.nix> <stockholm/lass/2configs/blue-host.nix>
<stockholm/lass/2configs/power-action.nix> <stockholm/lass/2configs/power-action.nix>
<stockholm/lass/2configs/syncthing.nix> <stockholm/lass/2configs/syncthing.nix>
<stockholm/lass/2configs/green-host.nix>
{ {
services.xserver.enable = true; services.xserver.enable = true;
services.xserver.desktopManager.xfce.enable = true; services.xserver.desktopManager.xfce.enable = true;

View file

@ -31,6 +31,7 @@ with import <stockholm/lib>;
download-dir = "/var/download/finished"; download-dir = "/var/download/finished";
incomplete-dir = "/var/download/incoming"; incomplete-dir = "/var/download/incoming";
incomplete-dir-enable = true; incomplete-dir-enable = true;
message-level = 1;
umask = "002"; umask = "002";
rpc-whitelist-enabled = false; rpc-whitelist-enabled = false;
rpc-host-whitelist-enabled = false; rpc-host-whitelist-enabled = false;

View file

@ -9,6 +9,7 @@ in {
./power-action.nix ./power-action.nix
./copyq.nix ./copyq.nix
./urxvt.nix ./urxvt.nix
./xdg-open.nix
{ {
hardware.pulseaudio = { hardware.pulseaudio = {
enable = true; enable = true;

View file

@ -100,6 +100,9 @@ with import <stockholm/lib>;
{ from = "box@lassul.us"; to = lass.mail; } { from = "box@lassul.us"; to = lass.mail; }
{ from = "paloalto@lassul.us"; to = lass.mail; } { from = "paloalto@lassul.us"; to = lass.mail; }
{ from = "subtitles@lassul.us"; to = lass.mail; } { from = "subtitles@lassul.us"; to = lass.mail; }
{ from = "lobsters@lassul.us"; to = lass.mail; }
{ from = "fysitech@lassul.us"; to = lass.mail; }
{ from = "threema@lassul.us"; to = lass.mail; }
]; ];
system-aliases = [ system-aliases = [
{ from = "mailer-daemon"; to = "postmaster"; } { from = "mailer-daemon"; to = "postmaster"; }

View file

@ -0,0 +1,83 @@
{ config, lib, pkgs, ... }:
with import <stockholm/lib>;
{
imports = [
<stockholm/lass/2configs/container-networking.nix>
<stockholm/lass/2configs/syncthing.nix>
{ #hack for already defined
systemd.services."container@green".reloadIfChanged = mkForce false;
systemd.services."container@green".preStart = ''
${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep -q ' on /var/lib/containers/green '
'';
systemd.services."container@green".postStop = ''
set -x
${pkgs.umount}/bin/umount /var/lib/containers/green
ls -la /dev/mapper/control
${pkgs.devicemapper}/bin/dmsetup ls
${pkgs.cryptsetup}/bin/cryptsetup -v luksClose /var/lib/sync-containers/green.img
'';
}
];
lass.ensure-permissions = [
{ folder = "/var/lib/sync-containers"; owner = "root"; group = "syncthing"; }
];
krebs.syncthing.folders = [
{ path = "/var/lib/sync-containers"; peers = [ "icarus" "skynet" "littleT" "shodan" ]; }
];
system.activationScripts.containerPermissions = ''
mkdir -p /var/lib/containers
chmod 711 /var/lib/containers
'';
containers.green = {
config = { ... }: {
environment.systemPackages = [
pkgs.git
pkgs.rxvt_unicode.terminfo
];
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [
config.krebs.users.lass.pubkey
];
};
autoStart = false;
enableTun = true;
privateNetwork = true;
hostAddress = "10.233.2.15";
localAddress = "10.233.2.16";
};
environment.systemPackages = [
(pkgs.writeDashBin "start-green" ''
set -fu
CONTAINER='green'
IMAGE='/var/lib/sync-containers/green.img'
${pkgs.cryptsetup}/bin/cryptsetup status "$CONTAINER" >/dev/null
if [ "$?" -ne 0 ]; then
${pkgs.cryptsetup}/bin/cryptsetup luksOpen "$IMAGE" "$CONTAINER"
fi
mkdir -p /var/lib/containers/"$CONTAINER"
${pkgs.mount}/bin/mount | grep -q " on /var/lib/containers/"$CONTAINER" "
if [ "$?" -ne 0 ]; then
${pkgs.mount}/bin/mount -o sync /dev/mapper/"$CONTAINER" /var/lib/containers/"$CONTAINER"
fi
STATE=$(${pkgs.nixos-container}/bin/nixos-container status "$CONTAINER")
if [ "$STATE" = 'down' ]; then
${pkgs.nixos-container}/bin/nixos-container start "$CONTAINER"
fi
ping -c1 green.r
if [ "$?" -ne 0 ]; then
${pkgs.nixos-container}/bin/nixos-container run green -- nixos-rebuild -I /var/src switch
fi
'')
];
}

View file

@ -233,8 +233,4 @@ in {
tag-new-mails tag-new-mails
tag-old-mails tag-old-mails
]; ];
nixpkgs.config.packageOverrides = opkgs: {
notmuch = (opkgs.notmuch.overrideAttrs (o: { doCheck = false; }));
};
} }

View file

@ -21,7 +21,7 @@ with import <stockholm/lib>;
shares = { shares = {
incoming = { incoming = {
path = "/mnt/prism"; path = "/mnt/prism";
"read only" = "no"; "read only" = "yes";
browseable = "yes"; browseable = "yes";
"guest ok" = "yes"; "guest ok" = "yes";
}; };

View file

@ -59,6 +59,9 @@ in {
group = "radio"; group = "radio";
musicDirectory = "/home/radio/the_playlist/music"; musicDirectory = "/home/radio/the_playlist/music";
extraConfig = '' extraConfig = ''
log_level "default"
auto_update "yes"
audio_output { audio_output {
type "shout" type "shout"
encoding "lame" encoding "lame"
@ -245,4 +248,10 @@ in {
alias ${html}; alias ${html};
''; '';
}; };
krebs.syncthing.folders = [
{ id = "the_playlist"; path = "/home/radio/music/the_playlist"; peers = [ "mors" "phone" "prism" ]; }
];
lass.ensure-permissions = [
{ folder = "/home/radio/music/the_playlist"; owner = "radio"; group = "syncthing"; }
];
} }

View file

@ -0,0 +1,17 @@
{ config, ... }:
{
boot.initrd = {
network = {
enable = true;
ssh = {
enable = true;
authorizedKeys = with config.krebs.users; [
config.krebs.users.lass-mors.pubkey
config.krebs.users.lass-blue.pubkey
config.krebs.users.lass-shodan.pubkey
config.krebs.users.lass-icarus.pubkey
];
};
};
};
}

View file

@ -0,0 +1,8 @@
{
krebs.syncthing.folders = [
{ id = "decsync"; path = "/home/lass/decsync"; peers = [ "mors" "blue" "green" "phone" ]; }
];
lass.ensure-permissions = [
{ folder = "/home/lass/decsync"; owner = "lass"; group = "syncthing"; }
];
}

View file

@ -0,0 +1,8 @@
{
krebs.syncthing.folders = [
{ path = "/home/lass/.weechat"; peers = [ "blue" "green" "mors" ]; }
];
lass.ensure-permissions = [
{ folder = "/home/lass/.weechat"; owner = "lass"; group = "syncthing"; }
];
}

View file

@ -16,7 +16,7 @@ with import <stockholm/lib>;
key = toString <secrets/syncthing.key>; key = toString <secrets/syncthing.key>;
peers = mapAttrs (n: v: { id = v.syncthing.id; }) (filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts); peers = mapAttrs (n: v: { id = v.syncthing.id; }) (filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts);
folders = [ folders = [
{ path = "/home/lass/sync"; peers = [ "icarus" "mors" "skynet" "blue" "green" "littleT" "prism"]; } { path = "/home/lass/sync"; peers = [ "icarus" "mors" "skynet" "blue" "green" "littleT" "prism" "shodan" ]; }
]; ];
}; };

View file

@ -119,7 +119,7 @@ in {
authenticators.PLAIN = '' authenticators.PLAIN = ''
driver = plaintext driver = plaintext
public_name = PLAIN public_name = PLAIN
server_condition = ''${run{${config.lass.usershadow.path}/bin/verify_arg ${config.lass.usershadow.pattern} $auth2 $auth3}{yes}{no}} server_condition = ''${run{/run/wrappers/bin/shadow_verify_arg ${config.lass.usershadow.pattern} $auth2 $auth3}{yes}{no}}
''; '';
authenticators.LOGIN = '' authenticators.LOGIN = ''
driver = plaintext driver = plaintext

View file

@ -0,0 +1,66 @@
{ config, pkgs, lib, ... }: with import <stockholm/lib>; let
xdg-open-wrapper = pkgs.writeDashBin "xdg-open" ''
/run/wrappers/bin/sudo -u lass ${xdg-open} "$@"
'';
xdg-open = pkgs.writeBash "xdg-open" ''
set -e
FILE="$1"
mime=
case "$FILE" in
http://*|https://*)
mime=text/html
;;
mailto:*)
mime=special/mailaddress
;;
magnet:*)
mime=application/x-bittorrent
;;
irc:*)
mime=x-scheme-handler/irc
;;
*)
# its a file
# strip possible protocol
FILE=''${FILE#file://}
mime=''$(file -E --brief --mime-type "$FILE") \
|| (echo "$mime" 1>&2; exit 1)
# ^ echo the error message of file
;;
esac
case "$mime" in
special/mailaddress)
urxvtc --execute vim "$FILE" ;;
${optionalString (hasAttr "browser" config.lass) ''
text/html)
${config.lass.browser.select}/bin/browser-select "$FILE" ;;
text/xml)
${config.lass.browser.select}/bin/browser-select "$FILE" ;;
''}
text/*)
urxvtc --execute vim "$FILE" ;;
image/*)
sxiv "$FILE" ;;
application/x-bittorrent)
env DISPLAY=:0 transgui "$FILE" ;;
application/pdf)
zathura "$FILE" ;;
inode/directory)
sudo -u lass -i urxvtc --execute mc "$FILE" ;;
*)
# open dmenu and ask for program to open with
$(dmenu_path | dmenu) "$FILE";;
esac
'';
in {
environment.systemPackages = [ xdg-open-wrapper ];
security.sudo.extraConfig = ''
cr ALL=(lass) NOPASSWD: ${xdg-open} *
'';
}

View file

@ -45,6 +45,10 @@
source = "${usershadow}/bin/verify_pam"; source = "${usershadow}/bin/verify_pam";
owner = "root"; owner = "root";
}; };
security.wrappers.shadow_verify_arg = {
source = "${usershadow}/bin/verify_arg";
owner = "root";
};
}; };
usershadow = let { usershadow = let {

View file

@ -5,14 +5,40 @@
entity_id = "group.team"; entity_id = "group.team";
from = "not_home"; from = "not_home";
to = "home"; to = "home";
for.seconds = 30;
}; };
action = { action = [
service = "homeassistant.turn_on"; {
entity_id = [ service = "homeassistant.turn_on";
"switch.fernseher" entity_id = [
"switch.feuer" "switch.fernseher"
]; "switch.feuer"
}; ];
}
{
service = "media_player.kodi_call_method";
data = {
entity_id = "media_player.kodi";
method = "Player.Open";
item.partymode = "music";
};
}
{
service = "tts.google_say";
entity_id = "media_player.kodi";
data = {
message = "Willkommen in deinem Lieblingsbüro";
language = "de";
};
}
{
service = "notify.telegrambot";
data = {
title = "Bureau Startup";
message = "Willkommen {{ trigger.platform }}";
};
}
];
} }
{ alias = "Turn off Fernseher after last in group left"; { alias = "Turn off Fernseher after last in group left";
trigger = [ trigger = [
@ -42,7 +68,7 @@
service = "notify.telegrambot"; service = "notify.telegrambot";
data = { data = {
title = "Bureau Shutdown"; title = "Bureau Shutdown";
message = "All devices are turned off due to {{ trigger.platform }} - {{ trigger }}"; message = "All devices are turned off due to {{ trigger.platform }}";
}; };
} }
]; ];

View file

@ -0,0 +1,31 @@
[
{ alias = "State on HA start-up";
trigger = {
platform = "homeassistant";
event = "start";
};
action = [
# Startup State
{ service = "mqtt.publish";
data = {
topic = "/bam/sonoffs/cmnd/state";
payload = "";
};
}
# Firmware Version
{ service = "mqtt.publish";
data = {
topic = "/bam/sonoffs/cmnd/status";
payload = "2";
};
}
# Will trigger restart of all devices!
#{ service = "mqtt.publish";
# data = {
# topic = "sonoffs/cmnd/SetOption59"; # configure sending state on power change
# payload = "1";
# };
#}
];
}
]

View file

@ -1,43 +1,35 @@
[ [
{ # TODO: trigger if it is before dusk and somebody arives but nachtlichter are
alias = "Turn off Nachtlicht on sunrise"; # off from last day
trigger = # TODO: do not have nachtlicht turned on at night
{ {
platform = "sun"; alias = "Turn on Nachtlicht at dusk"; # when it gets dim
event = "sunrise"; trigger =
}; { platform = "numeric_state";
action = entity_id = "sun.sun";
{ value_template = "{{ state.attributes.elevation }}";
service = "homeassistant.turn_off"; below = 10;
entity_id = [ "group.nachtlicht" ];
};
}
{ };
alias = "Turn on Nachtlicht on motion and dusk"; action =
trigger = { service = "homeassistant.turn_on";
{ entity_id = [ "group.nachtlicht" ];
platform = "state"; };
entity_id = "binary_sensor.motion"; }
to = "on"; {
}; alias = "Turn off Nachtlicht at dawn";
condition = # 'when dark' trigger =
{ { platform = "sun";
condition = "or"; event = "sunrise";
conditions = [ offset = "01:30:00"; # on dawn
{ condition = "sun"; };
after = "sunset"; # TODO: when somebody is still in the buero
after_offset = "-00:45:00"; # on dusk # condition =
} #{
{ condition = "sun"; #};
before = "sunrise"; action =
} { service = "homeassistant.turn_off";
]; entity_id = [ "group.nachtlicht" ];
}; };
action = }
{
service = "homeassistant.turn_on";
entity_id = [ "group.nachtlicht" ];
};
}
] ]

View file

@ -20,6 +20,9 @@ let
mosquitto_pub -t /bam/$topic/cmnd/POWER -m OFF mosquitto_pub -t /bam/$topic/cmnd/POWER -m OFF
''; '';
in { in {
imports = [
./ota.nix
];
services.logstash = { services.logstash = {
package = pkgs.logstash5; package = pkgs.logstash5;
enable = true; enable = true;

View file

@ -6,6 +6,7 @@ in {
state = [ "/var/lib/hass/known_devices.yaml" ]; state = [ "/var/lib/hass/known_devices.yaml" ];
services.home-assistant = { services.home-assistant = {
enable = true; enable = true;
package = pkgs.home-assistant.override { python3 = pkgs.python36; };
config = { config = {
homeassistant = { homeassistant = {
name = "Bureautomation"; name = "Bureautomation";
@ -13,8 +14,14 @@ in {
latitude = "48.8265"; latitude = "48.8265";
longitude = "9.0676"; longitude = "9.0676";
elevation = 303; elevation = 303;
auth_providers = [
{ type = "homeassistant";}
{ type = "legacy_api_password";}
{ type = "trusted_networks";
# allow_bypass_login = true;
}
];
}; };
mqtt = { mqtt = {
broker = "localhost"; broker = "localhost";
port = 1883; port = 1883;
@ -79,7 +86,8 @@ in {
sensor = sensor =
(import ./sensor/espeasy.nix) ++ (import ./sensor/espeasy.nix) ++
((import ./sensor/outside.nix) {inherit lib;}) ++ ((import ./sensor/outside.nix) {inherit lib;}) ++
(import ./sensor/influxdb.nix); (import ./sensor/influxdb.nix) ++
(import ./sensor/tasmota_firmware.nix);
camera = camera =
(import ./camera/verkehrskamera.nix); (import ./camera/verkehrskamera.nix);
@ -89,12 +97,22 @@ in {
# (import ./person/team.nix ); # (import ./person/team.nix );
frontend = { }; frontend = { };
http = { }; http = {
# TODO: https://github.com/home-assistant/home-assistant/issues/16149
api_password = "sistemas";
trusted_networks = [
"127.0.0.1/32"
"192.168.8.0/24"
"::1/128"
"fd00::/8"
];
};
conversation = {}; conversation = {};
history = {}; history = {};
logbook = {}; logbook = {};
tts = [ { platform = "google";} ]; tts = [ { platform = "google";} ];
recorder = {}; recorder = {};
sun = {};
telegram_bot = [ telegram_bot = [
(builtins.fromJSON (builtins.fromJSON
(builtins.readFile <secrets/hass/telegram-bot.json>)) (builtins.readFile <secrets/hass/telegram-bot.json>))
@ -156,8 +174,10 @@ in {
outside = [ outside = [
# "sensor.ditzingen_pm10" # "sensor.ditzingen_pm10"
# "sensor.ditzingen_pm25" # "sensor.ditzingen_pm25"
"sensor.dark_sky_icon"
"sensor.dark_sky_temperature" "sensor.dark_sky_temperature"
"sensor.dark_sky_humidity" "sensor.dark_sky_humidity"
"sensor.dark_sky_uv_index"
# "sensor.dark_sky_pressure" # "sensor.dark_sky_pressure"
"sensor.dark_sky_hourly_summary" "sensor.dark_sky_hourly_summary"
"device_tracker.router" "device_tracker.router"
@ -169,6 +189,7 @@ in {
# home-assistant # home-assistant
automation = (import ./automation/bureau-shutdown.nix) ++ automation = (import ./automation/bureau-shutdown.nix) ++
(import ./automation/nachtlicht.nix) ++ (import ./automation/nachtlicht.nix) ++
(import ./automation/hass-restart.nix) ++
(import ./automation/10h_timer.nix); (import ./automation/10h_timer.nix);
device_tracker = (import ./device_tracker/openwrt.nix ); device_tracker = (import ./device_tracker/openwrt.nix );
}; };

View file

@ -20,7 +20,7 @@ let
payload_not_available= "Offline"; payload_not_available= "Offline";
# brightness # brightness
brightness_state_topic = "/bam/${topic}/tele/STATE"; brightness_state_topic = "/bam/${topic}/tele/STATE";
brightness_value_template = "{{value_json.Dimmer}}"; brightness_value_template = "{{value_json.Dimmer|default(100)}}";
brightness_command_topic = "/bam/${topic}/cmnd/Dimmer"; brightness_command_topic = "/bam/${topic}/cmnd/Dimmer";
brightness_scale = 100; brightness_scale = 100;
# color # color
@ -30,9 +30,8 @@ let
rgb_command_template = "{{ '%02x%02x%02x' | format(red, green, blue)}}"; rgb_command_template = "{{ '%02x%02x%02x' | format(red, green, blue)}}";
# effects # effects
effect_state_topic = "/bam/${topic}/tele/STATE"; effect_state_topic = "/bam/${topic}/tele/STATE";
effects_value_template = "{{value_json.Scheme}}"; effects_value_template = "{{value_json.Scheme|default(0)}}";
effect_command_topic = "/bam/${topic}/cmnd/Scheme"; effect_command_topic = "/bam/${topic}/cmnd/Scheme";
effect_value_template = "{{ value_json.Scheme }}";
effect_list = [ effect_list = [
0 # single color for LED light 0 # single color for LED light
1 # start wake up sequence (same as Wakeup) 1 # start wake up sequence (same as Wakeup)

View file

@ -0,0 +1,15 @@
{
# mosquitto_pub -t /bam/sonoffs/cmnd/OtaUrl -m "http://192.168.8.11/sonoff.bin"
# mosquitto_pub -t /bam/sonoffs/cmnd/upgrade -m "6.5.0"
# wget https://github.com/arendst/Sonoff-Tasmota/releases/download/v6.5.0/sonoff.bin
# wget https://github.com/arendst/Sonoff-Tasmota/releases/download/v6.5.0/sonoff-minimal.bin
services.nginx = {
enable = true;
virtualHosts."192.168.8.11" = {
root = "/var/www/tasmota";
extraConfig = ''
autoindex on;
'';
};
};
}

View file

@ -0,0 +1,16 @@
let
tasmota_firmware = topic:
{ platform = "mqtt";
name = "${topic} Firmware";
state_topic = "/bam/${topic}/stat/STATUS2";
availability_topic = "/bam/${topic}/tele/LWT";
value_template = "v{{value_json.StatusFWR.Version}}";
payload_available= "Online";
payload_not_available= "Offline";
};
in
map tasmota_firmware [
"plug" "plug2" "plug3" "plug4" "plug5"
"status1" "status2" "buslicht"
"rfbridge"
]

View file

@ -23,9 +23,9 @@ let
in { in {
system.activationScripts."prepare-nextcloud-${domain}" = '' system.activationScripts."prepare-nextcloud-${domain}" = ''
if test ! -e ${root} ;then if test ! -e ${root} ;then
echo "copying latest ${pkgs.owncloud.name} release to ${root}" echo "copying latest ${pkgs.nextcloud.name} release to ${root}"
mkdir -p $(dirname "${root}") mkdir -p $(dirname "${root}")
cp -r ${pkgs.owncloud} "${root}" cp -r ${pkgs.nextcloud} "${root}"
chown -R nginx:nginx "${root}" chown -R nginx:nginx "${root}"
chmod 770 "${root}" chmod 770 "${root}"
fi fi

View file

@ -2,7 +2,9 @@
imports = [ imports = [
<home-manager/nixos> <home-manager/nixos>
]; ];
home-manager.useUserPackages = true;
home-manager.users.makefu = { home-manager.users.makefu = {
home.stateVersion = "19.03";
}; };
environment.variables = { environment.variables = {
GTK_DATA_PREFIX = "/run/current-system/sw"; GTK_DATA_PREFIX = "/run/current-system/sw";

View file

@ -5,7 +5,10 @@
home-manager.users.makefu = { home-manager.users.makefu = {
systemd.user.services.network-manager-applet.Service.Environment = ''XDG_DATA_DIRS=/run/current-system/sw/share:${pkgs.networkmanagerapplet}/share GDK_PIXBUF_MODULE_FILE=${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache''; systemd.user.services.network-manager-applet.Service.Environment = ''XDG_DATA_DIRS=/run/current-system/sw/share:${pkgs.networkmanagerapplet}/share GDK_PIXBUF_MODULE_FILE=${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache'';
programs.browserpass = { browsers = [ "firefox" ] ; enable = true; }; programs.browserpass = { browsers = [ "firefox" ] ; enable = true; };
programs.firefox.enable = true; programs.firefox = {
enable = true;
enableIcedTea = true;
};
programs.obs-studio.enable = true; programs.obs-studio.enable = true;
xdg.enable = true; xdg.enable = true;
services.network-manager-applet.enable = true; services.network-manager-applet.enable = true;
@ -20,7 +23,6 @@
filenamePattern=%F_%T_shot filenamePattern=%F_%T_shot
''; '';
systemd.user.services.pasystray.Service.Environment = "PATH=" + (lib.makeBinPath (with pkgs;[ pavucontrol paprefs /* pavumeter */ /* paman */ ]) );
programs.chromium = { programs.chromium = {
enable = true; enable = true;
extensions = [ extensions = [

View file

@ -0,0 +1,4 @@
{pkgs, ... }:
{
home-manager.users.makefu.programs.obs-studio.enable = true;
}

View file

@ -3,6 +3,12 @@ let
loc = "/home/makefu/.task"; loc = "/home/makefu/.task";
in { in {
state = [ "${loc}/keys" ]; state = [ "${loc}/keys" ];
environment.shellAliases = {
tshack = "task tags:shack";
tkrebs = "task tags:krebs";
thome = "task tags:home";
t = "task project: ";
};
home-manager.users.makefu.programs.taskwarrior = { home-manager.users.makefu.programs.taskwarrior = {
enable = true; enable = true;
dataLocation = loc; dataLocation = loc;

View file

@ -67,6 +67,7 @@
home-manager.users.makefu.programs.zsh.shellAliases = { home-manager.users.makefu.programs.zsh.shellAliases = {
cat = "bat"; cat = "bat";
catn = "${pkgs.coreutils}/bin/cat"; catn = "${pkgs.coreutils}/bin/cat";
ncat = "${pkgs.coreutils}/bin/cat";
}; };
} }
]; ];

View file

@ -108,6 +108,7 @@ in {
]; ];
services.home-assistant = { services.home-assistant = {
package = pkgs.home-assistant.override { python3 = pkgs.python36; };
config = { config = {
homeassistant = { homeassistant = {
name = "Home"; time_zone = "Europe/Berlin"; name = "Home"; time_zone = "Europe/Berlin";

View file

@ -1,6 +1,5 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with import <stockholm/lib>;
{ {
imports = [ imports = [
./tpm.nix ./tpm.nix
@ -19,7 +18,6 @@ with import <stockholm/lib>;
hardware.cpu.intel.updateMicrocode = true; hardware.cpu.intel.updateMicrocode = true;
zramSwap.enable = true; zramSwap.enable = true;
zramSwap.numDevices = 2;
# enable synaptics so we can easily disable the touchpad # enable synaptics so we can easily disable the touchpad
# enable the touchpad with `synclient TouchpadOff=0` # enable the touchpad with `synclient TouchpadOff=0`

View file

@ -3,7 +3,7 @@
{ {
nixpkgs.config.android_sdk.accept_license = true; nixpkgs.config.android_sdk.accept_license = true;
users.users.makefu.packages = with pkgs; [ users.users.makefu.packages = with pkgs; [
mitmproxy # mitmproxy
nmap nmap
msf msf
drozer drozer

View file

@ -10,7 +10,8 @@
keepassx keepassx
pcmanfm pcmanfm
evince evince
mirage # replacement for mirage:
sxiv
tightvnc tightvnc
gnome3.dconf gnome3.dconf
xdotool xdotool

View file

@ -7,7 +7,7 @@
vlc vlc
mumble mumble
mplayer mplayer
quodlibet # exfalso # quodlibet # exfalso
plowshare plowshare
streamripper streamripper

View file

@ -3,12 +3,12 @@ with pkgs.python3.pkgs;
buildPythonPackage rec { buildPythonPackage rec {
pname = "prison-break"; pname = "prison-break";
version = "0.1.0"; version = "1.0.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "makefu"; owner = "makefu";
repo = pname; repo = pname;
rev = "5eed6371e151e716faafa054e005bd98d77b4b5d"; rev = "1.0.0";
sha256 = "170zs9grbgkx83ghg6pm13v7vhi604y44j550ypp2x26nidaw63j"; sha256 = "0ab42z6qr42vz4fc077irn9ykrrylagx1dzlw8dqcanf49dxd961";
}; };
propagatedBuildInputs = [ propagatedBuildInputs = [
docopt docopt

View file

@ -71,7 +71,7 @@
(lib.mkIf ( host-src.home-manager ) { (lib.mkIf ( host-src.home-manager ) {
home-manager.git = { home-manager.git = {
url = https://github.com/rycee/home-manager; url = https://github.com/rycee/home-manager;
ref = "4aa07c3"; ref = "ff602cb906e3dd5d5f89c7c1d0fae65bc67119a0";
}; };
}) })
]; ];