Merge remote-tracking branch 'cd/master'

This commit is contained in:
makefu 2016-10-24 14:14:58 +02:00
commit 36cbb3d300
No known key found for this signature in database
GPG key ID: 36F7711F3FC0F225
181 changed files with 321 additions and 354 deletions

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
ReaktorConfig = pkgs.writeText "config.py" '' ReaktorConfig = pkgs.writeText "config.py" ''

View file

@ -1,6 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
acng-config = pkgs.writeTextFile { acng-config = pkgs.writeTextFile {
name = "acng-configuration"; name = "acng-configuration";

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
out = { out = {
options.krebs.backup = api; options.krebs.backup = api;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
gunicorn = pkgs.pythonPackages.gunicorn; gunicorn = pkgs.pythonPackages.gunicorn;
bepasty = pkgs.pythonPackages.bepasty-server; bepasty = pkgs.pythonPackages.bepasty-server;

View file

@ -1,6 +1,6 @@
{ config, ... }: { config, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
options.krebs.build = { options.krebs.build = {

View file

@ -1,6 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
# https://github.com/NixOS/nixpkgs/issues/14026 # https://github.com/NixOS/nixpkgs/issues/14026

View file

@ -1,6 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
buildbot-slave-init = pkgs.writeText "buildbot-slave.tac" '' buildbot-slave-init = pkgs.writeText "buildbot-slave.tac" ''
import os import os

View file

@ -1,6 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.current; cfg = config.krebs.current;

View file

@ -1,6 +1,6 @@
{ config, lib, ... }: { config, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs; cfg = config.krebs;
@ -21,7 +21,6 @@ let
./git.nix ./git.nix
./go.nix ./go.nix
./iptables.nix ./iptables.nix
./lib.nix
./newsbot-js.nix ./newsbot-js.nix
./nginx.nix ./nginx.nix
./nixpkgs.nix ./nixpkgs.nix

View file

@ -1,6 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.exim-retiolum; cfg = config.krebs.exim-retiolum;

View file

@ -1,6 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
indent = replaceChars ["\n"] ["\n "]; indent = replaceChars ["\n"] ["\n "];
cfg = config.krebs.exim-smarthost; cfg = config.krebs.exim-smarthost;

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: with config.krebs.lib; let { config, lib, pkgs, ... }: with import <stockholm/lib>; let
cfg = config.krebs.exim; cfg = config.krebs.exim;
in { in {
options.krebs.exim = { options.krebs.exim = {

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.fetchWallpaper; cfg = config.krebs.fetchWallpaper;

View file

@ -6,7 +6,7 @@
# TODO when authorized_keys changes, then restart ssh # TODO when authorized_keys changes, then restart ssh
# (or kill already connected users somehow) # (or kill already connected users somehow)
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.git; cfg = config.krebs.git;
@ -97,7 +97,7 @@ let
singleton { singleton {
user = [ config.krebs.users.tv ]; user = [ config.krebs.users.tv ];
repo = [ testing ]; # see literal example of repos repo = [ testing ]; # see literal example of repos
perm = push "refs/*" (with config.krebs.lib.git; [ perm = push "refs/*" (with git; [
non-fast-forward create delete merge non-fast-forward create delete merge
]); ]);
} }
@ -389,6 +389,12 @@ let
mapAttrsToList repo-to-cgitrc cfg.repos mapAttrsToList repo-to-cgitrc cfg.repos
)); ));
environment.systemPackages = [
(pkgs.writeDashBin "cgit-clear-cache" ''
${pkgs.coreutils}/bin/rm -f ${cfg.cgit.settings.cache-root}/*
'')
];
system.activationScripts.cgit = '' system.activationScripts.cgit = ''
mkdir -m 0700 -p ${cfg.cgit.settings.cache-root} mkdir -m 0700 -p ${cfg.cgit.settings.cache-root}
chown ${toString cfg.cgit.fcgiwrap.user.uid}:${toString cfg.cgit.fcgiwrap.group.gid} ${cfg.cgit.settings.cache-root} chown ${toString cfg.cgit.fcgiwrap.user.uid}:${toString cfg.cgit.fcgiwrap.group.gid} ${cfg.cgit.settings.cache-root}

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.github-hosts-sync; cfg = config.krebs.github-hosts-sync;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.go; cfg = config.krebs.go;

View file

@ -1,6 +1,6 @@
{ config, lib, ... }: { config, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
hosts = mapAttrs (_: setAttr "owner" config.krebs.users.lass) { hosts = mapAttrs (_: setAttr "owner" config.krebs.users.lass) {
@ -305,5 +305,7 @@ with config.krebs.lib;
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGv6N/UjFnX5vUicT9Sw0+3x4mR0760iaVWZ/JDtdV4h"; pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGv6N/UjFnX5vUicT9Sw0+3x4mR0760iaVWZ/JDtdV4h";
mail = "lass@mors.r"; mail = "lass@mors.r";
}; };
sokratess = {
};
}; };
} }

View file

@ -1,15 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
out = {
options.krebs.lib = api;
config = imp;
};
api = mkOption {
default = {};
type = types.attrs;
};
imp = {
krebs.lib = lib // import ../4lib { inherit config lib; } // builtins;
};
in out

View file

@ -1,6 +1,6 @@
{ config, lib, ... }: { config, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
hosts = mapAttrs (_: setAttr "owner" config.krebs.users.makefu) { hosts = mapAttrs (_: setAttr "owner" config.krebs.users.makefu) {

View file

@ -1,6 +1,6 @@
{ config, ... }: { config, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
hosts = mapAttrs (_: setAttr "owner" config.krebs.users.mv) { hosts = mapAttrs (_: setAttr "owner" config.krebs.users.mv) {

View file

@ -1,10 +1,8 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with builtins; with import <stockholm/lib>;
with lib;
let let
inherit (config.krebs.lib) genid;
cfg = config.krebs.newsbot-js; cfg = config.krebs.newsbot-js;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.nginx; cfg = config.krebs.nginx;

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.nixpkgs; cfg = config.krebs.nixpkgs;

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: with config.krebs.lib; let { config, lib, pkgs, ... }: with import <stockholm/lib>; let
out = { out = {
options.krebs.on-failure = api; options.krebs.on-failure = api;
config = lib.mkIf cfg.enable imp; config = lib.mkIf cfg.enable imp;

View file

@ -1,5 +1,5 @@
{ config, ... }: { config, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
nixos-version-id = "${config.system.nixosVersion}"; nixos-version-id = "${config.system.nixosVersion}";
nixos-version = "${nixos-version-id} (${config.system.nixosCodeName})"; nixos-version = "${nixos-version-id} (${config.system.nixosCodeName})";

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.per-user; cfg = config.krebs.per-user;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.power-action; cfg = config.krebs.power-action;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.realwallpaper; cfg = config.krebs.realwallpaper;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.repo-sync; cfg = config.krebs.repo-sync;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.retiolum-bootstrap; cfg = config.krebs.retiolum-bootstrap;

View file

@ -1,5 +1,5 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
out = { out = {
options.krebs.tinc = api; options.krebs.tinc = api;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.rtorrent; cfg = config.krebs.rtorrent;
webcfg = config.krebs.rtorrent.web; webcfg = config.krebs.rtorrent.web;

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }@args: with config.krebs.lib; let { config, lib, pkgs, ... }@args: with import <stockholm/lib>; let
cfg = config.krebs.secret; cfg = config.krebs.secret;
in { in {
options.krebs.secret = { options.krebs.secret = {

View file

@ -1,5 +1,5 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.setuid; cfg = config.krebs.setuid;

View file

@ -1,6 +1,6 @@
{ config, ... }: { config, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
testHosts = genAttrs [ testHosts = genAttrs [
"test-arch" "test-arch"

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.tinc_graphs; cfg = config.krebs.tinc_graphs;
internal_dir = "${cfg.workingDir}/internal"; internal_dir = "${cfg.workingDir}/internal";

View file

@ -1,6 +1,6 @@
{ config, ... }: { config, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
dns.providers = { dns.providers = {
@ -162,46 +162,6 @@ with config.krebs.lib;
}; };
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHM6dL0fQ8Bd0hER0Xa3I2pAWVHdnwOBaAZhbDlLJmUu"; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHM6dL0fQ8Bd0hER0Xa3I2pAWVHdnwOBaAZhbDlLJmUu";
}; };
ire = {
extraZones = {
# TODO generate krebsco.de zone from nets and don't use extraZones at all
"krebsco.de" = ''
ire 60 IN A ${config.krebs.hosts.ire.nets.internet.ip4.addr}
'';
};
nets = {
internet = {
ip4.addr = "198.147.22.115";
aliases = [
"ire.i"
"ire.internet"
"ire.krebsco.de"
];
ssh.port = 11423;
};
retiolum = {
via = config.krebs.hosts.ire.nets.internet;
ip4.addr = "10.243.231.66";
ip6.addr = "42:b912:0f42:a82d:0d27:8610:e89b:490c";
aliases = [
"ire.r"
"ire.retiolum"
];
tinc.pubkey = ''
-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEAwofjmP/XBf5pwsJlWklkSzI+Bo0I0B9ONc7/j+zpbmMRkwbWk4X7
rVLt1cWvTY15ujg2u8l0o6OgEbIkc6rslkD603fv1sEAd0KOv7iKLgRpE9qfSvAt
6YpiSv+mxEMTpH0g36OmBfOJ10uT+iHDB/FfxmgGJx//jdJADzLjjWC6ID+iGkGU
1Sf+yHXF7HRmQ29Yak8LYVCJpGC5bQfWIMSL5lujLq4NchY2d+NZDkuvh42Ayr0K
LPflnPBQ3XnKHKtSsnFR2vaP6q+d3Opsq/kzBnAkjL26jEuFK1v7P/HhNhJoPzwu
nKKWj/W/k448ce374k5ycjvKm0c6baAC/wIDAQAB
-----END RSA PUBLIC KEY-----
'';
ssh.port = 11423;
};
};
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBaMjBJ/BfYlHjyn5CO0xzFNaQ0LPvMP3W9UlOs1OxGY";
};
kaepsele = { kaepsele = {
nets = { nets = {
internet = { internet = {

View file

@ -4,7 +4,7 @@
# TODO inform about unused caches # TODO inform about unused caches
# cache = url: "${cfg.dataDir}/.urlwatch/cache/${hashString "sha1" url}" # cache = url: "${cfg.dataDir}/.urlwatch/cache/${hashString "sha1" url}"
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.krebs.urlwatch; cfg = config.krebs.urlwatch;

View file

@ -1,59 +0,0 @@
_:
let
lib = import <stockholm/lib>;
in
with lib;
let out = lib // rec {
guard = spec@{ type, value, ... }:
assert isOptionType type;
if type.check value
then value
else throw (toString (filter isString [
"argument"
(if spec ? name then "${spec.name}" else null)
"is not a ${type.name}"
]));
types = import ./types.nix {
lib = lib // { inherit genid optionalTrace; };
};
genid = import ./genid.nix { lib = lib // out; };
genid_signed = x: ((genid x) + 16777216) / 2;
git = import ./git.nix { lib = lib // out; };
tree = import ./tree.nix { inherit lib; };
lpad = n: c: s:
if stringLength s < n
then lpad n c (c + s)
else s;
toC = x: let
type = typeOf x;
reject = throw "cannot convert ${type}";
in {
list = "{ ${concatStringsSep ", " (map toC x)} }";
null = "NULL";
set = if isDerivation x then toJSON x else reject;
string = toJSON x; # close enough
}.${type} or reject;
subdirsOf = path:
mapAttrs (name: _: path + "/${name}")
(filterAttrs (_: eq "directory") (readDir path));
genAttrs' = names: f: listToAttrs (map f names);
getAttrs = names: set:
listToAttrs (map (name: nameValuePair name set.${name})
(filter (flip hasAttr set) names));
setAttr = name: value: set: set // { ${name} = value; };
optionalTrace = c: msg: x: if c then trace msg x else x;
}; in out

View file

@ -1,13 +0,0 @@
{ lib, ... }:
with lib;
rec {
# tree k v = set k (either v (tree k v))
# get : [k] -> tree k v -> v
get = path: tree:
if length path > 0
then get (tail path) tree.${head path} # TODO check if elem exists
else tree;
}

View file

@ -1,5 +1,5 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
rec { rec {
execve = name: { filename, argv ? null, envp ? {}, destination ? "" }: let execve = name: { filename, argv ? null, envp ? {}, destination ? "" }: let
in writeC name { inherit destination; } /* c */ '' in writeC name { inherit destination; } /* c */ ''

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, ... }@args: { config, lib, pkgs, ... }@args:
with config.krebs.lib; with import <stockholm/lib>;
{ {
nixpkgs.config.packageOverrides = pkgs: let nixpkgs.config.packageOverrides = pkgs: let

View file

@ -13,12 +13,12 @@ in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "populate"; name = "populate";
version = "1.1.1"; version = "1.2.0";
src = fetchgit { src = fetchgit {
url = http://cgit.cd.krebsco.de/populate; url = http://cgit.cd.krebsco.de/populate;
rev = "refs/tags/v${version}"; rev = "refs/tags/v${version}";
sha256 = "139f4lzn56lca3qgqy9g33r94m3xi1mqns9340lkb4qm6626yvqd"; sha256 = "0q3110hkkxn9bc3a63xbx1hyd1fpzz4wrck4lng3j5a9i1y1jm07";
}; };
phases = [ phases = [

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
imports = [ imports = [
./3modules ./3modules

View file

@ -1,7 +1,7 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
with builtins; with builtins;
with config.krebs.lib; with import <stockholm/lib>;
{ {
imports = [ imports = [

View file

@ -1,6 +1,6 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
imports = [ imports = [
../. ../.
@ -77,6 +77,9 @@ with config.krebs.lib;
]; ];
}; };
} }
{
services.redis.enable = true;
}
]; ];
krebs.build.host = config.krebs.hosts.mors; krebs.build.host = config.krebs.hosts.mors;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
ip = config.krebs.build.host.nets.internet.ip4.addr; ip = config.krebs.build.host.nets.internet.ip4.addr;

View file

@ -1,6 +1,6 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
with builtins; with import <stockholm/lib>;
{ {
imports = [ imports = [
../. ../.
@ -22,6 +22,26 @@ with builtins;
# }; # };
# }; # };
#} #}
{
users.users.sokratess = {
uid = genid "sokratess";
home = "/home/sokratess";
group = "users";
createHome = true;
extraGroups = [
"audio"
"networkmanager"
];
useDefaultShell = true;
password = "aidsballs";
};
krebs.per-user.sokratess.packages = [
pkgs.firefox
pkgs.python27Packages.virtualenv
pkgs.python27Packages.ipython
pkgs.python27Packages.python
];
}
]; ];
krebs.build.host = config.krebs.hosts.shodan; krebs.build.host = config.krebs.hosts.shodan;

View file

@ -1,7 +1,7 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
with builtins; with builtins;
with config.krebs.lib; with import <stockholm/lib>;
{ {
imports = [ imports = [
../. ../.

View file

@ -1,5 +1,5 @@
{ config, lib, ... }: { config, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
krebs.backup.plans = { krebs.backup.plans = {

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
mainUser = config.users.extraUsers.mainUser; mainUser = config.users.extraUsers.mainUser;

View file

@ -1,6 +1,6 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
sshHostConfig = pkgs.writeText "ssh-config" '' sshHostConfig = pkgs.writeText "ssh-config" ''

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (config.krebs.lib) genid; inherit (import <stockholm/lib>) genid;
in { in {
@ -16,6 +16,10 @@ in {
users.extraGroups.cbasevpn.gid = genid "cbasevpn"; users.extraGroups.cbasevpn.gid = genid "cbasevpn";
environment.systemPackages = [
pkgs.cifs-utils
];
services.openvpn.servers = { services.openvpn.servers = {
c-base = { c-base = {
config = '' config = ''

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
imports = [ imports = [
../2configs/audit.nix ../2configs/audit.nix

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
users.extraUsers = { users.extraUsers = {

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
krebs.exim-retiolum.enable = true; krebs.exim-retiolum.enable = true;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
krebs.exim-smarthost = { krebs.exim-smarthost = {

View file

@ -1,6 +1,6 @@
{ config, ... }: { config, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
nix.gc = { nix.gc = {
automatic = ! elem config.krebs.build.host.name [ "prism" "mors" ]; automatic = ! elem config.krebs.build.host.name [ "prism" "mors" ];

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
environment.systemPackages = [ environment.systemPackages = [
pkgs.go pkgs.go

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
networking.wireless.enable = lib.mkDefault true; networking.wireless.enable = lib.mkDefault true;

View file

@ -2,7 +2,7 @@
let let
mainUser = config.users.extraUsers.mainUser; mainUser = config.users.extraUsers.mainUser;
inherit (config.krebs.lib) genid; inherit (import <stockholm/lib>) genid;
in { in {
virtualisation.libvirtd.enable = true; virtualisation.libvirtd.enable = true;

View file

@ -3,6 +3,6 @@
{ {
krebs.build.source.nixpkgs.git = { krebs.build.source.nixpkgs.git = {
url = https://github.com/nixos/nixpkgs; url = https://github.com/nixos/nixpkgs;
ref = "b8ede35d2efa96490857c22c751e75d600bea44f"; ref = "686bc9c5ccafbec2b6d2db61bd0803c2b7bc2b7d";
}; };
} }

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
pkg = pkgs.pulseaudioLight; pkg = pkgs.pulseaudioLight;
runDir = "/run/pulse"; runDir = "/run/pulse";

View file

@ -1,11 +1,11 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
name = "radio"; name = "radio";
mainUser = config.users.extraUsers.mainUser; mainUser = config.users.extraUsers.mainUser;
inherit (config.krebs.lib) genid; inherit (import <stockholm/lib>) genid;
admin-password = import <secrets/icecast-admin-pw>; admin-password = import <secrets/icecast-admin-pw>;
source-password = import <secrets/icecast-source-pw>; source-password = import <secrets/icecast-source-pw>;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
mirror = "git@${config.networking.hostName}:"; mirror = "git@${config.networking.hostName}:";

View file

@ -2,7 +2,7 @@
let let
mainUser = config.users.extraUsers.mainUser; mainUser = config.users.extraUsers.mainUser;
inherit (config.krebs.lib) genid; inherit (import <stockholm/lib>) genid;
in { in {
users.extraUsers = { users.extraUsers = {

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
services.teamviewer.enable = true; services.teamviewer.enable = true;
} }

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
out = { out = {
environment.systemPackages = [ environment.systemPackages = [

View file

@ -2,7 +2,7 @@
let let
inherit (import <stockholm/krebs/4lib> { config = {}; inherit lib; }) inherit (import <stockholm/lib>)
genid genid
genid_signed genid_signed
; ;
@ -22,25 +22,6 @@ let
exec ${pkgs.msmtp}/bin/msmtp --read-envelope-from -C ${msmtprc} "$@" exec ${pkgs.msmtp}/bin/msmtp --read-envelope-from -C ${msmtprc} "$@"
''; '';
check-password = pkgs.writeDash "check-password" ''
read pw
file="/home/$PAM_USER/.shadow"
#check if shadow file exists
test -e "$file" || exit 123
hash="$(${pkgs.coreutils}/bin/head -1 $file)"
salt="$(echo $hash | ${pkgs.gnused}/bin/sed 's/.*\$\(.*\)\$.*/\1/')"
calc_hash="$(echo "$pw" | ${pkgs.mkpasswd}/bin/mkpasswd -m sha-512 -S $salt)"
if [ "$calc_hash" == $hash ]; then
exit 0
else
exit 1
fi
'';
in { in {
imports = [ imports = [
./sqlBackup.nix ./sqlBackup.nix
@ -164,19 +145,6 @@ in {
{ predicate = "-p tcp --dport 465"; target = "ACCEPT"; } { predicate = "-p tcp --dport 465"; target = "ACCEPT"; }
]; ];
security.pam.services.exim.text = ''
auth required pam_env.so
auth sufficient pam_exec.so debug expose_authtok ${check-password}
auth sufficient pam_unix.so likeauth nullok
auth required pam_deny.so
account required pam_unix.so
password required pam_cracklib.so retry=3 type=
password sufficient pam_unix.so nullok use_authtok md5shadow
password required pam_deny.so
session required pam_limits.so
session required pam_unix.so
'';
krebs.exim-smarthost = { krebs.exim-smarthost = {
authenticators.PLAIN = '' authenticators.PLAIN = ''
driver = plaintext driver = plaintext

View file

@ -2,7 +2,7 @@
with lib; with lib;
let let
inherit (import <stockholm/krebs/4lib> { config = {}; inherit lib; }) inherit (import <stockholm/lib>)
genid genid
head head
; ;

View file

@ -2,7 +2,7 @@
with lib; with lib;
let let
inherit (import <stockholm/krebs/4lib> { config = {}; inherit lib; }) inherit (import <stockholm/lib>)
genid genid
; ;

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
inherit (import <stockholm/krebs/4lib> { config = {}; inherit lib; }) inherit (import <stockholm/lib>)
genid genid
; ;
inherit (import <stockholm/lass/2configs/websites/util.nix> {inherit lib pkgs;}) inherit (import <stockholm/lass/2configs/websites/util.nix> {inherit lib pkgs;})

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (config.krebs.lib) genid; inherit (import <stockholm/lib>) genid;
in { in {
krebs.per-user.chat.packages = with pkgs; [ krebs.per-user.chat.packages = with pkgs; [
mosh mosh

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
pkgs.writeText "Xresources" '' pkgs.writeText "Xresources" ''
URxvt*scrollBar: false URxvt*scrollBar: false

View file

@ -1,5 +1,5 @@
{ config, pkgs, ... }@args: { config, pkgs, ... }@args:
with config.krebs.lib; with import <stockholm/lib>;
let let
user = config.krebs.build.user; user = config.krebs.build.user;
in { in {

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.services.xserver; cfg = config.services.xserver;

View file

@ -1,4 +1,4 @@
{ config, ... }: with config.krebs.lib; let { config, ... }: with import <stockholm/lib>; let
cfg = config.lass.ejabberd; cfg = config.lass.ejabberd;
# XXX this is a placeholder that happens to work the default strings. # XXX this is a placeholder that happens to work the default strings.

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }@args: with config.krebs.lib; let { config, lib, pkgs, ... }@args: with import <stockholm/lib>; let
cfg = config.lass.ejabberd; cfg = config.lass.ejabberd;
in { in {
options.lass.ejabberd = { options.lass.ejabberd = {

View file

@ -1,6 +1,6 @@
{ config, ... }: { config, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
options.lass.hosts = mkOption { options.lass.hosts = mkOption {

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.lass.owncloud; cfg = config.lass.owncloud;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.lass.staticPage; cfg = config.lass.staticPage;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.lass.umts; cfg = config.lass.umts;

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }@args: with config.krebs.lib; let { config, lib, pkgs, ... }@args: with import <stockholm/lib>; let
cfg = config.lass.usershadow; cfg = config.lass.usershadow;

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
cfg = config.lass.wordpress; cfg = config.lass.wordpress;

View file

@ -1,10 +1,44 @@
let let
lib = import <nixpkgs/lib> // builtins // { nixpkgs-lib = import <nixpkgs/lib>;
lib = with lib; nixpkgs-lib // builtins // {
git = import ./git.nix { inherit lib; };
shell = import ./shell.nix { inherit lib; }; shell = import ./shell.nix { inherit lib; };
types = nixpkgs-lib.types // import ./types.nix { inherit lib; };
eq = x: y: x == y; eq = x: y: x == y;
ne = x: y: x != y; ne = x: y: x != y;
mod = x: y: x - y * (x / y); mod = x: y: x - y * (x / y);
genid = import ./genid.nix { inherit lib; };
genid_signed = x: ((lib.genid x) + 16777216) / 2;
lpad = n: c: s:
if lib.stringLength s < n
then lib.lpad n c (c + s)
else s;
subdirsOf = path:
lib.mapAttrs (name: _: path + "/${name}")
(filterAttrs (_: eq "directory") (readDir path));
genAttrs' = names: f: listToAttrs (map f names);
getAttrs = names: set:
listToAttrs (map (name: nameValuePair name set.${name})
(filter (flip hasAttr set) names));
setAttr = name: value: set: set // { ${name} = value; };
toC = x: let
type = typeOf x;
reject = throw "cannot convert ${type}";
in {
list = "{ ${concatStringsSep ", " (map toC x)} }";
null = "NULL";
set = if isDerivation x then toJSON x else reject;
string = toJSON x; # close enough
}.${type} or reject;
}; };
in in

View file

@ -1,10 +1,16 @@
{ lib, ... }: { lib, ... }:
with builtins; let
with lib; inherit (lib)
with types; all any concatMapStringsSep concatStringsSep const filter flip genid
hasSuffix head isInt isString length match mergeOneOption mkOption
mkOptionType optional optionalAttrs optionals range splitString
stringLength tail typeOf;
inherit (lib.types)
attrsOf bool either enum int listOf nullOr path str string submodule;
in
types // rec { rec {
host = submodule ({ config, ... }: { host = submodule ({ config, ... }: {
options = { options = {
@ -20,6 +26,11 @@ types // rec {
default = {}; default = {};
}; };
binary-cache.pubkey = mkOption {
type = nullOr binary-cache-pubkey;
default = null;
};
owner = mkOption { owner = mkOption {
type = user; type = user;
}; };
@ -27,7 +38,7 @@ types // rec {
extraZones = mkOption { extraZones = mkOption {
default = {}; default = {};
# TODO: string is either MX, NS, A or AAAA # TODO: string is either MX, NS, A or AAAA
type = with types; attrsOf string; type = attrsOf string;
}; };
secure = mkOption { secure = mkOption {
@ -331,6 +342,8 @@ types // rec {
merge = mergeOneOption; merge = mergeOneOption;
}; };
binary-cache-pubkey = str;
pgp-pubkey = str; pgp-pubkey = str;
ssh-pubkey = str; ssh-pubkey = str;
@ -356,7 +369,7 @@ types // rec {
tinc-pubkey = str; tinc-pubkey = str;
krebs.file-location = types.submodule { krebs.file-location = submodule {
options = { options = {
# TODO user # TODO user
host = mkOption { host = mkOption {
@ -364,7 +377,7 @@ types // rec {
}; };
# TODO merge with ssl.privkey.path # TODO merge with ssl.privkey.path
path = mkOption { path = mkOption {
type = types.either types.path types.str; type = either path str;
apply = x: { apply = x: {
path = toString x; path = toString x;
string = x; string = x;

View file

@ -1,6 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
byid = dev: "/dev/disk/by-id/" + dev; byid = dev: "/dev/disk/by-id/" + dev;
rootDisk = byid "ata-ADATA_SSD_S599_64GB_10460000000000000039"; rootDisk = byid "ata-ADATA_SSD_S599_64GB_10460000000000000039";

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
external-ip = config.krebs.build.host.nets.internet.ip4.addr; external-ip = config.krebs.build.host.nets.internet.ip4.addr;
internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr; internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr;
@ -40,7 +40,7 @@ in {
''; '';
connectTo = [ connectTo = [
"muhbaasu" "tahoe" "flap" "wry" "muhbaasu" "tahoe" "flap" "wry"
"ire" "cd" "mkdir" "rmdir" "cd"
"fastpoke" "prism" "dishfire" "echelon" "cloudkrebs" "fastpoke" "prism" "dishfire" "echelon" "cloudkrebs"
]; ];
}; };

View file

@ -66,7 +66,7 @@ in {
''; '';
}; };
users.groups.share = { users.groups.share = {
gid = config.krebs.lib.genid "share"; gid = (import <stockholm/lib>).genid "share";
members = [ "makefu" "misa" ]; members = [ "makefu" "misa" ];
}; };
networking.firewall.trustedInterfaces = [ primaryInterface ]; networking.firewall.trustedInterfaces = [ primaryInterface ];

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
external-ip = config.krebs.build.host.nets.internet.ip4.addr; external-ip = config.krebs.build.host.nets.internet.ip4.addr;

View file

@ -1,5 +1,5 @@
{ config, lib, ... }: { config, lib, ... }:
with config.krebs.lib; with import <stockholm/lib>;
let let
# preparation: # preparation:
# mkdir -p defaultBackupDir/host.name/src # mkdir -p defaultBackupDir/host.name/src

View file

@ -11,7 +11,7 @@
# if this is not enough, check out main-laptop.nix # if this is not enough, check out main-laptop.nix
with config.krebs.lib; with import <stockholm/lib>;
let let
mainUser = config.krebs.build.user.name; mainUser = config.krebs.build.user.name;
in in

View file

@ -10,7 +10,7 @@
# wildcard.krebsco.de.key # wildcard.krebsco.de.key
# bepasty-secret.nix <- contains single string # bepasty-secret.nix <- contains single string
with config.krebs.lib; with import <stockholm/lib>;
let let
sec = toString <secrets>; sec = toString <secrets>;
# secKey is nothing worth protecting on a local machine # secKey is nothing worth protecting on a local machine

View file

@ -2,7 +2,7 @@
# graphite-web on port 8080 # graphite-web on port 8080
# carbon cache on port 2003 (tcp/udp) # carbon cache on port 2003 (tcp/udp)
with config.krebs.lib; with import <stockholm/lib>;
let let
connect-time-cfg = with pkgs; writeText "collectd-connect-time.cfg" '' connect-time-cfg = with pkgs; writeText "collectd-connect-time.cfg" ''
LoadPlugin python LoadPlugin python

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with config.krebs.lib; with import <stockholm/lib>;
{ {
imports = [ imports = [
{ {

View file

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
# more than just nginx config but not enough to become a module # more than just nginx config but not enough to become a module
with config.krebs.lib; with import <stockholm/lib>;
let let
hostname = config.krebs.build.host.name; hostname = config.krebs.build.host.name;
external-ip = config.krebs.build.host.nets.internet.ip4.addr; external-ip = config.krebs.build.host.nets.internet.ip4.addr;

View file

@ -2,7 +2,7 @@
# graphite-web on port 8080 # graphite-web on port 8080
# carbon cache on port 2003 (tcp/udp) # carbon cache on port 2003 (tcp/udp)
with config.krebs.lib; with import <stockholm/lib>;
let let
sec = toString <secrets>; sec = toString <secrets>;
acmepath = "/var/lib/acme/"; acmepath = "/var/lib/acme/";

Some files were not shown because too many files have changed in this diff Show more