diff options
| -rw-r--r-- | krebs/3modules/default.nix | 2 | ||||
| -rw-r--r-- | krebs/3modules/realwallpaper.nix | 8 | ||||
| -rw-r--r-- | krebs/3modules/tv/default.nix | 22 | ||||
| -rw-r--r-- | krebs/5pkgs/htgen/default.nix | 12 | ||||
| -rw-r--r-- | krebs/5pkgs/realwallpaper/default.nix | 8 | ||||
| -rw-r--r-- | lass/1systems/prism.nix | 33 | ||||
| -rw-r--r-- | lass/2configs/newsbot-js.nix | 1 | ||||
| -rw-r--r-- | lass/2configs/nixpkgs.nix | 2 | ||||
| -rw-r--r-- | lass/2configs/realwallpaper.nix | 16 | ||||
| -rw-r--r-- | lib/default.nix | 46 | ||||
| -rw-r--r-- | lib/types.nix | 1 | ||||
| -rw-r--r-- | tv/2configs/default.nix | 2 | 
12 files changed, 110 insertions, 43 deletions
| diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index 0364792b5..37db5bfe7 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -68,7 +68,7 @@ let      # TODO search-domains :: listOf hostname      search-domain = mkOption {        type = types.hostname; -      default = "retiolum"; +      default = "r";      };      zone-head-config  = mkOption {        type = with types; attrsOf str; diff --git a/krebs/3modules/realwallpaper.nix b/krebs/3modules/realwallpaper.nix index f9eae8c92..1e7a9faae 100644 --- a/krebs/3modules/realwallpaper.nix +++ b/krebs/3modules/realwallpaper.nix @@ -32,9 +32,9 @@ let        default = "http://xplanetclouds.com/free/local/clouds_2048.jpg";      }; -    outFile = mkOption { +    marker = mkOption {        type = types.str; -      default = "/tmp/wallpaper.png"; +      default = "http://graphs.r/marker.json";      };      timerConfig = mkOption { @@ -43,7 +43,6 @@ let          OnCalendar = "*:0/15";        };      }; -    };    imp = { @@ -63,6 +62,7 @@ let          imagemagick          curl          file +        jq        ];        environment = { @@ -70,7 +70,7 @@ let          nightmap_url = cfg.nightmap;          daymap_url = cfg.daymap;          cloudmap_url = cfg.cloudmap; -        out_file = cfg.outFile; +        marker_url = cfg.marker;        };        restartIfChanged = true; diff --git a/krebs/3modules/tv/default.nix b/krebs/3modules/tv/default.nix index 48b110fac..2da38e08d 100644 --- a/krebs/3modules/tv/default.nix +++ b/krebs/3modules/tv/default.nix @@ -12,7 +12,7 @@ with import <stockholm/lib>;        nets = {          retiolum = {            ip4.addr = "10.243.21.1"; -          ip6.addr = "42:0:0:0:0:0:0:2101"; +          ip6.addr = "42::2101";            aliases = [              "alnus.r"            ]; @@ -53,7 +53,7 @@ with import <stockholm/lib>;          retiolum = {            via = config.krebs.hosts.caxi.nets.internet;            ip4.addr = "10.243.113.226"; -          ip6.addr = "42:4522:25f8:36bb:8ccb:0150:231a:2af6"; +          ip6.addr = "42:4522:25f8:36bb:8ccb:150:231a:2af6";            aliases = [              "caxi.r"            ]; @@ -94,7 +94,7 @@ with import <stockholm/lib>;          retiolum = {            via = config.krebs.hosts.cd.nets.internet;            ip4.addr = "10.243.113.222"; -          ip6.addr = "42:4522:25f8:36bb:8ccb:0150:231a:2af3"; +          ip6.addr = "42:4522:25f8:36bb:8ccb:150:231a:2af3";            aliases = [              "cd.r"              "cgit.cd.r" @@ -129,7 +129,7 @@ with import <stockholm/lib>;          };          retiolum = {            ip4.addr = "10.243.13.39"; -          ip6.addr = "42:0:0:0:0:0:0:1339"; +          ip6.addr = "42::1339";            aliases = [              "ju.r"            ]; @@ -164,7 +164,7 @@ with import <stockholm/lib>;          };          retiolum = {            ip4.addr = "10.243.166.2"; -          ip6.addr = "42:0b9d:6660:d07c:2bb7:4e91:1a01:2e7d"; +          ip6.addr = "42:b9d:6660:d07c:2bb7:4e91:1a01:2e7d";            aliases = [              "kaepsele.r"            ]; @@ -187,7 +187,7 @@ with import <stockholm/lib>;        nets = {          retiolum = {            ip4.addr = "10.243.20.1"; -          ip6.addr = "42:0:0:0:0:0:0:2001"; +          ip6.addr = "42::2001";            aliases = [              "mu.r"            ]; @@ -226,7 +226,7 @@ with import <stockholm/lib>;          retiolum = {            via = config.krebs.hosts.ni.nets.internet;            ip4.addr = "10.243.113.223"; -          ip6.addr = "42:4522:25f8:36bb:8ccb:0150:231a:2af4"; +          ip6.addr = "42:4522:25f8:36bb:8ccb:150:231a:2af4";            aliases = [              "ni.r"              "cgit.ni.r" @@ -260,7 +260,7 @@ with import <stockholm/lib>;          };          retiolum = {            ip4.addr = "10.243.0.110"; -          ip6.addr = "42:02d5:733f:d6da:c0f5:2bb7:2b18:09ec"; +          ip6.addr = "42:2d5:733f:d6da:c0f5:2bb7:2b18:9ec";            aliases = [              "nomic.r"              "cgit.nomic.r" @@ -318,7 +318,7 @@ with import <stockholm/lib>;          };          retiolum = {            ip4.addr = "10.243.13.37"; -          ip6.addr = "42:0:0:0:0:0:0:1337"; +          ip6.addr = "42::1337";            aliases = [              "wu.r"              "cgit.wu.r" @@ -355,7 +355,7 @@ with import <stockholm/lib>;          };          retiolum = {            ip4.addr = "10.243.13.38"; -          ip6.addr = "42:0:0:0:0:0:0:1338"; +          ip6.addr = "42::1338";            aliases = [              "xu.r"            ]; @@ -387,7 +387,7 @@ with import <stockholm/lib>;          };          retiolum = {            ip4.addr = "10.243.13.40"; -          ip6.addr = "42:0:0:0:0:0:0:1340"; +          ip6.addr = "42::1340";            aliases = [              "zu.r"            ]; diff --git a/krebs/5pkgs/htgen/default.nix b/krebs/5pkgs/htgen/default.nix index f9dfeb3d1..0fca8bdf2 100644 --- a/krebs/5pkgs/htgen/default.nix +++ b/krebs/5pkgs/htgen/default.nix @@ -1,26 +1,26 @@ -{ bash, coreutils, gnused, stdenv, fetchgit, ucspi-tcp }: +{ coreutils, dash, fetchgit, gnused, stdenv, ucspi-tcp }:  with import <stockholm/lib>;  let -  version = "1.1"; +  version = "1.2.2";  in stdenv.mkDerivation {    name = "htgen-${version}";    src = fetchgit {      url = "http://cgit.krebsco.de/htgen";      rev = "refs/tags/v${version}"; -    sha256 = "1zxj0fv9vdrqyl3x2hgq7a6xdlzpclf93akygysrzsqk9wjapp4z"; +    sha256 = "0a8vn35vq6pxgk6d3d2cjp0vdxzq9nqf0zgkvnd6668v4cmdf91b";    };    installPhase = ''      mkdir -p $out/bin      { -      echo '#! ${bash}/bin/bash' +      echo '#! ${dash}/bin/dash'        echo 'export PATH=${makeBinPath [ -        ucspi-tcp          coreutils          gnused +        ucspi-tcp        ]}''${PATH+":$PATH"}' -      cat htgen +      sed 's:^Server=htgen$:&/${version}:' htgen      } > $out/bin/htgen      chmod +x $out/bin/htgen      cp -r examples $out diff --git a/krebs/5pkgs/realwallpaper/default.nix b/krebs/5pkgs/realwallpaper/default.nix index 4fea977ec..dec2dada4 100644 --- a/krebs/5pkgs/realwallpaper/default.nix +++ b/krebs/5pkgs/realwallpaper/default.nix @@ -5,8 +5,8 @@ stdenv.mkDerivation {    src = fetchgit {      url = https://github.com/Lassulus/realwallpaper; -    rev = "c2778c3c235fc32edc8115d533a0d0853ab101c5"; -    sha256 = "0yhbjz19zk8sj5dsvccm6skkqq2vardn1yi70qmd5li7qvp17mvs"; +    rev = "b8408cfb295b6ce5b965309b30358ca6c6409efd"; +    sha256 = "0yyl8hhqshw9bx04xs8glvir3c0qzvfrwzmbvyg318mnz5xalcl0";    };    phases = [ @@ -15,10 +15,6 @@ stdenv.mkDerivation {    ];    buildInputs = [ -    xplanet -    imagemagick -    curl -    file    ];    installPhase = '' diff --git a/lass/1systems/prism.nix b/lass/1systems/prism.nix index e5cbacfc8..9c17c4433 100644 --- a/lass/1systems/prism.nix +++ b/lass/1systems/prism.nix @@ -158,7 +158,7 @@ in {      }      {        users.users.chat.openssh.authorizedKeys.keys = [ -        "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCkmIvB8BekIE2W24+I0gnzkvkEoeulz/zQkDUVJK4oScbIvgTYmcHzQuHJyPueTm67bJCOcYaTwEDNhcR/ZvcyiCQ7Jwa5cLDTkCkcR9LQq8ry5jMNEanvTgrnBIEcwfS7jFpyFb/PRVG6hh2bPOfP+ksFplkq1BTzKt/UTaCBwVEZqi5XuFIlq/MqJg+FIj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/IyvO7vxM2uDX/kIWaeYKrip3nSyWBYnixwrcS4vm6ZQcoejwp2KCfGQwIE4MnGYRlwcOEYjvyjLkZHDiZEivUQ0rThMYBzec8bQ08QW8oxF+NXkFKG3awt3f7TKTRkYqQcOMpFKmV24KDiwgwm0miQ== JuiceSSH"        ];      }      { @@ -194,7 +194,7 @@ in {          ../2configs/realwallpaper.nix        ];        services.nginx.virtualHosts."lassul.us".locations."/wallpaper.png".extraConfig = '' -        alias /tmp/wallpaper.png; +        alias /var/realwallpaper/realwallpaper.png;        '';      }      { @@ -254,19 +254,20 @@ in {        ];      }      { -      krebs.Reaktor.coders = let -        lambdabot = (import (pkgs.fetchFromGitHub { -          owner = "NixOS"; repo = "nixpkgs"; -          rev = "a4ec1841da14fc98c5c35cc72242c23bb698d4ac"; -          sha256 = "148fpw31s922hxrf28yhrci296f7c7zd81hf0k6zs05rq0i3szgy"; -        }) {}).lambdabot; -      in { -        nickname = "reaktor-lass"; +      krebs.Reaktor.coders = { +        nickname = "Reaktor|lass";          channels = [ "#coders" ];          extraEnviron = {            REAKTOR_HOST = "irc.hackint.org";          };          plugins = with pkgs.ReaktorPlugins; let + +          lambdabot = (import (pkgs.fetchFromGitHub { +            owner = "NixOS"; repo = "nixpkgs"; +            rev = "a4ec1841da14fc98c5c35cc72242c23bb698d4ac"; +            sha256 = "148fpw31s922hxrf28yhrci296f7c7zd81hf0k6zs05rq0i3szgy"; +          }) {}).lambdabot; +            lambdabotflags = ''              -XStandaloneDeriving -XGADTs -XFlexibleContexts \              -XFlexibleInstances -XMultiParamTypeClasses \ @@ -349,6 +350,18 @@ in {          ];        };      } +    { +      krebs.Reaktor.prism = { +        nickname = "Reaktor|lass"; +        channels = [ "#retiolum" ]; +        extraEnviron = { +          REAKTOR_HOST = "ni.r"; +        }; +        plugins = with pkgs.ReaktorPlugins; [ +          sed-plugin +        ]; +      }; +    }    ];    krebs.build.host = config.krebs.hosts.prism; diff --git a/lass/2configs/newsbot-js.nix b/lass/2configs/newsbot-js.nix index 3c6c5dc88..d38af211f 100644 --- a/lass/2configs/newsbot-js.nix +++ b/lass/2configs/newsbot-js.nix @@ -163,7 +163,6 @@ let      us_math_society|http://www.ams.org/cgi-bin/content/news_items.cgi?rss=1|#news      vimperator|https://sites.google.com/a/vimperator.org/www/blog/posts.xml|#news      weechat|http://dev.weechat.org/feed/atom|#news -    wired_sci|http://www.wired.com/category/science/feed/|#news      wp_world|http://feeds.washingtonpost.com/rss/rss_blogpost|#news      xkcd|https://xkcd.com/rss.xml|#news      zdnet|http://www.zdnet.com/news/rss.xml|#news diff --git a/lass/2configs/nixpkgs.nix b/lass/2configs/nixpkgs.nix index 24437d040..5309c9551 100644 --- a/lass/2configs/nixpkgs.nix +++ b/lass/2configs/nixpkgs.nix @@ -3,6 +3,6 @@  {    krebs.build.source.nixpkgs.git = {      url = https://cgit.lassul.us/nixpkgs; -    ref = "a563923"; +    ref = "5acb454";    };  } diff --git a/lass/2configs/realwallpaper.nix b/lass/2configs/realwallpaper.nix index cf9795071..116d66276 100644 --- a/lass/2configs/realwallpaper.nix +++ b/lass/2configs/realwallpaper.nix @@ -10,11 +10,23 @@ in {    krebs.realwallpaper.enable = true;    services.nginx.virtualHosts.wallpaper = { +    extraConfig = '' +      if ( $server_addr = "${config.krebs.build.host.nets.internet.ip4.addr}" ) { +        return 403; +      } +    '';      serverAliases = [        hostname +      "${hostname}.r"      ]; -    locations."/wallpaper.png".extraConfig = '' -      root /tmp/; +    locations."/realwallpaper.png".extraConfig = '' +      root /var/realwallpaper/; +    ''; +    locations."/realwallpaper-sat.png".extraConfig = '' +      root /var/realwallpaper/; +    ''; +    locations."/realwallpaper-sat-krebs.png".extraConfig = '' +      root /var/realwallpaper/;      '';    }; diff --git a/lib/default.nix b/lib/default.nix index 7e61c9413..9399a0107 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -41,6 +41,52 @@ let      indent = replaceChars ["\n"] ["\n  "]; +    # https://tools.ietf.org/html/rfc5952 +    normalize-ip6-addr = +      let +        max-run-0 = +          let +            both = v: { off = v; pos = v; }; +            gt = a: b: a.pos - a.off > b.pos - b.off; + +            chkmax = ctx: { +              cur = both (ctx.cur.pos + 1); +              max = if gt ctx.cur ctx.max then ctx.cur else ctx.max; +            }; + +            incpos = ctx: recursiveUpdate ctx { +              cur.pos = ctx.cur.pos + 1; +            }; + +            f = ctx: blk: (if blk == "0" then incpos else chkmax) ctx; +            z = { cur = both 0; max = both 0; }; +          in +            blks: (chkmax (foldl' f z blks)).max; + +        group-zeros = a: +          let +            blks = splitString ":" a; +            max = max-run-0 blks; +            lhs = take max.off blks; +            rhs = drop max.pos blks; +          in +            if max.pos == 0 +              then a +              else "${concatStringsSep ":" lhs}::${concatStringsSep ":" rhs}"; + +        drop-leading-zeros = +          let +            f = block: +              let +                res = match "0*(.+)" block; +              in +                if res == null +                  then block # empty block +                  else elemAt res 0; +          in +            a: concatStringsSep ":" (map f (splitString ":" a)); +      in +        a: toLower (group-zeros (drop-leading-zeros a));    };  in diff --git a/lib/types.nix b/lib/types.nix index 8a3c76483..f511541bd 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -103,6 +103,7 @@ rec {            options = {              addr = mkOption {                type = addr6; +              apply = lib.normalize-ip6-addr;              };              prefix = mkOption ({                type = str; # TODO routing prefix (CIDR) diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index 618dcdccb..cbbd5c439 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -14,7 +14,7 @@ with import <stockholm/lib>;        stockholm.file = "/home/tv/stockholm";        nixpkgs.git = {          url = https://github.com/NixOS/nixpkgs; -        ref = "69d9061908162bd973fcf34d0fc6dc9d9f8cf9ed"; # nixos-17.03 +        ref = "5acb454e2ad3e3783e63b86a9a31e800d2507e66"; # nixos-17.03        };      } // optionalAttrs host.secure {        secrets-master.file = "/home/tv/secrets/master"; | 
