Skip to content

Instantly share code, notes, and snippets.

$ sudo nixos-rebuild switch -I nixpkgs=.
building Nix...
these paths will be fetched (0.88 MiB download, 3.42 MiB unpacked):
/nix/store/i57wr9raazilf2bqpblsfark2pf67as7-nix-1.8pre3705_71a20d4
fetching path `/nix/store/i57wr9raazilf2bqpblsfark2pf67as7-nix-1.8pre3705_71a20d4'...
*** Downloading ‘http://cache.nixos.org/nar/0415ww6rj91w438b7x5h2gw16mjixxh4f4rzqgrwqv8bv8g8csgy.nar.xz’ to ‘/nix/store/i57wr9raazilf2bqpblsfark2pf67as7-nix-1.8pre3705_71a20d4’...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 899k 100 899k 0 0 750k 0 0:00:01 0:00:01 --:--:-- 751k
@shlevy
shlevy / Test.hs
Created July 24, 2014 19:51
cloneSource
{-# LANGUAGE FlexibleContexts, LambdaCase #-}
module Main where
import Data.ByteString (ByteString)
import Conduit.Simple
import Control.Concurrent.STM
import Control.Concurrent.STM.TMQueue
import Control.Concurrent.STM.TBMQueue
import Control.Concurrent.Lifted
import Control.Monad.Trans
{ config, ... }:
{
systemd.services.foo = {
serviceConfig.User = "bar";
preStart = "echo ${builtins.trace config.systemd.services.foo.serviceConfig config.systemd.services.foo.serviceConfig.User}";
};
}
{ lib, config, options, ... }:
with lib;
let
baseArgs = {
inherit nodes;
modules = [];
@shlevy
shlevy / eval-excerpt.cc
Last active December 19, 2015 18:58
abort is not called, but printMsg is
void ExprWith::eval(EvalState & state, Env & env, Value & v)
{
Env & env2(state.allocEnv(1));
if (env2.values[0] != 0)
abort();
env2.up = &env;
if (env2.values[0] != 0)
abort();
env2.prevWith = prevWith;
if (env2.values[0] != 0)
@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
@shlevy
shlevy / Makefile
Last active December 16, 2015 05:19
.POSIX:
TESTS = tests/register-action.test
.PHONY: all
all:
.PHONY: check
check: $(TESTS)
.POSIX:
BUILDROOT = .
SOURCEROOT = .
PROGS = $(BUILDROOT)/a $(BUILDROOT)/b
.PHONY: all
all: $(BUILDROOT)/a $(BUILDROOT)/b
.POSIX:
TARGETS = a b
.PHONY: all
all: $(TARGETS)
$(TARGETS): lib.a
.POSIX:
TARGETS = a b
.PHONY: all
all: $(TARGETS)
$(TARGETS): $@.o libexample.a
$(CC) $(LDFLAGS) -lexample $@.o