summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <makefu@nixos.dev>2016-01-18 12:50:20 +0100
committermakefu <makefu@nixos.dev>2016-01-18 12:50:20 +0100
commitf4754010336a1d7c876bc6797a44f30e3d4b4ead (patch)
treede4dff5340b76d970cc404146e688726e4446e0f
parentb86daca11669019d3c2218e623bfb57b5a8033d7 (diff)
parentde891cf43181d28cbc9526993df4e55022d230da (diff)
Merge branch 'master' of gum:stockholm
-rw-r--r--Makefile7
-rw-r--r--krebs/3modules/Reaktor.nix47
-rw-r--r--krebs/3modules/apt-cacher-ng.nix6
-rw-r--r--krebs/3modules/backup.nix286
-rw-r--r--krebs/3modules/bepasty-server.nix4
-rw-r--r--krebs/3modules/buildbot/master.nix385
-rw-r--r--krebs/3modules/buildbot/slave.nix (renamed from makefu/3modules/buildbot/slave.nix)7
-rw-r--r--krebs/3modules/default.nix3
-rw-r--r--krebs/3modules/exim-retiolum.nix20
-rw-r--r--krebs/3modules/fetchWallpaper.nix2
-rw-r--r--krebs/3modules/git.nix8
-rw-r--r--krebs/3modules/github-hosts-sync.nix4
-rw-r--r--krebs/3modules/go.nix5
-rw-r--r--krebs/3modules/makefu/default.nix11
-rw-r--r--krebs/3modules/realwallpaper.nix10
-rw-r--r--krebs/3modules/retiolum.nix4
-rw-r--r--krebs/3modules/shared/default.nix1
-rw-r--r--krebs/3modules/tinc_graphs.nix2
-rw-r--r--krebs/3modules/urlwatch.nix5
-rw-r--r--krebs/4lib/default.nix3
-rw-r--r--krebs/4lib/genid.nix37
-rw-r--r--krebs/4lib/types.nix17
-rw-r--r--krebs/5pkgs/Reaktor/plugins.nix120
-rw-r--r--krebs/5pkgs/Reaktor/scripts/random-emoji.sh (renamed from makefu/2configs/Reaktor/random-emoji.sh)0
-rw-r--r--krebs/5pkgs/Reaktor/scripts/random-issue.sh (renamed from makefu/2configs/Reaktor/random-issue.sh)0
-rw-r--r--krebs/5pkgs/Reaktor/scripts/sed-plugin.py (renamed from makefu/2configs/Reaktor/sed-plugin.py)0
-rw-r--r--krebs/5pkgs/Reaktor/scripts/shack-correct.sh (renamed from makefu/2configs/Reaktor/shack-correct.sh)0
-rw-r--r--krebs/5pkgs/cacpanel/default.nix4
-rw-r--r--krebs/5pkgs/default.nix6
-rw-r--r--krebs/5pkgs/genid/default.nix22
-rw-r--r--krebs/5pkgs/krebszones/default.nix5
-rw-r--r--krebs/5pkgs/snapraid/default.nix33
-rw-r--r--krebs/5pkgs/test/infest-cac-centos7/default.nix (renamed from krebs/5pkgs/krebs-ci/default.nix)10
-rwxr-xr-xkrebs/5pkgs/test/infest-cac-centos7/notes (renamed from krebs/5pkgs/krebs-ci/notes)95
-rw-r--r--krebs/Zhosts/bobby11
-rw-r--r--krebs/Zhosts/kebsco11
-rw-r--r--krebs/default.nix20
-rw-r--r--lass/1systems/mors.nix37
-rw-r--r--lass/2configs/base.nix2
-rw-r--r--lass/2configs/baseX.nix9
-rw-r--r--lass/2configs/libvirt.nix4
-rw-r--r--lass/2configs/skype.nix4
-rw-r--r--lass/2configs/weechat.nix2
-rw-r--r--lass/2configs/xserver/default.nix14
-rw-r--r--lass/3modules/newsbot-js.nix2
-rw-r--r--lass/3modules/owncloud_nginx.nix2
-rw-r--r--lass/3modules/wordpress_nginx.nix2
-rw-r--r--lass/5pkgs/newsbot-js/default.nix4
-rw-r--r--lass/5pkgs/xmonad-lass/Main.hs2
-rw-r--r--makefu/1systems/filepimp.nix25
-rw-r--r--makefu/1systems/gum.nix11
-rw-r--r--makefu/1systems/omo.nix98
-rw-r--r--makefu/1systems/pnp.nix67
-rw-r--r--makefu/1systems/pornocauster.nix16
-rw-r--r--makefu/1systems/vbob.nix1
-rw-r--r--makefu/1systems/wry.nix20
-rw-r--r--makefu/2configs/Reaktor/full.nix18
-rw-r--r--makefu/2configs/Reaktor/random-emoji.nix26
-rw-r--r--makefu/2configs/Reaktor/sed-plugin.nix18
-rw-r--r--makefu/2configs/Reaktor/shack-correct.nix20
-rw-r--r--makefu/2configs/Reaktor/simpleExtend.nix19
-rw-r--r--makefu/2configs/Reaktor/stockholmLentil.nix27
-rw-r--r--makefu/2configs/Reaktor/titlebot.nix38
-rw-r--r--makefu/2configs/default.nix13
-rw-r--r--makefu/2configs/hw/tp-x2x0.nix7
-rw-r--r--makefu/2configs/mail-client.nix2
-rw-r--r--makefu/2configs/nginx/omo-share.nix34
-rw-r--r--makefu/2configs/share-user-sftp.nix21
-rw-r--r--makefu/2configs/smart-monitor.nix18
-rw-r--r--makefu/2configs/urlwatch.nix20
-rw-r--r--makefu/2configs/vim.nix2
-rw-r--r--makefu/2configs/virtualization.nix1
-rw-r--r--makefu/2configs/wwan.nix36
-rw-r--r--makefu/2configs/zsh-user.nix3
-rw-r--r--makefu/3modules/buildbot/master.nix263
-rw-r--r--makefu/3modules/default.nix4
-rw-r--r--makefu/3modules/snapraid.nix125
-rw-r--r--makefu/3modules/umts.nix76
-rw-r--r--shared/1systems/test-all-krebs-modules.nix45
-rw-r--r--shared/1systems/test-failing.nix6
-rw-r--r--shared/1systems/test-minimal-deploy.nix13
-rw-r--r--shared/1systems/wolf.nix4
-rw-r--r--shared/2configs/base.nix4
-rw-r--r--shared/2configs/buildbot-standalone.nix155
-rw-r--r--shared/2configs/cac-ci.nix11
-rw-r--r--tv/1systems/wu.nix8
-rw-r--r--tv/1systems/xu.nix1
-rw-r--r--tv/2configs/backup.nix42
-rw-r--r--tv/2configs/charybdis.nix4
-rw-r--r--tv/2configs/default.nix1
-rw-r--r--tv/2configs/pulse.nix8
-rw-r--r--tv/2configs/vim.nix34
-rw-r--r--tv/2configs/xserver/default.nix2
-rw-r--r--tv/3modules/consul.nix4
-rw-r--r--tv/3modules/ejabberd.nix4
95 files changed, 1896 insertions, 774 deletions
diff --git a/Makefile b/Makefile
index aefd17147..5b898c54c 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,7 @@ ifeq ($(filter),json)
else
filter() { cat; }
endif
- nix-instantiate \
+ result=$$(nix-instantiate \
$${extraArgs-} \
--eval \
-A "$$get" \
@@ -45,8 +45,9 @@ endif
--argstr current-host-name "$$HOSTNAME" \
--argstr current-user-name "$$LOGNAME" \
$${system+--argstr system "$$system"} \
- $${target+--argstr target "$$target"} \
- | filter
+ $${target+--argstr target "$$target"})
+ echo "$$result" | filter
+
else
$(error unbound variable: system[s])
endif
diff --git a/krebs/3modules/Reaktor.nix b/krebs/3modules/Reaktor.nix
index 1ec49b81e..92400139c 100644
--- a/krebs/3modules/Reaktor.nix
+++ b/krebs/3modules/Reaktor.nix
@@ -1,25 +1,15 @@
-{ config, pkgs,lib, ... }:
-
+{ config, lib, pkgs, ... }:
+with lib;
let
- inherit (lib)
- mkIf
- mkOption
- types
- singleton
- isString
- optionalString
- concatStrings
- escapeShellArg
- ;
-
ReaktorConfig = pkgs.writeText "config.py" ''
${if (isString cfg.overrideConfig ) then ''
# Overriden Config
${cfg.overrideConfig}
'' else ""}
## Extra Config
+ ${concatStringsSep "\n" (map (plug: plug.config) cfg.plugins)}
${cfg.extraConfig}
'';
cfg = config.krebs.Reaktor;
@@ -46,7 +36,6 @@ let
'';
};
-
overrideConfig = mkOption {
default = null;
type = types.nullOr types.str;
@@ -55,6 +44,9 @@ let
Reaktor default cfg can be retrieved via `reaktor get-config`
'';
};
+ plugins = mkOption {
+ default = [pkgs.ReaktorPlugins.nixos-version];
+ };
extraConfig = mkOption {
default = "";
type = types.string;
@@ -62,6 +54,14 @@ let
configuration appended to the default or overridden configuration
'';
};
+
+ workdir = mkOption {
+ default = "/var/lib/Reaktor";
+ type = types.str;
+ description = ''
+ Reaktor working directory
+ '';
+ };
extraEnviron = mkOption {
default = {};
type = types.attrsOf types.str;
@@ -70,12 +70,17 @@ let
REAKTOR_HOST
REAKTOR_PORT
REAKTOR_STATEDIR
- REAKTOR_CHANNELS
debug and nickname can be set separately via the Reaktor api
'';
};
-
+ channels = mkOption {
+ default = [ "#krebs" ];
+ type = types.listOf types.str;
+ description = ''
+ Channels the Reaktor should connect to at startup.
+ '';
+ };
debug = mkOption {
default = false;
description = ''
@@ -86,12 +91,11 @@ let
imp = {
# for reaktor get-config
- users.extraUsers = singleton {
+ users.extraUsers = singleton rec {
name = "Reaktor";
- # uid = config.ids.uids.Reaktor;
- uid = 2066439104; #genid Reaktor
+ uid = genid name;
description = "Reaktor user";
- home = "/var/lib/Reaktor";
+ home = cfg.workdir;
createHome = true;
};
@@ -113,6 +117,9 @@ let
GIT_SSL_CAINFO = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
REAKTOR_NICKNAME = cfg.nickname;
REAKTOR_DEBUG = (if cfg.debug then "True" else "False");
+ REAKTOR_CHANNELS = lib.concatStringsSep "," cfg.channels;
+ state_dir = cfg.workdir;
+
} // cfg.extraEnviron;
serviceConfig= {
ExecStartPre = pkgs.writeScript "Reaktor-init" ''
diff --git a/krebs/3modules/apt-cacher-ng.nix b/krebs/3modules/apt-cacher-ng.nix
index 75296bafb..371d39b6f 100644
--- a/krebs/3modules/apt-cacher-ng.nix
+++ b/krebs/3modules/apt-cacher-ng.nix
@@ -119,16 +119,14 @@ let
imp = {
users.extraUsers.acng = {
- # uid = config.ids.uids.acng;
- uid = 897955083; #genid Reaktor
+ uid = genid "acng";
description = "apt-cacher-ng";
home = acng-home;
createHome = false;
};
users.extraGroups.acng = {
- gid = 897955083; #genid Reaktor
- # gid = config.ids.gids.Reaktor;
+ gid = genid "acng";
};
systemd.services.apt-cacher-ng = {
diff --git a/krebs/3modules/backup.nix b/krebs/3modules/backup.nix
new file mode 100644
index 000000000..01bb16a2b
--- /dev/null
+++ b/krebs/3modules/backup.nix
@@ -0,0 +1,286 @@
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ out = {
+ options.krebs.backup = api;
+ config = mkIf cfg.enable imp;
+ };
+
+ cfg = config.krebs.backup;
+
+ api = {
+ enable = mkEnableOption "krebs.backup" // { default = true; };
+ plans = mkOption {
+ default = {};
+ type = types.attrsOf (types.submodule ({
+ # TODO enable = mkEnableOption "TODO" // { default = true; };
+ options = {
+ method = mkOption {
+ type = types.enum ["pull" "push"];
+ };
+ name = mkOption {
+ type = types.str;
+ };
+ src = mkOption {
+ type = types.krebs.file-location;
+ };
+ dst = mkOption {
+ type = types.krebs.file-location;
+ };
+ startAt = mkOption {
+ type = types.str;
+ };
+ snapshots = mkOption {
+ type = types.attrsOf (types.submodule {
+ options = {
+ format = mkOption {
+ type = types.str; # TODO date's +FORMAT
+ };
+ retain = mkOption {
+ type = types.nullOr types.int;
+ default = null; # null = retain all snapshots
+ };
+ };
+ });
+ };
+ };
+ }));
+ };
+ };
+
+ imp = {
+ users.groups.backup.gid = genid "backup";
+ users.users = {}
+ // {
+ root.openssh.authorizedKeys.keys =
+ map (plan: plan.dst.host.ssh.pubkey)
+ (filter isPullSrc (attrValues cfg.plans))
+ ++
+ map (plan: plan.src.host.ssh.pubkey)
+ (filter isPushDst (attrValues cfg.plans))
+ ;
+ }
+ ;
+ systemd.services =
+ flip mapAttrs' (filterAttrs (_:isPullDst) cfg.plans) (name: plan: {
+ name = "backup.${name}.pull";
+ value = makePullService plan;
+ })
+ //
+ flip mapAttrs' (filterAttrs (_:isPushSrc) cfg.plans) (name: plan: {
+ name = "backup.${name}.push";
+ value = makePushService plan;
+ })
+ ;
+ };
+
+ isPushSrc = plan:
+ plan.method == "push" &&
+ plan.src.host.name == config.krebs.build.host.name;
+
+ isPullSrc = plan:
+ plan.method == "pull" &&
+ plan.src.host.name == config.krebs.build.host.name;
+
+ isPushDst = plan:
+ plan.method == "push" &&
+ plan.dst.host.name == config.krebs.build.host.name;
+
+ isPullDst = plan:
+ plan.method == "pull" &&
+ plan.dst.host.name == config.krebs.build.host.name;
+
+ # TODO push destination needs this in the dst.user's PATH
+ service-path = [
+ pkgs.coreutils
+ pkgs.gnused
+ pkgs.openssh
+ pkgs.rsync
+ pkgs.utillinux
+ ];
+
+ # TODO if there is plan.user, then use its privkey
+ makePushService = plan: assert isPushSrc plan; {
+ path = service-path;
+ serviceConfig = {
+ ExecStart = push plan;
+ Type = "oneshot";