Skip to content

Instantly share code, notes, and snippets.

@shlevy
shlevy / gist:3091479
Created July 11, 2012 16:11
logstash nixos example
services.logstash = {
enable = true;
inputConfig = {
__type = "repeated";
values = [
{ name = "file"; value = {
type = "syslog";
path = [
"/var/log/messages"
@shlevy
shlevy / gist:3104735
Created July 13, 2012 12:50
logstash config
services.logstash = {
enable = true;
inputConfig = config.lib.logstash.mkNameValuePairs [
{
file = {
type = "syslog";
path = "/var/log/messages";
};
}
@shlevy
shlevy / dont set path
Created July 19, 2012 13:57
PYTHONPATH vs addsitedir
# /nix/store/5qmz5wc596kl7rywx56phyl2gb0052w7-python-2.7.3/bin/python webcharon.wsgi
['/root', '/nix/store/5qmz5wc596kl7rywx56phyl2gb0052w7-python-2.7.3/lib/python27.zip', '/nix/store/5qmz5wc596kl7rywx56phyl2gb0052w7-python-2.7.3/lib/python2.7', '/nix/store/5qmz5wc596kl7rywx56phyl2gb0052w7-python-2.7.3/lib/python2.7/plat-linux2', '/nix/store/5qmz5wc596kl7rywx56phyl2gb0052w7-python-2.7.3/lib/python2.7/lib-tk', '/nix/store/5qmz5wc596kl7rywx56phyl2gb0052w7-python-2.7.3/lib/python2.7/lib-old', '/nix/store/5qmz5wc596kl7rywx56phyl2gb0052w7-python-2.7.3/lib/python2.7/lib-dynload', '/nix/store/5qmz5wc596kl7rywx56phyl2gb0052w7-python-2.7.3/lib/python2.7/site-packages', '/nix/store/n67kdkin76lcswjfv267sig3rp5iyl1f-webcharon-0/lib/python-2.7/site-packages']
@shlevy
shlevy / __init__.py
Created December 17, 2012 18:44
_multiprocess_can_split_, but doesn't
_multiprocess_can_split_ = True
val = 1
def setup():
global val
val = 2
def teardown():
global val
@shlevy
shlevy / gist:4505293
Created January 10, 2013 20:00
filterSource with import-from-derivation
$ cat test.nix
builtins.filterSource (path: type:
import ((import <nixpkgs> {}).writeTextFile { name = "true.nix"; text = "true"; }).outPath
) ./.
$ nix-instantiate test.nix
error: bad archive: unknown field
(use `--show-trace' to show detailed location information)
.POSIX:
TARGETS = a b
.PHONY: all
all: $(TARGETS)
$(TARGETS): $@.o libexample.a
$(CC) $(LDFLAGS) -lexample $@.o
.POSIX:
TARGETS = a b
.PHONY: all
all: $(TARGETS)
$(TARGETS): lib.a
.POSIX:
BUILDROOT = .
SOURCEROOT = .
PROGS = $(BUILDROOT)/a $(BUILDROOT)/b
.PHONY: all
all: $(BUILDROOT)/a $(BUILDROOT)/b
@shlevy
shlevy / Makefile
Last active December 16, 2015 05:19
.POSIX:
TESTS = tests/register-action.test
.PHONY: all
all:
.PHONY: check
check: $(TESTS)
@shlevy
shlevy / gist:5436928
Created April 22, 2013 17:27
Problem with --find-file
$ ls /run/current-system/sw/lib/python2.7/site-packages/charon-0.1-py2.7.egg/charon/../../../../../share/nix/charon/eval-machine-info.nix
/run/current-system/sw/lib/python2.7/site-packages/charon-0.1-py2.7.egg/charon/../../../../../share/nix/charon/eval-machine-info.nix
$ nix-instantiate -I charon=/run/current-system/sw/lib/python2.7/site-packages/charon-0.1-py2.7.egg/charon/../../../../../share/nix/charon --find-file charon/eval-machine-info.nix
error: unable to find `charon/eval-machine-info.nix