Merge remote-tracking branch 'prism/lassulus'

This commit is contained in:
tv 2017-03-09 16:55:22 +01:00
commit f30a7dd975
10 changed files with 163 additions and 87 deletions
krebs/3modules
lass
makefu/1systems
shared
1systems
2configs

View file

@ -12,7 +12,34 @@ let
api = {
enable = mkEnableOption "repo-sync";
repos = mkOption {
type = with types;attrsOf (attrsOf (attrsOf (attrsOf str)));
type = types.attrsOf (types.submodule {
options = {
branches = mkOption {
type = types.attrsOf (types.submodule ({ config, ... }: {
options = {
origin = mkOption {
type = types.git-source;
};
mirror = mkOption {
type = types.git-source;
};
};
config = {
origin.ref = mkDefault "heads/master";
mirror.ref = mkDefault "heads/${config._module.args.name}";
};
}));
};
latest = mkOption {
type = types.nullOr types.git-source;
default = null;
};
timerConfig = mkOption {
type = types.attrsOf types.str;
default = cfg.timerConfig;
};
};
});
example = literalExample ''
# see `repo-sync --help`
# `ref` provides sane defaults and can be omitted
@ -23,53 +50,53 @@ let
# each attrset defines a group of repos for syncing
{ nxpkgs = {
makefu = {
origin = {
url = http://github.com/makefu/nixpkgs;
ref = "heads/dev" ;
branches = {
makefu = {
origin = {
url = http://github.com/makefu/nixpkgs;
ref = "heads/dev" ;
};
mirror = {
url = "git@internal:nixpkgs-mirror" ;
ref = "heads/github-mirror-dev" ;
};
};
mirror = {
url = "git@internal:nixpkgs-mirror" ;
ref = "heads/github-mirror-dev" ;
lass = {
origin = {
url = http://github.com/lass/nixpkgs;
};
mirror = {
url = "git@internal:nixpkgs-mirror" ;
};
};
};
lass = {
origin = {
url = http://github.com/lass/nixpkgs;
};
mirror = {
url = "git@internal:nixpkgs-mirror" ;
};
};
"@latest" = {
mirror = {
url = "git@internal:nixpkgs-mirror";
ref = "heads/master";
};
latest = {
url = "git@internal:nixpkgs-mirror";
ref = "heads/master";
};
};
stockholm = {
lass = {
origin = {
url = http://cgit.prism.r/stockholm;
branches = {
lass = {
origin = {
url = http://cgit.prism.r/stockholm;
};
mirror = {
url = "git@internal:stockholm-mirror" ;
};
};
mirror = {
url = "git@internal:stockholm-mirror" ;
makefu = {
origin = {
url = http://gum.krebsco.de/stockholm;
};
mirror = {
url = "git@internal:stockholm-mirror" ;
};
};
};
makefu = {
origin = {
url = http://gum.krebsco.de/stockholm;
};
mirror = {
url = "git@internal:stockholm-mirror" ;
};
};
"@latest" = {
mirror = {
url = "git@internal:stockholm-mirror";
ref = "heads/master";
};
latest = {
url = "git@internal:stockholm-mirror";
ref = "heads/master";
};
};
};
@ -127,15 +154,16 @@ let
nameValuePair "repo-sync-${name}" {
description = "repo-sync timer";
wantedBy = [ "timers.target" ];
timerConfig = cfg.timerConfig;
timerConfig = repo.timerConfig;
}
) cfg.repos;
systemd.services = mapAttrs' (name: repo:
let
repo-sync-config = pkgs.writeText "repo-sync-config-${name}.json"
(builtins.toJSON repo);
repo-sync-config = pkgs.writeJSON "repo-sync-config-${name}.json"
(repo.branches // optionalAttrs (repo.latest != null) {
"@latest".mirror = repo.latest;
});
in nameValuePair "repo-sync-${name}" {
description = "repo-sync";
after = [ "network.target" "secret.service" ];

View file

@ -24,6 +24,7 @@ with import <stockholm/lib>;
../2configs/krebs-pass.nix
../2configs/repo-sync.nix
../2configs/ircd.nix
../2configs/logf.nix
{
#risk of rain port
krebs.iptables.tables.filter.INPUT.rules = [
@ -192,7 +193,6 @@ with import <stockholm/lib>;
remmina
thunderbird
logf
iodine
macchanger

View file

@ -215,8 +215,13 @@ in {
}
{
krebs.repo-sync.timerConfig = {
OnBootSec = "15min";
OnUnitInactiveSec = "90min";
RandomizedDelaySec = "30min";
};
krebs.repo-sync.repos.stockholm.timerConfig = {
OnBootSec = "5min";
OnUnitInactiveSec = "3min";
OnUnitInactiveSec = "2min";
RandomizedDelaySec = "2min";
};
}

View file

@ -3,6 +3,7 @@
with import <stockholm/lib>;
{
security.hideProcessInformation = true;
nixpkgs.config.packageOverrides = super: {
htop = pkgs.concat "htop" [
super.htop

21
lass/2configs/logf.nix Normal file
View file

@ -0,0 +1,21 @@
{ config, pkgs, ... }:
with import <stockholm/lib>;
let
host-colors = {
mors = "131";
prism = "95";
uriel = "61";
shodan = "51";
icarus = "53";
echelon = "197";
helios = "199";
cloudkrebs = "119";
};
in {
environment.systemPackages = [
(pkgs.writeDashBin "logf" ''
export LOGF_HOST_COLORS=${pkgs.writeJSON "host-colors" host-colors}
${pkgs.logf}/bin/logf ${concatMapStringsSep " " (name: "root@${name}") (attrNames config.lass.hosts)}
'')
];
}

View file

@ -2,7 +2,7 @@
{
krebs.build.source.nixpkgs.git = {
url = https://github.com/nixos/nixpkgs;
ref = "c0ecd31";
url = https://cgit.lassul.us/nixpkgs;
ref = "c554a0c97f5030a66cc81d41e1f39bff5095efba";
};
}

View file

@ -36,25 +36,27 @@ let
sync-retiolum = name:
{
krebs.repo-sync.repos.${name} = {
makefu = {
origin.url = "http://cgit.gum/${name}";
mirror.url = "${mirror}${name}";
branches = {
makefu = {
origin.url = "http://cgit.gum/${name}";
mirror.url = "${mirror}${name}";
};
tv = {
origin.url = "http://cgit.ni.r/${name}";
mirror.url = "${mirror}${name}";
};
nin = {
origin.url = "http://cgit.onondaga.r/${name}";
mirror.url = "${mirror}${name}";
};
lassulus = {
origin.url = "http://cgit.lassul.us/${name}";
mirror.url = "${mirror}${name}";
};
};
tv = {
origin.url = "http://cgit.ni.r/${name}";
mirror.url = "${mirror}${name}";
};
nin = {
origin.url = "http://cgit.onondaga.r/${name}";
mirror.url = "${mirror}${name}";
};
lassulus = {
origin.url = "http://cgit.lassul.us/${name}";
mirror.url = "${mirror}${name}";
};
"@latest" = {
mirror.url = "${mirror}${name}";
mirror.ref = "heads/newest";
latest = {
url = "${mirror}${name}";
ref = "heads/newest";
};
};
krebs.git = defineRepo name (config.networking.hostName == "prism");
@ -63,9 +65,11 @@ let
sync-remote = name: url:
{
krebs.repo-sync.repos.${name} = {
remote = {
origin.url = url;
mirror.url = "${mirror}${name}";
branches = {
remote = {
origin.url = url;
mirror.url = "${mirror}${name}";
};
};
};
krebs.git = defineRepo name (config.networking.hostName == "prism");
@ -74,9 +78,11 @@ let
sync-remote-silent = name: url:
{
krebs.repo-sync.repos.${name} = {
remote = {
origin.url = url;
mirror.url = "${mirror}${name}";
branches = {
remote = {
origin.url = url;
mirror.url = "${mirror}${name}";
};
};
};
krebs.git = defineRepo name false;
@ -109,4 +115,3 @@ in {
(sync-retiolum "xmonad-stockholm")
];
}

View file

@ -9,7 +9,10 @@ in {
../.
../2configs/zsh-user.nix
../2configs/base-gui.nix
../2configs/laptop-utils.nix
../2configs/tools/core.nix
../2configs/tools/core-gui.nix
../2configs/tools/extra-gui.nix
../2configs/tools/media.nix
../2configs/virtualization.nix
../2configs/tinc/retiolum.nix
];

View file

@ -32,7 +32,17 @@ in
security = import <secrets/grafana_security.nix>;
};
nix.binaryCaches = [ "http://localhost:3142/nixos" "https://cache.nixos.org" ];
nix = {
binaryCaches = [
"http://localhost:3142/nixos"
"http://cache.prism.r"
"https://cache.nixos.org/"
];
binaryCachePublicKeys = [
"cache.prism-1:+S+6Lo/n27XEtvdlQKuJIcb1yO5NUqUCE2lolmTgNJU="
"hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs="
];
};
networking = {
firewall.enable = false;

View file

@ -8,20 +8,23 @@ with lib;
in {
enable = true;
repos.stockholm = {
makefu = {
origin.url = http://cgit.gum/stockholm ;
mirror.url = mirror;
branches = {
makefu = {
origin.url = http://cgit.gum/stockholm ;
mirror.url = mirror;
};
tv = {
origin.url = http://cgit.ni.r/stockholm;
mirror.url = mirror;
};
lassulus = {
origin.url = http://cgit.prism/stockholm ;
mirror.url = mirror;
};
};
tv = {
origin.url = http://cgit.ni.r/stockholm;
mirror.url = mirror;
};
lassulus = {
origin.url = http://cgit.prism/stockholm ;
mirror.url = mirror;
};
"@latest" = {
mirror.url = mirror;
latest = {
url = mirror;
ref = "heads/master";
};
};
};