summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2018-01-04 00:21:13 +0100
committermakefu <github@syntax-fehler.de>2018-01-04 00:21:13 +0100
commit8c6bd7431c8620fa65466e880fbd38e2c555367d (patch)
tree9d73f67cf751a6f3f99b6a5a0c3dd0ddaee16382 /krebs
parent6ad170e7621668fdcf03aab37d1f9843e446d2da (diff)
parenta9f803207243425d5c06ce82820c27a4de8af5ad (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs')
-rw-r--r--krebs/2configs/buildbot-all.nix1
-rw-r--r--krebs/2configs/hw/x220.nix2
-rw-r--r--krebs/3modules/ci.nix48
-rw-r--r--krebs/3modules/iptables.nix9
-rw-r--r--krebs/3modules/nin/default.nix45
-rw-r--r--krebs/5pkgs/simple/bitlbee-discord/default.nix29
-rw-r--r--krebs/5pkgs/writers.nix46
-rw-r--r--krebs/6tests/default.nix6
-rw-r--r--krebs/6tests/deploy.nix18
-rw-r--r--krebs/source.nix2
10 files changed, 168 insertions, 38 deletions
diff --git a/krebs/2configs/buildbot-all.nix b/krebs/2configs/buildbot-all.nix
index 8a647012f..ca994e996 100644
--- a/krebs/2configs/buildbot-all.nix
+++ b/krebs/2configs/buildbot-all.nix
@@ -9,5 +9,6 @@ with import <stockholm/lib>;
krebs.ci.enable = true;
krebs.ci.treeStableTimer = 1;
krebs.ci.hosts = filter (getAttr "ci") (attrValues config.krebs.hosts);
+ krebs.ci.tests = [ "deploy" ];
}
diff --git a/krebs/2configs/hw/x220.nix b/krebs/2configs/hw/x220.nix
index 44743b87d..90a1a111f 100644
--- a/krebs/2configs/hw/x220.nix
+++ b/krebs/2configs/hw/x220.nix
@@ -23,7 +23,7 @@ with import <stockholm/lib>;
pkgs.vaapiVdpau
];
- security.rngd.enable = true;
+ security.rngd.enable = mkDefault true;
services.xserver = {
videoDriver = "intel";
diff --git a/krebs/3modules/ci.nix b/krebs/3modules/ci.nix
index b56f5c543..bb19f0602 100644
--- a/krebs/3modules/ci.nix
+++ b/krebs/3modules/ci.nix
@@ -24,6 +24,13 @@ in
List of hosts that should be build
'';
};
+ tests = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ List of tests that should be build
+ '';
+ };
};
config = mkIf cfg.enable {
@@ -56,14 +63,14 @@ in
'';
scheduler = {
build-scheduler = ''
- # build all hosts
sched.append(
schedulers.SingleBranchScheduler(
change_filter=util.ChangeFilter(branch_re=".*"),
treeStableTimer=${toString cfg.treeStableTimer}*60,
name="build-all-branches",
builderNames=[
- "build-hosts"
+ ${optionalString (cfg.hosts != []) ''"hosts",''}
+ ${optionalString (cfg.tests != []) ''"tests",''}
]
)
)
@@ -73,7 +80,8 @@ in
schedulers.ForceScheduler(
name="force",
builderNames=[
- "build-hosts"
+ ${optionalString (cfg.hosts != []) ''"hosts",''}
+ ${optionalString (cfg.tests != []) ''"tests",''}
]
)
)
@@ -91,7 +99,7 @@ in
factory.addStep(steps.ShellCommand(**kwargs))
'';
builder = {
- build-hosts = ''
+ hosts = mkIf (cfg.hosts != []) ''
f = util.BuildFactory()
f.addStep(grab_repo)
@@ -120,12 +128,42 @@ in
bu.append(
util.BuilderConfig(
- name="build-hosts",
+ name="hosts",
slavenames=slavenames,
factory=f
)
)
+ '';
+ tests = mkIf (cfg.tests != []) ''
+ f = util.BuildFactory()
+ f.addStep(grab_repo)
+ def run_test(test):
+ addShell(f,
+ name="{}".format(test),
+ env={
+ "NIX_PATH": "secrets=/var/src/stockholm/null:/var/src",
+ "NIX_REMOTE": "daemon",
+ "dummy_secrets": "true",
+ },
+ command=[
+ "nix-build", "-I", "stockholm=.", "krebs/6tests",
+ "-A", "{}".format(test)
+ ],
+ timeout=90001
+ )
+
+ ${concatMapStringsSep "\n" (test:
+ "run_test(\"${test}\")"
+ ) cfg.tests}
+
+ bu.append(
+ util.BuilderConfig(
+ name="tests",
+ slavenames=slavenames,
+ factory=f
+ )
+ )
'';
};
enable = true;
diff --git a/krebs/3modules/iptables.nix b/krebs/3modules/iptables.nix
index d64ed86de..6298a05a5 100644
--- a/krebs/3modules/iptables.nix
+++ b/krebs/3modules/iptables.nix
@@ -61,6 +61,15 @@ let
};
};
})));
+ default = {
+ filter.INPUT.policy = "ACCEPT";
+ filter.FORWARD.policy = "ACCEPT";
+ filter.OUTPUT.policy = "ACCEPT";
+ nat.PREROUTING.policy = "ACCEPT";
+ nat.INPUT.policy = "ACCEPT";
+ nat.OUTPUT.policy = "ACCEPT";
+ nat.POSTROUTING.policy = "ACCEPT";
+ };
};
};
diff --git a/krebs/3modules/nin/default.nix b/krebs/3modules/nin/default.nix
index aab568352..1a0999b8d 100644
--- a/krebs/3modules/nin/default.nix
+++ b/krebs/3modules/nin/default.nix
@@ -32,6 +32,47 @@ with import <stockholm/lib>;
ssh.privkey.path = <secrets/ssh.id_ed25519>;
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFizK5kauDlnjm/IzyzLi+W4hLKqjSWMkfuxzLwg6egx";
};
+ axon= {
+ cores = 2;
+ nets = {
+ retiolum = {
+ ip4.addr = "10.243.134.66";
+ ip6.addr = "42:0000:0000:0000:0000:0000:0000:1379";
+ aliases = [
+ "axon.retiolum"
+ "axon.r"
+ ];
+ tinc.pubkey = ''
+ -----BEGIN RSA PUBLIC KEY-----
+ MIIECgKCBAEA89h5SLDQL/ENM//3SMzNkVnW4dBdg1GOXs/SdRCTcgygJC0TzsAo
+ glfQhfS+OhFSC/mXAjP8DnN7Ys6zXzMfJgH7TgVRJ8tCo5ETehICA19hMjMFINLj
+ KZhhthPuX7u2Jr4uDMQ0eLJnKVHF4PmHnkA+JGcOqO7VSkgcqPvqPMnJFcMkGWvH
+ L3KAz1KGPHZWrAB2NBDrD/bOZj4L39nS4nJIYVOraP7ze1GTTC7s/0CnZj3qwS5j
+ VdUYgAR+bdxlWm1B1PPOjkslP6UOklQQK4SjK3ceLYb2yM7BVICeznjWCbkbMACY
+ PUSvdxyiD7nZcLv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yL7t0D9r9y+i1RPjYWypgyR568fiGheQIDAQAB
+ -----END RSA PUBLIC KEY-----
+ '';
+ };
+ };
+ ssh.privkey.path = <secrets/ssh.id_ed25519>;
+ ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF4ubHA2pQzV4tQq9D1zRTD1xOSR6xZM3z6te+5A1ekc";
+ };
onondaga = {
cores = 1;
nets = {
@@ -63,6 +104,10 @@ with import <stockholm/lib>;
};
users = {
nin = {
+ mail = "nin@axon.retiolum";
+ pubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl4jHl2dya9Tecot7AcHuk57FiPN0lo8eDa03WmTOCCU7gEJLgpi/zwLxY/K4eXsDgOt8LJwddicgruX2WgIYD3LnwtuN40/U9QqqdBIv/5sYZTcShAK2jyPj0vQJlVUpL7DLxxRH+t4lWeRw/1qaAAVt9jEVbzT5RH233E6+SbXxfnQDhDwOXwD1qfM10BOGh63iYz8/loXG1meb+pkv3HTf5/D7x+/y1XvWRPKuJ2Ml33p2pE3cTd+Tie1O8CREr45I9JOIOKUDQk1klFL5NNXnaQ9h1FRCsnQuoGztoBq8ed6XXL/b8mQ0lqJMxHIoCuDN/HBZYJ0z+1nh8X6XH nin@axon";
+ };
+ nin_h = {
mail = "nin@hiawatha.retiolum";
pubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDicZLUPEVNX7SgqYWcjPo0UESRizEfIvVVbiwa1aApA8x25u/5R3sevcgbIpLHYKDMl5tebny9inr6G2zqB6oq/pocQjHxrPnuLzqjvqeSpbjQjlNWJ9GaHT5koTXZHdkEXGL0vfv1SRDNWUiK0rNymr3GXab4DyrnRnuNl/G1UtLf4Zka94YUD0SSPdS9y6knnRrUWKjGMFBZEbNSgHqMGATPQP9VDwKHIO2OWGfiBAJ4nj/MWj+BxHDleCMY9zbym8yY7p/0PLaUe9eIyLC8MftJ5suuMmASlj+UGWgnqUxWxsMHax9y7CTAc23r1NNCXN5LC6/facGt0rEQrdrTizBgOA1FSHAPCl5f0DBEgWBrRuygEcAueuGWvI8/uvtvQQZLhosDbXEfs/3vm2xoYBe7wH4NZHm+d2LqgIcPXehH9hVQsl6pczngTCJt0Q/6tIMffjhDHeYf6xbe/n3AqFT0PylUSvOw/H5iHws3R6rxtgnOio7yTJ4sq0NMzXCtBY6LYPGnkwf0oKsgB8KavZVnxzF8B1TD4nNi0a7ma7bd1LMzI/oGE6i8kDMROgisIECOcoe8YYJZXIne/wimhhRKZAsd+VrKUo4SzNIavCruCodGAVh2vfrqRJD+HD/aWH7Vr1fCEexquaxeKpRtKGIPW9LRCcEsTilqpZdAiw== nin@hiawatha";
};
diff --git a/krebs/5pkgs/simple/bitlbee-discord/default.nix b/krebs/5pkgs/simple/bitlbee-discord/default.nix
new file mode 100644
index 000000000..c01b87d6b
--- /dev/null
+++ b/krebs/5pkgs/simple/bitlbee-discord/default.nix
@@ -0,0 +1,29 @@
+{ fetchurl, fetchFromGitHub, stdenv, bitlbee, autoreconfHook, pkgconfig, glib }:
+
+with stdenv.lib;
+stdenv.mkDerivation rec {
+ name = "bitlbee-discord-2017-12-27";
+
+ src = fetchFromGitHub {
+ rev = "6a03db169ad44fee55609ecd16e19f3c0f99a182";
+ owner = "sm00th";
+ repo = "bitlbee-discord";
+ sha256 = "1ci9a12c6zg8d6i9f95pq6dal79cp4klmmsyj8ag2gin90kl3x95";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+ buildInputs = [ bitlbee glib ];
+
+ preConfigure = ''
+ export BITLBEE_PLUGINDIR=$out/lib/bitlbee
+ ./autogen.sh
+ '';
+
+ meta = {
+ description = "Bitlbee plugin for Discord";
+
+ homepage = https://github.com/sm00th/bitlbee-discord;
+ license = licenses.gpl2Plus;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/krebs/5pkgs/writers.nix b/krebs/5pkgs/writers.nix
index 6e67ed699..a48fc0f87 100644
--- a/krebs/5pkgs/writers.nix
+++ b/krebs/5pkgs/writers.nix
@@ -283,27 +283,33 @@ with import <stockholm/lib>;
${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out
'');
- writePython2 = name: text:
- assert (with types; either absolute-pathname filename).check name;
- pkgs.writeOut (baseNameOf name) {
- ${optionalString (types.absolute-pathname.check name) name} = {
- check = pkgs.writeDash "python2check.sh" ''
- exec ${pkgs.python2}/bin/python -m py_compile "$1"
- '';
- inherit text;
- };
- };
+ writePython2 = deps:
+ let
+ py = pkgs.python2.withPackages(ps: attrVals deps ps);
+ in
+ pkgs.makeScriptWriter {
+ interpreter = "${py}/bin/python";
+ check = pkgs.writeDash "python2check.sh" ''
+ exec ${pkgs.python2Packages.flake8}/bin/flake8 --show-source "$1"
+ '';
+ };
- writePython3 = name: text:
- assert (with types; either absolute-pathname filename).check name;
- pkgs.writeOut (baseNameOf name) {
- ${optionalString (types.absolute-pathname.check name) name} = {
- check = pkgs.writeDash "python3check.sh" ''
- exec ${pkgs.python3}/bin/python -m py_compile "$textPath"
- '';
- inherit text;
- };
- };
+ writePython2Bin = d: name:
+ pkgs.writePython2 d "/bin/${name}";
+
+ writePython3 = deps:
+ let
+ py = pkgs.python3.withPackages(ps: attrVals deps ps);
+ in
+ pkgs.makeScriptWriter {
+ interpreter = "${py}/bin/python";
+ check = pkgs.writeDash "python3check.sh" ''
+ exec ${pkgs.python3Packages.flake8}/bin/flake8 --show-source "$1"
+ '';
+ };
+
+ writePython3Bin = d: name:
+ pkgs.writePython3 d "/bin/${name}";
writeSed = pkgs.makeScriptWriter {
interpreter = "${pkgs.gnused}/bin/sed -f";
diff --git a/krebs/6tests/default.nix b/krebs/6tests/default.nix
new file mode 100644
index 000000000..c0ca00296
--- /dev/null
+++ b/krebs/6tests/default.nix
@@ -0,0 +1,6 @@
+with import <stockholm/lib>;
+{ ... }:
+
+{
+ deploy = import ./deploy.nix;
+}
diff --git a/krebs/6tests/deploy.nix b/krebs/6tests/deploy.nix
index 842bbc22a..156e9239f 100644
--- a/krebs/6tests/deploy.nix
+++ b/krebs/6tests/deploy.nix
@@ -1,7 +1,8 @@
with import <stockholm/lib>;
-import <nixpkgs/nixos/tests/make-test.nix> ({ pkgs, ... }:
+import <nixpkgs/nixos/tests/make-test.nix> ({ ... }:
let
+ pkgs = import <nixpkgs> { overlays = [(import ../5pkgs)]; };
test-config = <stockholm/krebs/6tests/data/test-config.nix>;
privKey = ''
-----BEGIN OPENSSH PRIVATE KEY-----
@@ -41,15 +42,12 @@ let
cd ${<stockholm>}
export NIX_PATH=stockholm=${<stockholm>}:nixpkgs=${<nixpkgs>}:$NIX_PATH
exec >&2
- : ${minimalSystem}
source=${pkgs.writeJSON "source.json" populate-source}
- cat > /tmp/derp <<EOF
- builtins.fromJSON (builtins.readFile "$source")
- EOF
LOGNAME=krebs ${pkgs.populate}/bin/populate --force root@server:22/var/src/ < "$source"
+ # TODO: make deploy work
#LOGNAME=krebs ${pkgs.stockholm}/bin/deploy \
# --force-populate \
- # --source=/tmp/derp \
+ # --source=${./data/test-source.nix} \
# --system=server \
'';
minimalSystem = (import <nixpkgs/nixos/lib/eval-config.nix> {
@@ -70,22 +68,20 @@ in {
imports = [ test-config ];
environment.variables = {
NIX_PATH = mkForce "nixpkgs=${<nixpkgs>}";
- #LOL = minimalSystem;
};
services.openssh.enable = true;
users.extraUsers.root.openssh.authorizedKeys.keys = [
pubKey
];
- #virtualisation.writableStore = true;
virtualisation.pathsInNixDB = [
minimalSystem
- pkgs.stockholm
];
+ environment.systemPackages = [ pkgs.git ];
};
client =
- { config, pkgs, ... }: { };
-
+ { config, pkgs, ... }:
+ { };
};
testScript = ''
diff --git a/krebs/source.nix b/krebs/source.nix
index 8fbdce284..b952aa2a2 100644
--- a/krebs/source.nix
+++ b/krebs/source.nix
@@ -17,6 +17,6 @@ in
stockholm.file = toString <stockholm>;
nixpkgs.git = {
url = https://github.com/NixOS/nixpkgs;
- ref = "cb751f9b1c3fe6885f3257e69ce328f77523ad77"; # nixos-17.09 @ 2017-12-13
+ ref = "0b30c1dd4c638e318957fc6a9198cf2429e38cb5"; # nixos-17.09 @ 2018-01-04
};
}