Skip to content

Instantly share code, notes, and snippets.

View johanot's full-sized avatar

Johan Thomsen johanot

  • Danish Scout and Guide Association
  • Denmark
View GitHub Profile
{ stdenv, buildGoPackage, fetchFromGitHub }:
buildGoPackage rec {
name = "kube-router-${version}";
version = "v0.2.0-beta.10";
rev = version;
goPackagePath = "github.com/cloudnativelabs/kube-router";
src = fetchFromGitHub {
{ pkgs ? import ../../common/nixpkgs.nix { version = "18.09"; } }:
with pkgs;
stdenv.mkDerivation {
name = "kubernixos";
buildInputs =
let
kubernixos = writeShellScriptBin "kubernixos" ''
DEPLOY="$1"
{ deployment }:
let
network = (import deployment).network;
pkgs = network.pkgs;
option = with pkgs.lib; mkOption {
type = types.listOf types.attrs;
};
merge = item: pkgs.lib.recursiveUpdate item {
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.kube-router;
# CNI-config file name is hardcoded in kube-router source code
cniConfigFileName = "10-kuberouter.conf";
cniFile = pkgs.writeText "cni.cfg" (builtins.toJSON cfg.cniConfig);
{ config, pkgs, lib, ... }:
with lib;
let
desc = "Kubernetes DBC Addons";
cfg = config.services.kubernetes.dbc.addons;
files = with builtins; dir:
remove null
(pkgs.lib.mapAttrsToList
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: dex
name: dex
spec:
replicas: 4
template:
metadata:
{ config, pkgs, ... }: {
deployment.healthChecks = {
cmd = ["${pkgs.kubectl}/bin/kubectl" "apply" "-f" "${pkgs.writeText "test-pod.yaml" (builtins.toJSON (testPod fqdn))}"];
description = "Run test pod on node: ${fqdn}.";
};
services.foo.enable = true;
# whatevs else
#!/usr/bin/env bash
set -euo pipefail
cd $(dirname "${BASH_SOURCE[0]}")
for F in $(ls -1 ../hostgroups/*.nix); do
morph ${@/\{\}/$F}
done
apache.hosts = {
jira = {
hostName = config.services.jira.proxy.name;
proxyTarget = "http://127.0.0.1:${toString config.services.jira.listenPort}";
withAcme = true;
};
johan = {
hostName = "johan.colabo.dk";
@johanot
johanot / test.nix
Created October 14, 2018 15:50
Nix
{ file }:
let
pin = builtins.fromJSON (builtins.readFile file);
in
with pin; import ((import <nixpkgs> {}).fetchgit { inherit rev sha256 url; })