diff --git a/default.nix b/default.nix index 59a76f81b..875f0d5b4 100644 --- a/default.nix +++ b/default.nix @@ -8,6 +8,12 @@ let "${user-name}/1systems/${system-name}.nix" "${user-name}/3modules" "krebs/3modules" + ] ++ [ + ({ lib, pkgs, ... }: { + _module.args.pkgs = + (import ./krebs/5pkgs { inherit lib pkgs; }) // + (import (./. + "/${user-name}/5pkgs") { inherit lib pkgs; }); + }) ]; }; diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index af0466c3c..5f338df62 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -272,6 +272,7 @@ let ''; }; }; + secure = true; }; mors = { cores = 2; @@ -302,12 +303,12 @@ let }; users = addNames { lass = { - pubkey = readFile ../../Zpubkeys/lass.ssh.pub; + pubkey = readFile ../Zpubkeys/lass.ssh.pub; mail = "lass@mors.retiolum"; }; uriel = { - pubkey = readFile ../../Zpubkeys/uriel.ssh.pub; - mail = "uriel@mors.retiolum"; + pubkey = readFile ../Zpubkeys/uriel.ssh.pub; + mail = "lass@uriel.retiolum"; }; }; }; @@ -513,7 +514,7 @@ let users = addNames { makefu = { mail = "makefu@pornocauster.retiolum"; - pubkey = readFile ../../Zpubkeys/makefu_arch.ssh.pub; + pubkey = readFile ../Zpubkeys/makefu_arch.ssh.pub; }; }; }; @@ -684,11 +685,11 @@ let users = addNames { mv = { mail = "mv@cd.retiolum"; - pubkey = readFile ../../Zpubkeys/mv_vod.ssh.pub; + pubkey = readFile ../Zpubkeys/mv_vod.ssh.pub; }; tv = { mail = "tv@wu.retiolum"; - pubkey = readFile ../../Zpubkeys/tv_wu.ssh.pub; + pubkey = readFile ../Zpubkeys/tv_wu.ssh.pub; }; }; }; diff --git a/krebs/3modules/github-hosts-sync.nix b/krebs/3modules/github-hosts-sync.nix index 0274b9d15..dbc0cc1de 100644 --- a/krebs/3modules/github-hosts-sync.nix +++ b/krebs/3modules/github-hosts-sync.nix @@ -61,9 +61,9 @@ let ${cfg.ssh-identity-file} \ "$ssh_identity_file_target" - ln -snf ${kpkgs.github-known_hosts} ${cfg.dataDir}/.ssh/known_hosts + ln -snf ${pkgs.github-known_hosts} ${cfg.dataDir}/.ssh/known_hosts ''; - ExecStart = "${kpkgs.github-hosts-sync}/bin/github-hosts-sync"; + ExecStart = "${pkgs.github-hosts-sync}/bin/github-hosts-sync"; }; }; @@ -77,7 +77,5 @@ let name = "github-hosts-sync"; uid = 3220554646; # genid github-hosts-sync }; - - kpkgs = import ../../krebs/5pkgs { inherit pkgs; }; in out diff --git a/krebs/3modules/retiolum.nix b/krebs/3modules/retiolum.nix index 481d6565c..4e70b78aa 100644 --- a/krebs/3modules/retiolum.nix +++ b/krebs/3modules/retiolum.nix @@ -58,7 +58,7 @@ let hosts = mkOption { type = with types; either package path; - default = ../../Zhosts; + default = ../Zhosts; description = '' If a path is given, then it will be used to generate an ad-hoc package. ''; diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index b67585335..ca7219c7e 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -14,5 +14,12 @@ builtins // lib // rec { dns = import ./dns.nix { inherit lib; }; listset = import ./listset.nix { inherit lib; }; + shell = import ./shell.nix { inherit lib; }; tree = import ./tree.nix { inherit lib; }; + + toC = x: { + list = "{ ${concatStringsSep ", " (map toC x)} }"; + null = "NULL"; + string = toJSON x; # close enough + }.${typeOf x}; } diff --git a/krebs/4lib/shell.nix b/krebs/4lib/shell.nix new file mode 100644 index 000000000..2a6da5c16 --- /dev/null +++ b/krebs/4lib/shell.nix @@ -0,0 +1,22 @@ +{ lib, ... }: + +with builtins; +with lib; + +rec { + escape = + let + isSafeChar = c: match "[-./0-9_a-zA-Z]" c != null; + in + stringAsChars (c: + if isSafeChar c then c + else if c == "\n" then "'\n'" + else "\\${c}"); + + # + # shell script generators + # + + # example: "${cat (toJSON { foo = "bar"; })} | jq -r .foo" + cat = s: "printf '%s' ${escape s}"; +} diff --git a/krebs/5pkgs/cac.nix b/krebs/5pkgs/cac/default.nix similarity index 100% rename from krebs/5pkgs/cac.nix rename to krebs/5pkgs/cac/default.nix diff --git a/tv/5pkgs/charybdis/default.nix b/krebs/5pkgs/charybdis/default.nix similarity index 100% rename from tv/5pkgs/charybdis/default.nix rename to krebs/5pkgs/charybdis/default.nix diff --git a/tv/5pkgs/charybdis/remove-setenv.patch b/krebs/5pkgs/charybdis/remove-setenv.patch similarity index 100% rename from tv/5pkgs/charybdis/remove-setenv.patch rename to krebs/5pkgs/charybdis/remove-setenv.patch diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix index 89872f1eb..500d5fe25 100644 --- a/krebs/5pkgs/default.nix +++ b/krebs/5pkgs/default.nix @@ -1,16 +1,52 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: + +with import ../4lib { inherit lib; }; let inherit (pkgs) callPackage; in -pkgs // -{ - cac = callPackage ./cac.nix {}; - dic = callPackage ./dic.nix {}; - genid = callPackage ./genid.nix {}; - github-hosts-sync = callPackage ./github-hosts-sync.nix {}; - github-known_hosts = callPackage ./github-known_hosts.nix {}; - hashPassword = callPackage ./hashPassword.nix {}; - posix-array = callPackage ./posix-array.nix {}; +rec { + cac = callPackage ./cac {}; + charybdis = callPackage ./charybdis {}; + dic = callPackage ./dic {}; + genid = callPackage ./genid {}; + github-hosts-sync = callPackage ./github-hosts-sync {}; + github-known_hosts = callPackage ./github-known_hosts {}; + hashPassword = callPackage ./hashPassword {}; + lentil = callPackage ./lentil {}; + much = callPackage ./much {}; + nq = callPackage ./nq {}; + posix-array = callPackage ./posix-array {}; + pssh = callPackage ./pssh {}; + youtube-tools = callPackage ./youtube-tools {}; + + execve = name: { filename, argv, envp ? {}, destination ? "" }: + writeC name { inherit destination; } '' + #include + int main () { + const char *filename = ${toC filename}; + char *const argv[] = ${toC (argv ++ [null])}; + char *const envp[] = ${toC ( + mapAttrsToList (k: v: "${k}=${v}") envp ++ [null] + )}; + execve(filename, argv, envp); + return -1; + } + ''; + + execveBin = name: cfg: execve name (cfg // { destination = "/bin/${name}"; }); + + writeC = name: { destination ? "" }: src: pkgs.runCommand name {} '' + PATH=${lib.makeSearchPath "bin" (with pkgs; [ + binutils + coreutils + gcc + ])} + src=${pkgs.writeText "${name}.c" src} + exe=$out${destination} + mkdir -p "$(dirname "$exe")" + gcc -O -Wall -o "$exe" $src + strip --strip-unneeded "$exe" + ''; } diff --git a/krebs/5pkgs/dic.nix b/krebs/5pkgs/dic/default.nix similarity index 100% rename from krebs/5pkgs/dic.nix rename to krebs/5pkgs/dic/default.nix diff --git a/krebs/5pkgs/genid.nix b/krebs/5pkgs/genid/default.nix similarity index 100% rename from krebs/5pkgs/genid.nix rename to krebs/5pkgs/genid/default.nix diff --git a/krebs/5pkgs/github-hosts-sync.nix b/krebs/5pkgs/github-hosts-sync/default.nix similarity index 100% rename from krebs/5pkgs/github-hosts-sync.nix rename to krebs/5pkgs/github-hosts-sync/default.nix diff --git a/krebs/5pkgs/github-known_hosts.nix b/krebs/5pkgs/github-known_hosts/default.nix similarity index 70% rename from krebs/5pkgs/github-known_hosts.nix rename to krebs/5pkgs/github-known_hosts/default.nix index 302fdd8d5..fe5efe413 100644 --- a/krebs/5pkgs/github-known_hosts.nix +++ b/krebs/5pkgs/github-known_hosts/default.nix @@ -4,7 +4,7 @@ with builtins; with lib; let - github-pubkey = removeSuffix "\n" (readFile ../../Zpubkeys/github.ssh.pub); + github-pubkey = removeSuffix "\n" (readFile ./github.ssh.pub); in toFile "github-known_hosts" diff --git a/Zpubkeys/github.ssh.pub b/krebs/5pkgs/github-known_hosts/github.ssh.pub similarity index 100% rename from Zpubkeys/github.ssh.pub rename to krebs/5pkgs/github-known_hosts/github.ssh.pub diff --git a/krebs/5pkgs/hashPassword.nix b/krebs/5pkgs/hashPassword/default.nix similarity index 100% rename from krebs/5pkgs/hashPassword.nix rename to krebs/5pkgs/hashPassword/default.nix diff --git a/tv/5pkgs/lentil/default.nix b/krebs/5pkgs/lentil/default.nix similarity index 100% rename from tv/5pkgs/lentil/default.nix rename to krebs/5pkgs/lentil/default.nix diff --git a/tv/5pkgs/lentil/syntaxes.patch b/krebs/5pkgs/lentil/syntaxes.patch similarity index 100% rename from tv/5pkgs/lentil/syntaxes.patch rename to krebs/5pkgs/lentil/syntaxes.patch diff --git a/tv/5pkgs/much.nix b/krebs/5pkgs/much/default.nix similarity index 100% rename from tv/5pkgs/much.nix rename to krebs/5pkgs/much/default.nix diff --git a/krebs/5pkgs/nq/default.nix b/krebs/5pkgs/nq/default.nix new file mode 100644 index 000000000..0f397a43c --- /dev/null +++ b/krebs/5pkgs/nq/default.nix @@ -0,0 +1,16 @@ +{ fetchgit, stdenv }: + +stdenv.mkDerivation rec { + name = "nq-${rev}"; + rev = "0eae839cb1"; + + src = fetchgit { + url = https://github.com/chneukirchen/nq; + inherit rev; + sha256 = "1150274750cde934932d65bd6053d7a0ba2404a59eadfb87fc6bd8a4fb70febb"; + }; + + configurePhase = '' + sed -i "s:^PREFIX=.*:PREFIX=$out:" Makefile + ''; +} diff --git a/krebs/5pkgs/posix-array.nix b/krebs/5pkgs/posix-array/default.nix similarity index 100% rename from krebs/5pkgs/posix-array.nix rename to krebs/5pkgs/posix-array/default.nix diff --git a/krebs/5pkgs/pssh/default.nix b/krebs/5pkgs/pssh/default.nix new file mode 100644 index 000000000..fd48d3e7c --- /dev/null +++ b/krebs/5pkgs/pssh/default.nix @@ -0,0 +1,37 @@ +{ writeScriptBin }: + +writeScriptBin "pssh" '' + #! /bin/sh + set -efu + case ''${1-} in + + # TODO create plog with -o json | jq ... | map date + + # usage: pssh {-j,--journal} host... + # Follow journal at each host. + -j|--journal) + shift + "$0" journalctl -n0 -ocat --follow --all ::: "$@" \ + | while read line; do + printf '%s %s\n' "$(date --rfc-3339=s)" "$line" + done + ;; + + -*) + echo $0: unknown option: $1 >&2 + exit 1 + ;; + + # usage: pssh command [arg...] ::: host... + # Run command at each host. + *) + exec parallel \ + --line-buffer \ + -j0 \ + --no-notice \ + --tagstring {} \ + ssh -T {} "$@" + ;; + + esac +'' diff --git a/krebs/5pkgs/youtube-tools/default.nix b/krebs/5pkgs/youtube-tools/default.nix new file mode 100644 index 000000000..d767728be --- /dev/null +++ b/krebs/5pkgs/youtube-tools/default.nix @@ -0,0 +1,21 @@ +{ stdenv, fetchgit, ... }: + +stdenv.mkDerivation { + name = "youtube-tools"; + + src = fetchgit { + url = https://github.com/Lassulus/the_playlist; + rev = "9218b163f2d8bc965b853ed9fc9e13d15a703456"; + sha256 = "ae5db4be652d015a518e57e4ed2de34b9127e77d9272af3049832bb134e96e4d"; + }; + + phases = [ + "unpackPhase" + "installPhase" + ]; + + installPhase = '' + mkdir -p $out/bin + cp bin/* $out/bin/ + ''; +} diff --git a/Zhosts/Styx b/krebs/Zhosts/Styx similarity index 100% rename from Zhosts/Styx rename to krebs/Zhosts/Styx diff --git a/Zhosts/ThinkArmageddon b/krebs/Zhosts/ThinkArmageddon similarity index 100% rename from Zhosts/ThinkArmageddon rename to krebs/Zhosts/ThinkArmageddon diff --git a/Zhosts/TriBot b/krebs/Zhosts/TriBot similarity index 100% rename from Zhosts/TriBot rename to krebs/Zhosts/TriBot diff --git a/Zhosts/ach b/krebs/Zhosts/ach similarity index 100% rename from Zhosts/ach rename to krebs/Zhosts/ach diff --git a/Zhosts/air b/krebs/Zhosts/air similarity index 100% rename from Zhosts/air rename to krebs/Zhosts/air diff --git a/Zhosts/alarmpi b/krebs/Zhosts/alarmpi similarity index 100% rename from Zhosts/alarmpi rename to krebs/Zhosts/alarmpi diff --git a/Zhosts/albi10 b/krebs/Zhosts/albi10 similarity index 100% rename from Zhosts/albi10 rename to krebs/Zhosts/albi10 diff --git a/Zhosts/albi7 b/krebs/Zhosts/albi7 similarity index 100% rename from Zhosts/albi7 rename to krebs/Zhosts/albi7 diff --git a/Zhosts/almoehi b/krebs/Zhosts/almoehi similarity index 100% rename from Zhosts/almoehi rename to krebs/Zhosts/almoehi diff --git a/Zhosts/alphalabs b/krebs/Zhosts/alphalabs similarity index 100% rename from Zhosts/alphalabs rename to krebs/Zhosts/alphalabs diff --git a/Zhosts/apfull b/krebs/Zhosts/apfull similarity index 100% rename from Zhosts/apfull rename to krebs/Zhosts/apfull diff --git a/Zhosts/bitchctl b/krebs/Zhosts/bitchctl similarity index 100% rename from Zhosts/bitchctl rename to krebs/Zhosts/bitchctl diff --git a/Zhosts/bitchextend b/krebs/Zhosts/bitchextend similarity index 100% rename from Zhosts/bitchextend rename to krebs/Zhosts/bitchextend diff --git a/Zhosts/bitchtop b/krebs/Zhosts/bitchtop similarity index 100% rename from Zhosts/bitchtop rename to krebs/Zhosts/bitchtop diff --git a/Zhosts/box b/krebs/Zhosts/box similarity index 100% rename from Zhosts/box rename to krebs/Zhosts/box diff --git a/Zhosts/bridge b/krebs/Zhosts/bridge similarity index 100% rename from Zhosts/bridge rename to krebs/Zhosts/bridge diff --git a/Zhosts/c2ft b/krebs/Zhosts/c2ft similarity index 100% rename from Zhosts/c2ft rename to krebs/Zhosts/c2ft diff --git a/Zhosts/c2fthome b/krebs/Zhosts/c2fthome similarity index 100% rename from Zhosts/c2fthome rename to krebs/Zhosts/c2fthome diff --git a/Zhosts/casino b/krebs/Zhosts/casino similarity index 100% rename from Zhosts/casino rename to krebs/Zhosts/casino diff --git a/Zhosts/cat1 b/krebs/Zhosts/cat1 similarity index 100% rename from Zhosts/cat1 rename to krebs/Zhosts/cat1 diff --git a/Zhosts/cband b/krebs/Zhosts/cband similarity index 100% rename from Zhosts/cband rename to krebs/Zhosts/cband diff --git a/Zhosts/cd b/krebs/Zhosts/cd similarity index 100% rename from Zhosts/cd rename to krebs/Zhosts/cd diff --git a/Zhosts/cloudkrebs b/krebs/Zhosts/cloudkrebs similarity index 100% rename from Zhosts/cloudkrebs rename to krebs/Zhosts/cloudkrebs diff --git a/Zhosts/darth b/krebs/Zhosts/darth similarity index 100% rename from Zhosts/darth rename to krebs/Zhosts/darth diff --git a/Zhosts/dei b/krebs/Zhosts/dei similarity index 100% rename from Zhosts/dei rename to krebs/Zhosts/dei diff --git a/Zhosts/destroy b/krebs/Zhosts/destroy similarity index 100% rename from Zhosts/destroy rename to krebs/Zhosts/destroy diff --git a/Zhosts/devstar b/krebs/Zhosts/devstar similarity index 100% rename from Zhosts/devstar rename to krebs/Zhosts/devstar diff --git a/Zhosts/eigenserv b/krebs/Zhosts/eigenserv similarity index 100% rename from Zhosts/eigenserv rename to krebs/Zhosts/eigenserv diff --git a/Zhosts/elvis b/krebs/Zhosts/elvis similarity index 100% rename from Zhosts/elvis rename to krebs/Zhosts/elvis diff --git a/Zhosts/eulerwalk b/krebs/Zhosts/eulerwalk similarity index 100% rename from Zhosts/eulerwalk rename to krebs/Zhosts/eulerwalk diff --git a/Zhosts/exile b/krebs/Zhosts/exile similarity index 100% rename from Zhosts/exile rename to krebs/Zhosts/exile diff --git a/Zhosts/exitium_mobilis b/krebs/Zhosts/exitium_mobilis similarity index 100% rename from Zhosts/exitium_mobilis rename to krebs/Zhosts/exitium_mobilis diff --git a/Zhosts/falk b/krebs/Zhosts/falk similarity index 100% rename from Zhosts/falk rename to krebs/Zhosts/falk diff --git a/Zhosts/fastpoke b/krebs/Zhosts/fastpoke similarity index 100% rename from Zhosts/fastpoke rename to krebs/Zhosts/fastpoke diff --git a/Zhosts/filebitch b/krebs/Zhosts/filebitch similarity index 100% rename from Zhosts/filebitch rename to krebs/Zhosts/filebitch diff --git a/Zhosts/filepimp b/krebs/Zhosts/filepimp similarity index 100% rename from Zhosts/filepimp rename to krebs/Zhosts/filepimp diff --git a/Zhosts/flap b/krebs/Zhosts/flap similarity index 94% rename from Zhosts/flap rename to krebs/Zhosts/flap index ea6aace53..94e6bdc75 100644 --- a/Zhosts/flap +++ b/krebs/Zhosts/flap @@ -1,4 +1,5 @@ Subnet = 10.243.211.172 +Subnet = 10.243.211.172 53 Subnet = 42:472a:3d01:bbe4:4425:567e:592b:065d -----BEGIN RSA PUBLIC KEY----- diff --git a/Zhosts/foobar b/krebs/Zhosts/foobar similarity index 100% rename from Zhosts/foobar rename to krebs/Zhosts/foobar diff --git a/Zhosts/fuerkrebs b/krebs/Zhosts/fuerkrebs similarity index 100% rename from Zhosts/fuerkrebs rename to krebs/Zhosts/fuerkrebs diff --git a/Zhosts/go b/krebs/Zhosts/go similarity index 100% rename from Zhosts/go rename to krebs/Zhosts/go diff --git a/Zhosts/gum b/krebs/Zhosts/gum similarity index 95% rename from Zhosts/gum rename to krebs/Zhosts/gum index 9749f975a..f1eaa4eab 100644 --- a/Zhosts/gum +++ b/krebs/Zhosts/gum @@ -1,4 +1,5 @@ Address= 195.154.108.70 +Address= 195.154.108.70 53 Subnet = 10.243.0.211 Subnet = 42:f9f0:0000:0000:0000:0000:0000:70d2 Aliases = paste diff --git a/Zhosts/heidi b/krebs/Zhosts/heidi similarity index 100% rename from Zhosts/heidi rename to krebs/Zhosts/heidi diff --git a/Zhosts/horisa b/krebs/Zhosts/horisa similarity index 100% rename from Zhosts/horisa rename to krebs/Zhosts/horisa diff --git a/Zhosts/horreum_magnus b/krebs/Zhosts/horreum_magnus similarity index 100% rename from Zhosts/horreum_magnus rename to krebs/Zhosts/horreum_magnus diff --git a/Zhosts/incept b/krebs/Zhosts/incept similarity index 100% rename from Zhosts/incept rename to krebs/Zhosts/incept diff --git a/Zhosts/ire b/krebs/Zhosts/ire similarity index 100% rename from Zhosts/ire rename to krebs/Zhosts/ire diff --git a/Zhosts/ire2 b/krebs/Zhosts/ire2 similarity index 100% rename from Zhosts/ire2 rename to krebs/Zhosts/ire2 diff --git a/Zhosts/irkel b/krebs/Zhosts/irkel similarity index 100% rename from Zhosts/irkel rename to krebs/Zhosts/irkel diff --git a/Zhosts/juhulian b/krebs/Zhosts/juhulian similarity index 100% rename from Zhosts/juhulian rename to krebs/Zhosts/juhulian diff --git a/Zhosts/k2 b/krebs/Zhosts/k2 similarity index 100% rename from Zhosts/k2 rename to krebs/Zhosts/k2 diff --git a/Zhosts/kabinett b/krebs/Zhosts/kabinett similarity index 100% rename from Zhosts/kabinett rename to krebs/Zhosts/kabinett diff --git a/Zhosts/kaepsele b/krebs/Zhosts/kaepsele similarity index 100% rename from Zhosts/kaepsele rename to krebs/Zhosts/kaepsele diff --git a/Zhosts/kalle b/krebs/Zhosts/kalle similarity index 100% rename from Zhosts/kalle rename to krebs/Zhosts/kalle diff --git a/Zhosts/karthus b/krebs/Zhosts/karthus similarity index 100% rename from Zhosts/karthus rename to krebs/Zhosts/karthus diff --git a/Zhosts/khackplug b/krebs/Zhosts/khackplug similarity index 100% rename from Zhosts/khackplug rename to krebs/Zhosts/khackplug diff --git a/Zhosts/kheurop b/krebs/Zhosts/kheurop similarity index 100% rename from Zhosts/kheurop rename to krebs/Zhosts/kheurop diff --git a/Zhosts/kiosk b/krebs/Zhosts/kiosk similarity index 100% rename from Zhosts/kiosk rename to krebs/Zhosts/kiosk diff --git a/Zhosts/krebsplug b/krebs/Zhosts/krebsplug similarity index 100% rename from Zhosts/krebsplug rename to krebs/Zhosts/krebsplug diff --git a/Zhosts/kvasir b/krebs/Zhosts/kvasir similarity index 100% rename from Zhosts/kvasir rename to krebs/Zhosts/kvasir diff --git a/Zhosts/laqueus b/krebs/Zhosts/laqueus similarity index 100% rename from Zhosts/laqueus rename to krebs/Zhosts/laqueus diff --git a/Zhosts/linuxatom b/krebs/Zhosts/linuxatom similarity index 100% rename from Zhosts/linuxatom rename to krebs/Zhosts/linuxatom diff --git a/Zhosts/luminos b/krebs/Zhosts/luminos similarity index 100% rename from Zhosts/luminos rename to krebs/Zhosts/luminos diff --git a/Zhosts/machine b/krebs/Zhosts/machine similarity index 100% rename from Zhosts/machine rename to krebs/Zhosts/machine diff --git a/Zhosts/makalu b/krebs/Zhosts/makalu similarity index 100% rename from Zhosts/makalu rename to krebs/Zhosts/makalu diff --git a/Zhosts/mako b/krebs/Zhosts/mako similarity index 100% rename from Zhosts/mako rename to krebs/Zhosts/mako diff --git a/Zhosts/miefda0 b/krebs/Zhosts/miefda0 similarity index 100% rename from Zhosts/miefda0 rename to krebs/Zhosts/miefda0 diff --git a/Zhosts/minikrebs b/krebs/Zhosts/minikrebs similarity index 100% rename from Zhosts/minikrebs rename to krebs/Zhosts/minikrebs diff --git a/Zhosts/mkdir b/krebs/Zhosts/mkdir similarity index 100% rename from Zhosts/mkdir rename to krebs/Zhosts/mkdir diff --git a/Zhosts/monitor b/krebs/Zhosts/monitor similarity index 100% rename from Zhosts/monitor rename to krebs/Zhosts/monitor diff --git a/Zhosts/mors b/krebs/Zhosts/mors similarity index 100% rename from Zhosts/mors rename to krebs/Zhosts/mors diff --git a/Zhosts/motor b/krebs/Zhosts/motor similarity index 100% rename from Zhosts/motor rename to krebs/Zhosts/motor diff --git a/Zhosts/mu b/krebs/Zhosts/mu similarity index 100% rename from Zhosts/mu rename to krebs/Zhosts/mu diff --git a/Zhosts/muhbaasu b/krebs/Zhosts/muhbaasu similarity index 100% rename from Zhosts/muhbaasu rename to krebs/Zhosts/muhbaasu diff --git a/Zhosts/nomic b/krebs/Zhosts/nomic similarity index 100% rename from Zhosts/nomic rename to krebs/Zhosts/nomic diff --git a/Zhosts/nomic2 b/krebs/Zhosts/nomic2 similarity index 100% rename from Zhosts/nomic2 rename to krebs/Zhosts/nomic2 diff --git a/Zhosts/nukular b/krebs/Zhosts/nukular similarity index 100% rename from Zhosts/nukular rename to krebs/Zhosts/nukular diff --git a/Zhosts/omo b/krebs/Zhosts/omo similarity index 100% rename from Zhosts/omo rename to krebs/Zhosts/omo diff --git a/Zhosts/pic b/krebs/Zhosts/pic similarity index 100% rename from Zhosts/pic rename to krebs/Zhosts/pic diff --git a/Zhosts/pigstarter b/krebs/Zhosts/pigstarter similarity index 100% rename from Zhosts/pigstarter rename to krebs/Zhosts/pigstarter diff --git a/Zhosts/pike b/krebs/Zhosts/pike similarity index 100% rename from Zhosts/pike rename to krebs/Zhosts/pike diff --git a/Zhosts/pnp b/krebs/Zhosts/pnp similarity index 100% rename from Zhosts/pnp rename to krebs/Zhosts/pnp diff --git a/Zhosts/pornocauster b/krebs/Zhosts/pornocauster similarity index 100% rename from Zhosts/pornocauster rename to krebs/Zhosts/pornocauster diff --git a/Zhosts/radiotuxmini b/krebs/Zhosts/radiotuxmini similarity index 100% rename from Zhosts/radiotuxmini rename to krebs/Zhosts/radiotuxmini diff --git a/Zhosts/random b/krebs/Zhosts/random similarity index 100% rename from Zhosts/random rename to krebs/Zhosts/random diff --git a/Zhosts/raspafari b/krebs/Zhosts/raspafari similarity index 100% rename from Zhosts/raspafari rename to krebs/Zhosts/raspafari diff --git a/Zhosts/reimae b/krebs/Zhosts/reimae similarity index 100% rename from Zhosts/reimae rename to krebs/Zhosts/reimae diff --git a/Zhosts/rmdir b/krebs/Zhosts/rmdir similarity index 100% rename from Zhosts/rmdir rename to krebs/Zhosts/rmdir diff --git a/Zhosts/robchina b/krebs/Zhosts/robchina similarity index 100% rename from Zhosts/robchina rename to krebs/Zhosts/robchina diff --git a/Zhosts/rockit b/krebs/Zhosts/rockit similarity index 100% rename from Zhosts/rockit rename to krebs/Zhosts/rockit diff --git a/Zhosts/rtjure_debian_oder_so b/krebs/Zhosts/rtjure_debian_oder_so similarity index 100% rename from Zhosts/rtjure_debian_oder_so rename to krebs/Zhosts/rtjure_debian_oder_so diff --git a/Zhosts/rtjure_ras b/krebs/Zhosts/rtjure_ras similarity index 100% rename from Zhosts/rtjure_ras rename to krebs/Zhosts/rtjure_ras diff --git a/Zhosts/rtjure_rdrlab_linkstation b/krebs/Zhosts/rtjure_rdrlab_linkstation similarity index 100% rename from Zhosts/rtjure_rdrlab_linkstation rename to krebs/Zhosts/rtjure_rdrlab_linkstation diff --git a/Zhosts/rubus b/krebs/Zhosts/rubus similarity index 100% rename from Zhosts/rubus rename to krebs/Zhosts/rubus diff --git a/Zhosts/senderechner b/krebs/Zhosts/senderechner similarity index 100% rename from Zhosts/senderechner rename to krebs/Zhosts/senderechner diff --git a/Zhosts/serenity b/krebs/Zhosts/serenity similarity index 100% rename from Zhosts/serenity rename to krebs/Zhosts/serenity diff --git a/Zhosts/seruundroid b/krebs/Zhosts/seruundroid similarity index 100% rename from Zhosts/seruundroid rename to krebs/Zhosts/seruundroid diff --git a/Zhosts/sir_krebs_a_lot b/krebs/Zhosts/sir_krebs_a_lot similarity index 100% rename from Zhosts/sir_krebs_a_lot rename to krebs/Zhosts/sir_krebs_a_lot diff --git a/Zhosts/skirfir b/krebs/Zhosts/skirfir similarity index 100% rename from Zhosts/skirfir rename to krebs/Zhosts/skirfir diff --git a/Zhosts/sleipnir b/krebs/Zhosts/sleipnir similarity index 100% rename from Zhosts/sleipnir rename to krebs/Zhosts/sleipnir diff --git a/Zhosts/smove b/krebs/Zhosts/smove similarity index 100% rename from Zhosts/smove rename to krebs/Zhosts/smove diff --git a/Zhosts/sokrates b/krebs/Zhosts/sokrates similarity index 100% rename from Zhosts/sokrates rename to krebs/Zhosts/sokrates diff --git a/Zhosts/sokrateslaptop b/krebs/Zhosts/sokrateslaptop similarity index 100% rename from Zhosts/sokrateslaptop rename to krebs/Zhosts/sokrateslaptop diff --git a/Zhosts/soundflower b/krebs/Zhosts/soundflower similarity index 100% rename from Zhosts/soundflower rename to krebs/Zhosts/soundflower diff --git a/Zhosts/steve b/krebs/Zhosts/steve similarity index 100% rename from Zhosts/steve rename to krebs/Zhosts/steve diff --git a/Zhosts/tahoe b/krebs/Zhosts/tahoe similarity index 100% rename from Zhosts/tahoe rename to krebs/Zhosts/tahoe diff --git a/Zhosts/taschenkrebs b/krebs/Zhosts/taschenkrebs similarity index 100% rename from Zhosts/taschenkrebs rename to krebs/Zhosts/taschenkrebs diff --git a/Zhosts/terrapi b/krebs/Zhosts/terrapi similarity index 100% rename from Zhosts/terrapi rename to krebs/Zhosts/terrapi diff --git a/Zhosts/thomasDOTde b/krebs/Zhosts/thomasDOTde similarity index 100% rename from Zhosts/thomasDOTde rename to krebs/Zhosts/thomasDOTde diff --git a/Zhosts/tincdroid b/krebs/Zhosts/tincdroid similarity index 100% rename from Zhosts/tincdroid rename to krebs/Zhosts/tincdroid diff --git a/Zhosts/tmpd b/krebs/Zhosts/tmpd similarity index 100% rename from Zhosts/tmpd rename to krebs/Zhosts/tmpd diff --git a/Zhosts/tpsw b/krebs/Zhosts/tpsw similarity index 100% rename from Zhosts/tpsw rename to krebs/Zhosts/tpsw diff --git a/Zhosts/tsp b/krebs/Zhosts/tsp similarity index 100% rename from Zhosts/tsp rename to krebs/Zhosts/tsp diff --git a/Zhosts/ufo b/krebs/Zhosts/ufo similarity index 100% rename from Zhosts/ufo rename to krebs/Zhosts/ufo diff --git a/Zhosts/uriel b/krebs/Zhosts/uriel similarity index 100% rename from Zhosts/uriel rename to krebs/Zhosts/uriel diff --git a/Zhosts/vault b/krebs/Zhosts/vault similarity index 100% rename from Zhosts/vault rename to krebs/Zhosts/vault diff --git a/Zhosts/voyager b/krebs/Zhosts/voyager similarity index 100% rename from Zhosts/voyager rename to krebs/Zhosts/voyager diff --git a/Zhosts/wooktop b/krebs/Zhosts/wooktop similarity index 100% rename from Zhosts/wooktop rename to krebs/Zhosts/wooktop diff --git a/Zhosts/wu b/krebs/Zhosts/wu similarity index 100% rename from Zhosts/wu rename to krebs/Zhosts/wu diff --git a/Zhosts/ytart b/krebs/Zhosts/ytart similarity index 100% rename from Zhosts/ytart rename to krebs/Zhosts/ytart diff --git a/Zhosts/zombiecancer b/krebs/Zhosts/zombiecancer similarity index 100% rename from Zhosts/zombiecancer rename to krebs/Zhosts/zombiecancer diff --git a/Zpubkeys/deploy_wu.ssh.pub b/krebs/Zpubkeys/deploy_wu.ssh.pub similarity index 100% rename from Zpubkeys/deploy_wu.ssh.pub rename to krebs/Zpubkeys/deploy_wu.ssh.pub diff --git a/Zpubkeys/lass.ssh.pub b/krebs/Zpubkeys/lass.ssh.pub similarity index 100% rename from Zpubkeys/lass.ssh.pub rename to krebs/Zpubkeys/lass.ssh.pub diff --git a/Zpubkeys/makefu_arch.ssh.pub b/krebs/Zpubkeys/makefu_arch.ssh.pub similarity index 100% rename from Zpubkeys/makefu_arch.ssh.pub rename to krebs/Zpubkeys/makefu_arch.ssh.pub diff --git a/Zpubkeys/makefu_omo.ssh.pub b/krebs/Zpubkeys/makefu_omo.ssh.pub similarity index 100% rename from Zpubkeys/makefu_omo.ssh.pub rename to krebs/Zpubkeys/makefu_omo.ssh.pub diff --git a/Zpubkeys/makefu_tsp.ssh.pub b/krebs/Zpubkeys/makefu_tsp.ssh.pub similarity index 100% rename from Zpubkeys/makefu_tsp.ssh.pub rename to krebs/Zpubkeys/makefu_tsp.ssh.pub diff --git a/Zpubkeys/mv_vod.ssh.pub b/krebs/Zpubkeys/mv_vod.ssh.pub similarity index 100% rename from Zpubkeys/mv_vod.ssh.pub rename to krebs/Zpubkeys/mv_vod.ssh.pub diff --git a/Zpubkeys/tv_wu.ssh.pub b/krebs/Zpubkeys/tv_wu.ssh.pub similarity index 100% rename from Zpubkeys/tv_wu.ssh.pub rename to krebs/Zpubkeys/tv_wu.ssh.pub diff --git a/Zpubkeys/uriel.ssh.pub b/krebs/Zpubkeys/uriel.ssh.pub similarity index 100% rename from Zpubkeys/uriel.ssh.pub rename to krebs/Zpubkeys/uriel.ssh.pub diff --git a/lass/1systems/cloudkrebs.nix b/lass/1systems/cloudkrebs.nix index 515810e44..7c95e0f87 100644 --- a/lass/1systems/cloudkrebs.nix +++ b/lass/1systems/cloudkrebs.nix @@ -28,10 +28,6 @@ target = "root@cloudkrebs"; host = config.krebs.hosts.cloudkrebs; deps = { - nixpkgs = { - url = https://github.com/Lassulus/nixpkgs; - rev = "1879a011925c561f0a7fd4043da0768bbff41d0b"; - }; secrets = { url = "/home/lass/secrets/${config.krebs.build.host.name}"; }; diff --git a/lass/1systems/mors.nix b/lass/1systems/mors.nix index e7f8d5276..d07fe14d9 100644 --- a/lass/1systems/mors.nix +++ b/lass/1systems/mors.nix @@ -15,12 +15,13 @@ ../2configs/wine.nix ../2configs/texlive.nix ../2configs/binary-caches.nix - ../2configs/ircd.nix + #../2configs/ircd.nix ../2configs/chromium-patched.nix ../2configs/new-repos.nix #../../2configs/tv/synaptics.nix ../2configs/retiolum.nix ../2configs/wordpress.nix + ../2configs/bitlbee.nix ]; krebs.build = { @@ -28,10 +29,6 @@ target = "root@mors"; host = config.krebs.hosts.mors; deps = { - nixpkgs = { - url = https://github.com/Lassulus/nixpkgs; - rev = "961fd7b7a0f88dde7dac2f7a4c05ee4e1a25381d"; - }; secrets = { url = "/home/lass/secrets/${config.krebs.build.host.name}"; }; @@ -128,7 +125,7 @@ #VM writeback timeout echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs' #Autosuspend for USB device Broadcom Bluetooth Device [Broadcom Corp] - echo 'auto' > '/sys/bus/usb/devices/1-1.4/power/control' + #echo 'auto' > '/sys/bus/usb/devices/1-1.4/power/control' #Autosuspend for USB device Biometric Coprocessor echo 'auto' > '/sys/bus/usb/devices/1-1.3/power/control' diff --git a/lass/1systems/uriel.nix b/lass/1systems/uriel.nix index 041b891b6..7c3d08123 100644 --- a/lass/1systems/uriel.nix +++ b/lass/1systems/uriel.nix @@ -28,10 +28,6 @@ with builtins; target = "root@uriel"; host = config.krebs.hosts.uriel; deps = { - nixpkgs = { - url = https://github.com/Lassulus/nixpkgs; - rev = "961fcbabd7643171ea74bd550fee1ce5c13c2e90"; - }; secrets = { url = "/home/lass/secrets/${config.krebs.build.host.name}"; }; diff --git a/lass/2configs/base.nix b/lass/2configs/base.nix index 095c7660c..d44a19c1e 100644 --- a/lass/2configs/base.nix +++ b/lass/2configs/base.nix @@ -39,12 +39,20 @@ with lib; krebs = { enable = true; search-domain = "retiolum"; + exim-retiolum.enable = true; + build.deps.nixpkgs = { + url = https://github.com/Lassulus/nixpkgs; + rev = "58a82ff50b8605b88a8f66481d8c85bf8ab53be3"; + }; }; nix.useChroot = true; users.mutableUsers = false; + #why is this on in the first place? + services.ntp.enable = false; + boot.tmpOnTmpfs = true; # see tmpfiles.d(5) systemd.tmpfiles.rules = [ @@ -134,6 +142,7 @@ with lib; { predicate = "-p icmp"; target = "ACCEPT"; precedence = 10000; } { predicate = "-i lo"; target = "ACCEPT"; precedence = 9999; } { predicate = "-p tcp --dport 22"; target = "ACCEPT"; precedence = 9998; } + { predicate = "-i retiolum"; target = "REJECT"; precedence = -10000; } ]; }; }; diff --git a/lass/2configs/bitlbee.nix b/lass/2configs/bitlbee.nix new file mode 100644 index 000000000..3a0080402 --- /dev/null +++ b/lass/2configs/bitlbee.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: + +let + lpkgs = import ../5pkgs { inherit pkgs; }; +in { + + imports = [ + ../3modules/bitlbee.nix + ]; + + config.lass.bitlbee = { + enable = true; + bitlbeePkg = lpkgs.bitlbee; + }; +} diff --git a/lass/2configs/browsers.nix b/lass/2configs/browsers.nix index 8aecea925..9849c829a 100644 --- a/lass/2configs/browsers.nix +++ b/lass/2configs/browsers.nix @@ -1,67 +1,50 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: let + inherit (import ../4lib { inherit pkgs lib; }) simpleScript; + mainUser = config.users.extraUsers.mainUser; + createBrowserUser = name: extraGroups: packages: + { + users.extraUsers = { + ${name} = { + inherit name; + inherit extraGroups; + home = "/home/${name}"; + useDefaultShell = true; + createHome = true; + }; + }; + lass.per-user.${name}.packages = packages; + security.sudo.extraConfig = '' + ${mainUser.name} ALL=(${name}) NOPASSWD: ALL + ''; + environment.systemPackages = [ + (simpleScript name '' + sudo -u ${name} -i chromium $@ + '') + ]; + }; in { + imports = [ + ../3modules/per-user.nix + ] ++ [ + ( createBrowserUser "ff" [ "audio" ] [ pkgs.firefox ] ) + ( createBrowserUser "cr" [ "audio" ] [ pkgs.chromium ] ) + ( createBrowserUser "fb" [ ] [ pkgs.chromium ] ) + ( createBrowserUser "gm" [ ] [ pkgs.chromium ] ) + ( createBrowserUser "flash" [ ] [ pkgs.flash ] ) + ]; + nixpkgs.config.packageOverrides = pkgs : { + flash = pkgs.chromium.override { + pulseSupport = true; + enablePepperFlash = true; + }; chromium = pkgs.chromium.override { pulseSupport = true; }; }; - - environment.systemPackages = with pkgs; [ - firefox - ]; - - users.extraUsers = { - firefox = { - name = "firefox"; - description = "user for running firefox"; - home = "/home/firefox"; - useDefaultShell = true; - extraGroups = [ "audio" ]; - createHome = true; - }; - chromium = { - name = "chromium"; - description = "user for running chromium"; - home = "/home/chromium"; - useDefaultShell = true; - extraGroups = [ "audio" ]; - createHome = true; - }; - facebook = { - name = "facebook"; - description = "user for running facebook in chromium"; - home = "/home/facebook"; - useDefaultShell = true; - extraGroups = [ "audio" ]; - createHome = true; - }; - google = { - name = "google"; - description = "user for running google+/gmail in chromium"; - home = "/home/google"; - useDefaultShell = true; - createHome = true; - }; - flash = { - name = "flash"; - description = "user for running flash stuff"; - home = "/home/flash"; - useDefaultShell = true; - extraGroups = [ "audio" ]; - createHome = true; - }; - }; - - security.sudo.extraConfig = '' - ${mainUser.name} ALL=(firefox) NOPASSWD: ALL - ${mainUser.name} ALL=(chromium) NOPASSWD: ALL - ${mainUser.name} ALL=(facebook) NOPASSWD: ALL - ${mainUser.name} ALL=(google) NOPASSWD: ALL - ${mainUser.name} ALL=(flash) NOPASSWD: ALL - ''; } diff --git a/lass/2configs/new-repos.nix b/lass/2configs/new-repos.nix index 64e9a7f14..026f9a665 100644 --- a/lass/2configs/new-repos.nix +++ b/lass/2configs/new-repos.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: with import ../../tv/4lib { inherit lib pkgs; }; + let out = { @@ -8,14 +9,14 @@ let enable = true; root-title = "public repositories at ${config.krebs.build.host.name}"; root-desc = "keep calm and engage"; - inherit repos rules; + repos = mapAttrs (_: s: removeAttrs s ["collaborators"]) repos; + rules = rules; }; }; - repos = mapAttrs (_: s: removeAttrs s ["collaborators"]) ( + repos = public-repos // - optionalAttrs config.krebs.build.host.secure restricted-repos - ); + optionalAttrs config.krebs.build.host.secure restricted-repos; rules = concatMap make-rules (attrValues repos); @@ -50,8 +51,8 @@ let }; }; - make-restricted-repo = name: { desc ? null, ... }: { - inherit name desc; + make-restricted-repo = name: { collaborators ? [], desc ? null, ... }: { + inherit name collaborators desc; public = false; }; diff --git a/lass/2configs/retiolum.nix b/lass/2configs/retiolum.nix index 2d583a88a..7c7f2b4d4 100644 --- a/lass/2configs/retiolum.nix +++ b/lass/2configs/retiolum.nix @@ -22,6 +22,8 @@ "fastpoke" "cloudkrebs" "pigstarter" + "gum" + "flap" ]; }; } diff --git a/lass/2configs/texlive.nix b/lass/2configs/texlive.nix index 295df31cd..18d72297d 100644 --- a/lass/2configs/texlive.nix +++ b/lass/2configs/texlive.nix @@ -2,6 +2,6 @@ { environment.systemPackages = with pkgs; [ - (pkgs.texLiveAggregationFun { paths = [ pkgs.texLive pkgs.texLiveFull ]; }) + texLive ]; } diff --git a/lass/2configs/virtualbox.nix b/lass/2configs/virtualbox.nix index 026203124..ad7ac1429 100644 --- a/lass/2configs/virtualbox.nix +++ b/lass/2configs/virtualbox.nix @@ -4,7 +4,7 @@ let mainUser = config.users.extraUsers.mainUser; in { - services.virtualboxHost.enable = true; + virtualisation.virtualbox.host.enable = true; users.extraUsers = { virtual = { diff --git a/lass/3modules/bitlbee.nix b/lass/3modules/bitlbee.nix new file mode 100644 index 000000000..8ce560146 --- /dev/null +++ b/lass/3modules/bitlbee.nix @@ -0,0 +1,153 @@ +{ config, lib, pkgs, ... }: + + +let + + inherit (lib) + mkIf + mkOption + types + singleton + ; + + authModeCheck = v: + v == "Open" || + v == "Closed" || + v == "Registered" + ; + + bitlbeeConfig = pkgs.writeText "bitlbee.conf" '' + [settings] + RunMode = Daemon + User = bitlbee + ConfigDir = ${cfg.configDir} + DaemonInterface = ${cfg.interface} + DaemonPort = ${toString cfg.portNumber} + AuthMode = ${cfg.authMode} + ${lib.optionalString (cfg.hostName != "") "HostName = ${cfg.hostName}"} + ${lib.optionalString (cfg.protocols != "") "Protocols = ${cfg.protocols}"} + ${cfg.extraSettings} + + [defaults] + ${cfg.extraDefaults} + ''; + + cfg = config.lass.bitlbee; + + out = { + options.lass.bitlbee = api; + config = mkIf cfg.enable imp; + }; + + api = { + enable = mkOption { + default = false; + description = '' + Whether to run the BitlBee IRC to other chat network gateway. + Running it allows you to access the MSN, Jabber, Yahoo! and ICQ chat + networks via an IRC client. + ''; + }; + + interface = mkOption { + default = "127.0.0.1"; + description = '' + The interface the BitlBee deamon will be listening to. If `127.0.0.1', + only clients on the local host can connect to it; if `0.0.0.0', clients + can access it from any network interface. + ''; + }; + + portNumber = mkOption { + default = 6667; + description = '' + Number of the port BitlBee will be listening to. + ''; + }; + + authMode = mkOption { + default = "Open"; + type = types.addCheck types.str authModeCheck; + description = '' + The following authentication modes are available: + Open -- Accept connections from anyone, use NickServ for user authentication. + Closed -- Require authorization (using the PASS command during login) before allowing the user to connect at all. + Registered -- Only allow registered users to use this server; this disables the register- and the account command until the user identifies himself. + ''; + }; + + hostName = mkOption { + default = ""; + type = types.str; + description = '' + Normally, BitlBee gets a hostname using getsockname(). If you have a nicer + alias for your BitlBee daemon, you can set it here and BitlBee will identify + itself with that name instead. + ''; + }; + + configDir = mkOption { + default = "/var/lib/bitlbee"; + type = types.path; + description = '' + Specify an alternative directory to store all the per-user configuration + files. + ''; + }; + + protocols = mkOption { + default = ""; + type = types.str; + description = '' + This option allows to remove the support of protocol, even if compiled + in. If nothing is given, there are no restrictions. + ''; + }; + + extraSettings = mkOption { + default = ""; + description = '' + Will be inserted in the Settings section of the config file. + ''; + }; + + extraDefaults = mkOption { + default = ""; + description = '' + Will be inserted in the Default section of the config file. + ''; + }; + + bitlbeePkg = mkOption { + default = pkgs.bitlbee; + description = '' + the bitlbee pkg to use. + ''; + }; + }; + + imp = { + users.extraUsers = singleton { + name = "bitlbee"; + uid = config.ids.uids.bitlbee; + description = "BitlBee user"; + home = "/var/lib/bitlbee"; + createHome = true; + }; + + users.extraGroups = singleton { + name = "bitlbee"; + gid = config.ids.gids.bitlbee; + }; + + systemd.services.bitlbee = { + description = "BitlBee IRC to other chat networks gateway"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig.User = "bitlbee"; + serviceConfig.ExecStart = "${cfg.bitlbeePkg}/sbin/bitlbee -F -n -c ${bitlbeeConfig}"; + }; + }; + +in +out diff --git a/lass/3modules/per-user.nix b/lass/3modules/per-user.nix new file mode 100644 index 000000000..98d6339db --- /dev/null +++ b/lass/3modules/per-user.nix @@ -0,0 +1,54 @@ +{ config, lib, pkgs, ... }: + +with builtins; +with lib; +let + cfg = config.lass.per-user; + + out = { + options.lass.per-user = api; + config = imp; + }; + + api = mkOption { + type = with types; attrsOf (submodule { + options = { + packages = mkOption { + type = listOf path; + default = []; + }; + }; + }); + default = {}; + }; + + imp = { + # + # TODO only shellInit and use well-known paths + # + environment.shellInit = '' + if test -e ${user-profiles}/"$LOGNAME"; then + . ${user-profiles}/"$LOGNAME" + fi + ''; + environment.interactiveShellInit = '' + if test -e ${user-profiles}/"$LOGNAME"; then + . ${user-profiles}/"$LOGNAME" + fi + ''; + environment.profileRelativeEnvVars.PATH = mkForce [ "/bin" ]; + }; + + user-profiles = pkgs.runCommand "user-profiles" {} '' + mkdir $out + ${concatStrings (mapAttrsToList (logname: { packages, ... }: '' + cat > $out/${logname} <<\EOF + ${optionalString (length packages > 0) ( + let path = makeSearchPath "bin" packages; in + ''export PATH="$PATH":${escapeShellArg path}'' + )} + EOF + '') cfg)} + ''; + +in out diff --git a/lass/4lib/default.nix b/lass/4lib/default.nix new file mode 100644 index 000000000..21a083d1a --- /dev/null +++ b/lass/4lib/default.nix @@ -0,0 +1,20 @@ +{ lib, pkgs, ... }: + +let + krebs = import ../../krebs/4lib { inherit lib; }; +in + +with krebs; + +krebs // rec { + + simpleScript = name: content: + pkgs.stdenv.mkDerivation { + inherit name; + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out/bin + ln -s ${pkgs.writeScript name content} $out/bin/${name} + ''; + }; +} diff --git a/lass/5pkgs/bitlbee-dev.nix b/lass/5pkgs/bitlbee-dev.nix new file mode 100644 index 000000000..dd129591e --- /dev/null +++ b/lass/5pkgs/bitlbee-dev.nix @@ -0,0 +1,20 @@ +{ fetchurl, stdenv, gnutls, glib, pkgconfig, check, libotr, python }: + +stdenv.mkDerivation rec { + name = "bitlbee-3.4.1"; + + src = fetchurl { + url = "mirror://bitlbee/src/${name}.tar.gz"; + sha256 = "1qf0ypa9ba5jvsnpg9slmaran16hcc5fnfzbb1sdch1hjhchn2jh"; + }; + + buildInputs = [ gnutls glib pkgconfig libotr python ]; + + buildPhase = ""; + + installPhase = '' + make install-dev + ''; + +} + diff --git a/lass/5pkgs/bitlbee-steam.nix b/lass/5pkgs/bitlbee-steam.nix new file mode 100644 index 000000000..d869eaac5 --- /dev/null +++ b/lass/5pkgs/bitlbee-steam.nix @@ -0,0 +1,31 @@ +{ stdenv, fetchgit, autoconf, automake, bitlbee-dev, glib, libgcrypt, libtool, pkgconfig }: + +stdenv.mkDerivation rec { + name = "bitlbee-steam-1.3.1"; + + src = fetchgit { + url = "https://github.com/jgeboski/bitlbee-steam"; + rev = "439d777c7e8d06712ffc15c3e51d61799f4c0d0c"; + sha256 = "493924da1083a3b23073c595a9e1989a7ae09a196524ad66ca99c4d8ccc20d2a"; + }; + + buildInputs = [ + autoconf + automake + bitlbee-dev + glib + libgcrypt + libtool + pkgconfig + ]; + + configurePhase = '' + ./autogen.sh + ''; + + installPhase = '' + mkdir -p $out + cp steam/.libs/steam.la $out/ + cp steam/.libs/steam.so $out/ + ''; +} diff --git a/lass/5pkgs/bitlbee.nix b/lass/5pkgs/bitlbee.nix new file mode 100644 index 000000000..2a5a8d86d --- /dev/null +++ b/lass/5pkgs/bitlbee.nix @@ -0,0 +1,71 @@ +{ fetchurl, stdenv, gnutls, glib, pkgconfig, check, libotr, python + , bitlbee-facebook ? null + , bitlbee-steam ? null +}: + +with stdenv.lib; +stdenv.mkDerivation rec { + name = "bitlbee-3.4.1"; + + src = fetchurl { + url = "mirror://bitlbee/src/${name}.tar.gz"; + sha256 = "1qf0ypa9ba5jvsnpg9slmaran16hcc5fnfzbb1sdch1hjhchn2jh"; + }; + + + buildInputs = [ gnutls glib pkgconfig libotr python ] + ++ optional doCheck check; + + configureFlags = [ + "--gcov=1" + "--otr=1" + "--ssl=gnutls" + ]; + + postBuild = '' + ${if (bitlbee-steam != null) then + '' + mkdir -p $out/lib/bitlbee/ + find ${bitlbee-steam} + cp ${bitlbee-steam}/* $out/lib/bitlbee/ + '' + else + "" + } + ''; + #${concatMapStringsSep "\n" ([] ++ + # (if (bitlbee-facebook != null) then + # "cp ${bitlbee-faceook}/* $out/" + # else + # "" + # ) ++ + # (if (bitlbee-steam != null) then + # "cp ${bitlbee-steam}/* $out/" + # else + # "" + # ) + #)} + + doCheck = true; + + meta = { + description = "IRC instant messaging gateway"; + + longDescription = '' + BitlBee brings IM (instant messaging) to IRC clients. It's a + great solution for people who have an IRC client running all the + time and don't want to run an additional MSN/AIM/whatever + client. + + BitlBee currently supports the following IM networks/protocols: + XMPP/Jabber (including Google Talk), MSN Messenger, Yahoo! + Messenger, AIM and ICQ. + ''; + + homepage = http://www.bitlbee.org/; + license = licenses.gpl2Plus; + + maintainers = with maintainers; [ wkennington pSub ]; + platforms = platforms.gnu; # arbitrary choice + }; +} diff --git a/lass/5pkgs/default.nix b/lass/5pkgs/default.nix new file mode 100644 index 000000000..c776262ff --- /dev/null +++ b/lass/5pkgs/default.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: + +let + inherit (pkgs) callPackage; + kpkgs = import ../../krebs/5pkgs { inherit pkgs; }; +in + +kpkgs // +rec { + bitlbee-dev = callPackage ./bitlbee-dev.nix {}; + bitlbee-steam = callPackage ./bitlbee-steam.nix { inherit bitlbee-dev; }; + bitlbee = callPackage ./bitlbee.nix { inherit bitlbee-steam; }; +} diff --git a/tv/1systems/cd.nix b/tv/1systems/cd.nix index 9f412d9b8..b385848f1 100644 --- a/tv/1systems/cd.nix +++ b/tv/1systems/cd.nix @@ -2,10 +2,6 @@ with lib; -let - tvpkgs = import ../5pkgs { inherit pkgs; }; -in - { krebs.build.host = config.krebs.hosts.cd; krebs.build.user = config.krebs.users.tv; @@ -29,13 +25,13 @@ in ../2configs/CAC-Developer-2.nix ../2configs/CAC-CentOS-7-64bit.nix ../2configs/base.nix - ../2configs/consul-server.nix + #../2configs/consul-server.nix ../2configs/git.nix { imports = [ ../2configs/charybdis.nix ]; tv.charybdis = { enable = true; - sslCert = ../../Zcerts/charybdis_cd.crt.pem; + sslCert = ../Zcerts/charybdis_cd.crt.pem; }; } { @@ -136,7 +132,7 @@ in server-names = singleton "viljetic.de"; # TODO directly set root (instead via location) locations = singleton (nameValuePair "/" '' - root ${tvpkgs.viljetic-pages}; + root ${pkgs.viljetic-pages}; ''); }; } @@ -171,6 +167,7 @@ in iptables mutt # for mv nethogs + ntp # ntpate rxvt_unicode.terminfo tcpdump ]; diff --git a/tv/1systems/nomic.nix b/tv/1systems/nomic.nix index 028e53539..f08e74bbe 100644 --- a/tv/1systems/nomic.nix +++ b/tv/1systems/nomic.nix @@ -24,7 +24,7 @@ with lib; imports = [ ../2configs/AO753.nix ../2configs/base.nix - ../2configs/consul-server.nix + #../2configs/consul-server.nix ../2configs/git.nix { tv.iptables = { @@ -112,6 +112,7 @@ with lib; exit 23 esac '') + ntp # ntpate rxvt_unicode.terminfo tmux ]; diff --git a/tv/1systems/wu.nix b/tv/1systems/wu.nix index 2233b48d1..6cd1565f7 100644 --- a/tv/1systems/wu.nix +++ b/tv/1systems/wu.nix @@ -2,10 +2,6 @@ with lib; -let - tvpkgs = import ../5pkgs { inherit pkgs; }; -in - { krebs.build.host = config.krebs.hosts.wu; krebs.build.user = config.krebs.users.tv; @@ -28,22 +24,23 @@ in imports = [ ../2configs/w110er.nix ../2configs/base.nix - ../2configs/consul-client.nix + #../2configs/consul-client.nix ../2configs/git.nix ../2configs/mail-client.nix ../2configs/xserver.nix ../2configs/synaptics.nix # TODO w110er if xserver is enabled + ../2configs/test.nix ../2configs/urlwatch.nix { environment.systemPackages = with pkgs; [ # stockholm + genid git gnumake + hashPassword + lentil parallel - tvpkgs.genid - tvpkgs.hashPassword - tvpkgs.lentil (pkgs.writeScriptBin "ff" '' #! ${pkgs.bash}/bin/bash exec sudo -u ff -i <&2 + ''; + }; + +in out diff --git a/tv/4lib/default.nix b/tv/4lib/default.nix index 352689af4..106535ba2 100644 --- a/tv/4lib/default.nix +++ b/tv/4lib/default.nix @@ -16,12 +16,5 @@ krebs // rec { # "7.4.335" -> "74" majmin = with lib; x : concatStrings (take 2 (splitString "." x)); - shell-escape = - let - isSafeChar = c: match "[-./0-9_a-zA-Z]" c != null; - in - stringAsChars (c: - if isSafeChar c then c - else if c == "\n" then "'\n'" - else "\\${c}"); + shell-escape = krebs.shell.escape; } diff --git a/tv/5pkgs/default.nix b/tv/5pkgs/default.nix index 7b5d10a60..4175292f2 100644 --- a/tv/5pkgs/default.nix +++ b/tv/5pkgs/default.nix @@ -2,12 +2,8 @@ let inherit (pkgs) callPackage; - kpkgs = import ../../krebs/5pkgs { inherit pkgs; }; in -kpkgs // { - charybdis = callPackage ./charybdis {}; - lentil = callPackage ./lentil {}; - much = callPackage ./much.nix {}; +{ viljetic-pages = callPackage ./viljetic-pages {}; } diff --git a/Zcerts/charybdis_cd.crt.pem b/tv/Zcerts/charybdis_cd.crt.pem similarity index 100% rename from Zcerts/charybdis_cd.crt.pem rename to tv/Zcerts/charybdis_cd.crt.pem