Skip to content

Instantly share code, notes, and snippets.

let
rebuild-on-change-daemon = (import <nixpkgs>{}).pkgs.fetchgit { rev = "21a589bfb4c7cd158d524db19d025e616325f34a"; sha256="1wxpzslpxxal1rnl1bns37p93m2i4vaba8lwz0qafh1rmsiqkn4p"; url=https://github.com/nixcloud/rebuild-on-change-daemon;};
in
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
"${rebuild-on-change-daemon}/rebuild-on-change-daemon.nix"
@qknight
qknight / ucurl.c
Created April 7, 2017 20:52 — forked from ato/ucurl.c
LD_PRELOAD wrapper which tricks curl (or anything else) into connecting to a unix domain socket
/*
* LD_PRELOAD wrapper which tricks curl (or anything else) into connecting to a unix domain socket
*
* Compile: gcc -o ucurl.so -shared ucurl.c -ldl -fPIC
* Usage: LD_PRELOAD=/path/to/ucurl.so SOCKET=/path/to/socket curl http://0.0.0.0/
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
# code from aszlig
# transparently injects reverse proxy (proxyMappings) magic into httpd and lighttpd
# idea is:
#
# nix-build aszlig.nix
#
# Proxy mappings:
#
# port: 1234
# mappings:
nix-build -A allCrates.tar --show-trace
error: while evaluating the attribute ‘buildPhase’ of the derivation ‘tar’ at /home/joachim/Desktop/projects/fractalide/nixcrates/nix-crates-index/all-carg-packages.nix:21:7:
while evaluating ‘fold’ at /nix/store/frxv73zjk0xkg6c90i9yb07pjfbcvr9z-nixos-16.09.1038.a6728e1/nixos/lib/lists.nix:29:19, called from /home/joachim/Desktop/projects/fractalide/nixcrates/nix-crates-index/all-carg-packages.nix:18:18:
while evaluating ‘fold'’ at /nix/store/frxv73zjk0xkg6c90i9yb07pjfbcvr9z-nixos-16.09.1038.a6728e1/nixos/lib/lists.nix:32:15, called from /nix/store/frxv73zjk0xkg6c90i9yb07pjfbcvr9z-nixos-16.09.1038.a6728e1/nixos/lib/lists.nix:36:8:
while evaluating anonymous function at /home/joachim/Desktop/projects/fractalide/nixcrates/nix-crates-index/all-carg-packages.nix:18:39, called from /nix/store/frxv73zjk0xkg6c90i9yb07pjfbcvr9z-nixos-16.09.1038.a6728e1/nixos/lib/lists.nix:35:14:
while evaluating ‘fold'’ at /nix/store/frxv73zjk0xkg6c90i9yb07pjfbcvr9z-nixos-16.09.1038.a6728e1/nix
strace -s 1000 -f -e execve cargo build
execve("/nix/store/f2dq5qhbny7dym75c7ai8fb6kyxlyvy9-cargo-0.12.0/bin/cargo", ["cargo", "build"], [/* 94 vars */]) = 0
execve("/nix/store/f2dq5qhbny7dym75c7ai8fb6kyxlyvy9-cargo-0.12.0/bin/.cargo-wrapped", ["/nix/store/f2dq5qhbny7dym75c7ai8fb6kyxlyvy9-cargo-0.12.0/bin/cargo", "build"], [/* 94 vars */]) = 0
strace: Process 4910 attached
[pid 4910] execve("/nix/store/fff3jbf9vbqhmf6qjrmzhliq516x7yrf-rustc-1.11.0/bin/rustc", ["rustc", "-vV", "--cap-lints", "allow"], [/* 94 vars */]) = 0
strace: Process 4911 attached
[pid 4911] +++ exited with 0 +++
[pid 4910] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=4910, si_uid=1000, si_status=0, si_utime=13, si_stime=1} ---
strace: Process 4912 attached
➜ fetchUrl git:(master) ✗ nix-build default.nix -A tar-example -k 1 --show-trace ~/Desktop/projects/fractalide/fetchUrl
these derivations will be built:
/nix/store/lhkj0ch74kv4cm479r1gkdc3367n8jr8-tar-example.drv
building path(s) ‘/nix/store/b7m5vmyaj13vyrz2py5qy92c4yl2mgdw-tar-example’
unpacking sources
unpacking source archive /nix/store/3q2yq22lh5shr0w4fxhcw8h1s61p6q9y-src3
source root is src3
patching sources
configuring
no configure script, doing nothing
fetchUrl git:(master) ✗ nix-build default.nix -A tar-example -k 1 --show-trace
these derivations will be built:
/nix/store/00fz6aizifvkdwppq09yajmddvfdhw8a-getopts.drv
/nix/store/vhw6jc1yvbxf1cpipsajzj03yxbxipc8-libc.drv
/nix/store/dalkgv3agm851123j4d3s77bmlrskkkj-filetime.drv
/nix/store/l2hwysyb8lj62n50bxcl7fx4k89sr47w-xattr.drv
/nix/store/k5r0b405cjffyrhqhh7sq3c1p4mwwpin-tar.drv
/nix/store/sbcr3pyy2a8hjqffdzhvkspy7g08iwy5-tar-example.drv
building path(s) ‘/nix/store/lniqr9y7816fcr94ncwcpwzqxm4n39cl-getopts’
building path(s) ‘/nix/store/jmd1dwfk14z6hlsq8ndbky3cap22vbb9-libc’
installing ‘rustc-master-1.15.0-g2e7176f’
these derivations will be built:
/nix/store/9pqpd61larlhyxs91y394rmxqm198car-rustc-master-1.15.0-g2e7176f.drv
building path(s) ‘/nix/store/wzbm64axil5d8rcj5k1fb0b88zaqsrv9-rustc-master-1.15.0-g2e7176f’, ‘/nix/store/x6w6b0n2jrzmkff51a0s8b1jnxrpy1ck-rustc-master-1.15.0-g2e7176f-doc’
unpacking sources
unpacking source archive /nix/store/15vi738iggabplnwgyjcxjv9y6ij2k0d-rust-2e7176f
source root is rust-2e7176f
patching sources
applying patch /nix/store/cf3sgmib4xxczmpd6ailadx9q299wcv4-disable-lockfile-check-master.patch
patching file src/tools/tidy/src/main.rs
[nix-shell:~/Desktop/projects/fractalide/nixcloud-manual-example]$ cargo install cargo-tree
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling fixedbitset v0.1.5
Compiling gcc v0.3.38
Compiling pkg-config v0.3.8
Compiling strsim v0.5.2
Compiling ordermap v0.2.7
Compiling utf8-ranges v0.1.3
Compiling lazy_static v0.2.2
Compiling bitflags v0.7.0
{ config, pkgs, lib, ... } @ args:
#with lib;
let
stateDir = "/var/lib/crawler/";
in
{
users = {