Merge remote-tracking branch 'gum/master'

This commit is contained in:
lassulus 2017-11-10 22:35:25 +01:00
commit 725d98e428
10 changed files with 129 additions and 79 deletions

View File

@ -2,6 +2,8 @@
with import <stockholm/lib>;
let
# all the good stuff resides in /data
byid = dev: "/dev/disk/by-id/" + dev;
rootDisk = byid "ata-INTEL_SSDSC2BW480H6_CVTR53120385480EGN";
bootPart = rootDisk + "-part1";
@ -21,44 +23,23 @@ in {
<stockholm/makefu/2configs/tinc/retiolum.nix>
<stockholm/makefu/2configs/tools/core.nix>
<stockholm/makefu/2configs/stats/client.nix>
<stockholm/makefu/2configs/nsupdate-data.nix>
# <stockholm/makefu/2configs/nsupdate-data.nix>
# SIEM
#<stockholm/makefu/2configs/tinc/siem.nix>
# {services.tinc.networks.siem = {
# name = "sdarth";
# extraConfig = "ConnectTo = sjump";
# };
# }
# {
# makefu.forward-journal = {
# enable = true;
# src = "10.8.10.2";
# dst = "10.8.10.6";
# };
# }
## Sharing
# <stockholm/makefu/2configs/share/temp-share-samba.nix>
#{
# services.samba.shares = {
# isos = {
# path = "/data/isos/";
# "read only" = "yes";
# browseable = "yes";
# "guest ok" = "yes";
# };
# };
#}
<stockholm/makefu/2configs/share/anon-ftp.nix>
# lan party
<stockholm/makefu/2configs/lanparty/lancache.nix>
<stockholm/makefu/2configs/lanparty/lancache-dns.nix>
<stockholm/makefu/2configs/lanparty/samba.nix>
<stockholm/makefu/2configs/lanparty/mumble-server.nix>
<stockholm/makefu/2configs/virtualisation/libvirt.nix>
];
#networking.firewall.enable = false;
makefu.server.primary-itf = "enp0s25";
krebs.hidden-ssh.enable = true;
# krebs.hidden-ssh.enable = true;
boot.kernelModules = [ "coretemp" "f71882fg" ];
hardware.enableAllFirmware = true;
nixpkgs.config.allowUnfree = true;

View File

@ -1,20 +1,20 @@
#
#
#
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
{
imports =
[ # Include the results of the hardware scan.
<stockholm/makefu>
<stockholm/makefu/2configs/gui/base.nix>
<stockholm/makefu/2configs/main-laptop.nix>
<stockholm/makefu/2configs/tools/all.nix>
<stockholm/makefu/2configs/fs/sda-crypto-root.nix>
# hardware specifics are in here
# imports tp-x2x0.nix
<stockholm/makefu/2configs/hw/tp-x200.nix>
# <stockholm/makefu/2configs/hw/tp-x200.nix>
<stockholm/makefu/2configs/disable_v6.nix>
<stockholm/makefu/2configs/rad1o.nix>
# <stockholm/makefu/2configs/rad1o.nix>
<stockholm/makefu/2configs/zsh-user.nix>
<stockholm/makefu/2configs/exim-retiolum.nix>
@ -22,9 +22,41 @@
];
# not working in vm
krebs.build.host = config.krebs.hosts.tsp;
boot.initrd.luks.devices = [ { name = "luksroot"; device = "/dev/sda2"; allowDiscards=true; }];
boot.loader.grub.copyKernels = true;
networking.firewall.allowedTCPPorts = [
25
];
# acer aspire
networking.wireless.enable = lib.mkDefault true;
hardware.enableAllFirmware = true;
nixpkgs.config.allowUnfree = true;
hardware.cpu.intel.updateMicrocode = true;
zramSwap.enable = true;
zramSwap.numDevices = 2;
services.tlp.enable = true;
services.tlp.extraConfig = ''
# BUG: http://linrunner.de/en/tlp/docs/tlp-faq.html#erratic-battery
START_CHARGE_THRESH_BAT0=67
STOP_CHARGE_THRESH_BAT0=100
CPU_SCALING_GOVERNOR_ON_AC=performance
CPU_SCALING_GOVERNOR_ON_BAT=ondemand
CPU_MIN_PERF_ON_AC=0
CPU_MAX_PERF_ON_AC=100
CPU_MIN_PERF_ON_BAT=0
CPU_MAX_PERF_ON_BAT=30
'';
powerManagement.resumeCommands = ''
${pkgs.rfkill}/bin/rfkill unblock all
'';
}

View File

@ -31,6 +31,19 @@ in {
krebs.backup.plans = {
# wry-to-omo_root = defaultPull config.krebs.hosts.wry "/";
gum-to-omo_root = defaultPull config.krebs.hosts.gum "/";
gum-dl-to-omo_external = (defaultPull config.krebs.hosts.gum "/var/download" )//
{
dst.path = "/media/cryptX/backup/gum/var-download";
dst.host = defaultBackupServer;
startAt = "19:00";
};
gum-owncloud-to-omo_external = (defaultPull config.krebs.hosts.gum "/var/www/o.euer.krebsco.de" )//
{
dst.path = "/media/cryptX/backup/gum/var-www-o.euer.krebsco.de";
dst.host = defaultBackupServer;
startAt = "05:00";
};
# wolf-to-omo_root = defaultPull config.krebs.hosts.wolf "/";
};
environment.systemPackages = [

View File

@ -1,6 +1,19 @@
{ pkgs, lib, config, ... }:
with import <stockholm/lib>;
let
upstream-server = "8.8.8.8";
# make sure the router pins the ip address to the deployed host
# and set it as dns server ( dhcp option 6,192.168.10.10 )
local_ip = "192.168.10.10";
extra-config = pkgs.writeText "local.conf" ''
server:
local-data: "piratebox. A ${local_ip}"
local-data: "store. A ${local_ip}"
local-data: "share. A ${local_ip}"
'';
# see https://github.com/zeropingheroes/lancache for full docs
lancache-dns = pkgs.stdenv.mkDerivation rec {
name = "lancache-dns-2017-06-28";
@ -11,8 +24,9 @@ let
rev = "420aa62";
sha256 = "0ik7by7ripdv2avyy5kk9jp1i7rz9ksc8xmg7n9iik365q9pv94m";
};
phases = [ "unpackPhase" "installPhase" ];
# here we can chance to edit `includes/proxy-cache-paths.conf`
# here we have the chance to edit `includes/proxy-cache-paths.conf`
installPhase = ''
mkdir -p $out
cp -r * $out/
@ -20,7 +34,6 @@ let
};
stateDir = "/var/lib/unbound";
user = "unbound";
upstream-server = "8.8.8.8";
in {
services.unbound = {
enable = true;
@ -29,6 +42,7 @@ in {
forwardAddresses = [ upstream-server ];
extraConfig = ''
include: "${stateDir}/lancache/*.conf"
include: "${extra-config}"
'';
};
services.dnscrypt-proxy.enable = lib.mkForce false;
@ -42,7 +56,8 @@ in {
path = [ pkgs.gawk pkgs.iproute pkgs.gnused ];
script = ''
set -xeu
current_ip=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
# current_ip=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
current_ip=${local_ip}
old_ip=10.1.1.250
mkdir -p ${stateDir}
rm -rvf ${stateDir}/lancache

View File

@ -17,15 +17,21 @@ let
installPhase = ''
mkdir -p $out
cp -r * $out/
rm $out/caches-enabled/*
sed -i -e 's/^\(user\).*/\1 ${cfg.user} ${cfg.group};/' \
-e '1 idaemon off;' \
-e 's#/var/lancache#${cfg.statedir}#g' \
$out/nginx.conf
sed -i -e 's#/var/lancache#${cfg.statedir}#g' \
$out/*/*.conf
ln -s $out/caches-available/* $out/caches-enabled/
'';
};
cfg = {
statedir = "/data/cache";
group = "nginx-lancache";
user = "nginx-lancache";
statedir = "/var/lancache";
package = pkgs.stdenv.lib.overrideDerivation pkgs.nginx (old:{
configureFlags = old.configureFlags ++ [
"--with-http_slice_module"
@ -43,6 +49,7 @@ in {
preStart = ''
mkdir -p ${cfg.statedir} && cd ${cfg.statedir}
chmod 700 ${cfg.statedir}
PATH_CACHE=$PATH_BASE/cache
PATH_LOGS=$PATH_BASE/logs

View File

@ -0,0 +1,12 @@
{ config, ... }:
{
networking.firewall.allowedTCPPorts = [ 64738 ];
networking.firewall.allowedUDPPorts = [ 64738 ];
services.murmur = {
enable = true;
welcometext = "Welcome to the LANest Party mumble server";
bonjour = true;
hostName = "0.0.0.0";
sendVersion = true;
};
}

View File

@ -10,9 +10,16 @@
};
services.samba = {
enable = true;
enableNmbd = true;
shares = {
share-home = {
lanparty = {
path = "/data/lanparty/";
"read only" = "yes";
browseable = "yes";
"guest ok" = "yes";
};
share = {
path = "/data/incoming";
"read only" = "no";
browseable = "yes";
"guest ok" = "yes";

View File

@ -5,38 +5,43 @@
#
# essentially `nix-env -q` of the main user
{
krebs.per-user.makefu.packages = with pkgs; [
environment.systemPackages = with pkgs; [
at_spi2_core
acpi
bc
rsync
exif
file
lsof
which
# fs
ntfs3g
cifs-utils
dosfstools
ntfs3g
smartmontools
# io
pv
sshpass
usbutils
p7zip
hdparm
inetutils
ncftp
mutt
tcpdump
sysstat
which
weechat
wol
tmux
iftop
mkpasswd
# storage
smartmontools
cifs-utils
# net
wget
curl
inetutils
ncftp
tcpdump
sysstat
wol
iftop
mkpasswd
mutt
weechat
tmux
# stockholm
git

View File

@ -13,6 +13,6 @@
thc-hydra
borgbackup
ledger
u3_tool
u3-tool
];
}

View File

@ -1,22 +0,0 @@
{ stdenv, fetchurl }:
stdenv.mkDerivation rec {
proj = "u3-tool";
name = "${proj}-${version}";
version = "0.3";
enableParallelBuilding = true;
src = fetchurl {
url = "mirror://sourceforge/${proj}/${name}.tar.gz";
sha256 = "1p9c9kibd1pdbdfa0nd0i3n7bvzi3xg0chm38jg3xfl8gsn0390f";
};
meta = {
description = "Tool for controlling the special features of a 'U3 smart drive' USB Flash disk.";
homepage = https://sourceforge.net/projects/u3-tool/ ;
license = stdenv.lib.licenses.gpl2;
platforms = stdenv.lib.platforms.linux;
maintainers = with stdenv.lib.maintainers; [ makefu ];
};
}