Skip to content

Instantly share code, notes, and snippets.

@matejc
matejc / push.py
Created June 22, 2016 22:10
push layered image (created by Nix) to registry without docker daemon
#!/usr/bin/env python3
import requests
import json
import hashlib
url = 'http://localhost:5000'
name = 'my-echo'
set -e
NAME="$1"
COMMIT="$2"
BRANCH="$3"
REGISTRY="$4"
REPO="$PWD"
SRC="$REPO-$COMMIT-src"
/*
To print line numbers and files in NodeJS where the console.* functions are called.
add `require('./console.js');` to the begining of your app
run the app with environment variable like so: `CONSOLE_LINES=true`
*/
@matejc
matejc / config.nix
Created February 16, 2016 19:58
here be only examples
services.dockerctl = {
enable = true;
containers.searxOne = {
extraRunOptions = ["-p 7777:5000"];
image = (import /home/matejc/workarea/nixos-docker/searx.nix {}).pull;
};
containers.searxTwo = {
extraRunOptions = ["-p 7778:8888"];
image = (import /home/matejc/workarea/nixos-docker/searx.nix {}).build;
};
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
searx 0.8.0 0af64934fb14 46 years ago 176.5 MB
@matejc
matejc / dockerctl.nix
Last active February 16, 2016 11:30
systemd integration for docker
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.dockerctl;
dataDir = cfg.dataDir;
containers = filterAttrs (n: container: container.enable) cfg.containers;
@matejc
matejc / compose.nix
Last active February 16, 2016 10:42
Nix2DockerCompose
# run: nix-build ./compose.nix --show-trace && cat ./result
{ pkgs ? import <nixpkgs> {}, file ? ./input.nix }:
let
lib = pkgs.lib;
containers = import file { inherit pkgs; };
prefix = level: str:
let
tabSize = 2;
@matejc
matejc / nix-env -iA nixpkgs.bash
Created January 31, 2016 01:12
Couldn't resolve host name
installing ‘bash-4.3-p42’
these derivations will be built:
/nix/store/0ajjndiync9rc9i2mx7hqp3pgs1ypr19-bootstrap-tools.tar.xz?dl=0.drv
/nix/store/d0zdhyh4dd7b6iaqkr2qn9h75lz853s2-busybox?dl=0.drv
/nix/store/k5jmdjfc7l90g7sy128rq2mhynl87paf-bootstrap-tools.drv
/nix/store/2s7a8309aixpz4zhm1mphlra7v3zsldb-stdenv-linux-boot.drv
/nix/store/y1ig4ql6x9n8jny7kx2f01b24fw1i92z-mirrors-list.drv
/nix/store/0fnpp0d6npzfvfh7h6c3c2r761sgagvd-bash43-041.drv
/nix/store/12xspp2cg1vpnqws8p6w4cabz3gvq02s-cloog-0.18.0.tar.gz.drv
/nix/store/h11bk61h9hmvd9pv1d981ilfc0dxs9qq-paxctl-0.9.tar.gz.drv
{ stdenv, fetchurl }:
stdenv.mkDerivation rec {
name = "your-program-${version}";
version = "1.2.3";
src = fetchurl {
url = "https://your-program.com/download/v${version}.tar.gz";
sha256 = "05s3kvsz6pzh4.......lqwg0qn0ljz58sdqh";
};
$ main
[10/30/15 21:49:54] [EROR] Failed to register command nop: Command wasn't registered in any list: nop
[10/30/15 21:49:54] [DEBG] calling newEngine
[10/30/15 21:49:54] [INFO] Initializing
[10/30/15 21:49:54] [DEBG] calling newEngine
[10/30/15 21:49:54] [INFO] Initializing
[10/30/15 21:49:54] [INFO] Loaded ../packages/Default/Default.sublime-keymap
[10/30/15 21:49:54] [INFO] Loaded ../packages/Default/Default.sublime-keymap
[10/30/15 21:49:54] [WARN] Couldn't watch ../packages/Default/Default.sublime-keymap: The callback argument does satisfy any File*Callback interfaces
[10/30/15 21:49:54] [WARN] Couldn't watch ../packages/Default/Default.sublime-keymap: The callback argument does satisfy any File*Callback interfaces