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
{ pkgs ? import ../../common/nixpkgs.nix { version = "18.09"; } }:
with pkgs;
stdenv.mkDerivation {
name = "kubernixos";
buildInputs =
let
kubernixos = writeShellScriptBin "kubernixos" ''
DEPLOY="$1"
{ 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 {
@johanot
johanot / gist:4adb232cbc340e86304fac6e262fd6e1
Created November 15, 2018 14:09
kubectl apply --prune -f namespaces.json --dry-run=true
namespace/user-af configured (dry run)
namespace/user-anm configured (dry run)
namespace/user-apo configured (dry run)
namespace/user-atm configured (dry run)
namespace/user-atu configured (dry run)
namespace/user-ers configured (dry run)
namespace/user-fd configured (dry run)
namespace/user-hwha configured (dry run)
namespace/user-jbn configured (dry run)
namespace/user-jbr configured (dry run)
@johanot
johanot / gist:5d7cd3e29381d2ae70a94f7f7e540049
Created November 15, 2018 14:09
kubectl apply --prune -f namespaces.json --dry-run=false
namespace/user-af configured
namespace/user-anm configured
namespace/user-apo configured
namespace/user-atm configured
namespace/user-atu configured
namespace/user-ers configured
namespace/user-fd configured
{
reservations =
let
program = pkgs.writeText "cidr-filter.py" ''
import ipaddress
import json
import sys
with open(sys.argv[1]) as f:
data = json.load(f)
{
reservations = with pkgs;
let
program = writeScript "cidr-filter.py" ''
#!${python3}/bin/python
import ipaddress
import json
import sys
[nix-shell:~]$ nix-build '<nixpkgs>' --check -A tini
copying path '/nix/store/rc6k1h9iv8yf8y4s7x3l84nq8m07hj87-glibc-2.27-static' from 'https://cache.nixos.org'...
copying path '/nix/store/cr14xxbjmj0jry49c24i3p4ldmdvigl4-libuv-1.23.0' from 'https://cache.nixos.org'...
copying path '/nix/store/lnh9bl9a7al7p6jm36s8py4666qnw0p8-rhash-1.3.6' from 'https://cache.nixos.org'...
copying path '/nix/store/8m5fffwfjz3xjrvxjyv5nzc8wlydvaay-cmake-3.12.1' from 'https://cache.nixos.org'...
checking outputs of '/nix/store/65nzmm3fy0vsjayf4sx6j5m7dy937hmm-tini-0.18.0.drv'...
unpacking sources
unpacking source archive /nix/store/8i2437xbs4y487r24k45jddh0rg148w9-source
source root is source
{ config, pkgs, lib, ... }: with lib; with lib.types; {
options = {
dbc.host = lib.mkOption {
type = attrs;
description = ''
Holds host information as derived from JSON files in /hosts,
about the current host system being built.
'';
};
config.dbc.host = mkDefault
(let
- byHostName = (import ../../hosts { inherit pkgs; }).allHostsbyName;
- netHostName = config.networking.hostName;
+ byHostName = (import ../../hosts { pkgs = import ../../common/nixpkgs.nix { version = "18.09"; }; }).allHostsbyName;
+ netHostName = "prometheus-p02";
in
if netHostName != "" && hasAttr netHostName byHostName
then byHostName.${netHostName}
let
host = { ... }: {
networking.hostName = "foo";
};
bug = { config, lib, ... }:
{
services.vmwareGuest = lib.mkIf (config.networking.hostName == "foo") {
enable = true;
headless = true;